sequenceserver 0.8.7 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sequenceserver might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4737ba1f34200ff221fcd3dade2f354e08e9817a
4
- data.tar.gz: 12d003d18b6d2c742443e3cf0cf3980cd5b59516
3
+ metadata.gz: 631b0671719d8700180eb7987e01f0a951b68cfa
4
+ data.tar.gz: 028caff7b7edae94848eaba84dfd48ac5c6f5f81
5
5
  SHA512:
6
- metadata.gz: 019ebc2dc3cfb086ea8437f247b617c5ef6ae2ceb2b7fc2263b4523ad5f8d616864c0bbbd48e49415def44f614d9619d45227222ab8981abff071939066fe924
7
- data.tar.gz: 3e0b894d2c0978daabaa64ba4fdd259364cf908e098e64d8d0d4e5c71c100240ebf17359bb35a8b1204bc17f5204d8a04eb8f4a1441557b0b971db11df7c9eba
6
+ metadata.gz: c1064444047ef36dc19d357bb7ad639a7dd4d4786ff4dee1da8d631dbdacd5bf00530a530d8bb9ba2887616535978f13a1ff1ad7a20974594a3e9dec3bcb99b5
7
+ data.tar.gz: a1379fe0d72402dc1c76ee8197c7ce1faa2a01e4e5c899cff5679c641b2788f419cbdbe4cbcaa305387ea6c292abb8d5bf285f0244551fc2f8ec64e98959271e
@@ -73,8 +73,8 @@ module SequenceServer
73
73
  choice = gets.chomp[0,1].downcase
74
74
 
75
75
  unless choice == 'n'
76
- database_formatter = File.join(settings.root, 'database_formatter.rb')
77
- system("#{database_formatter} #{db_root}")
76
+ database_formatter = File.join(settings.root, 'lib', 'sequenceserver', 'database_formatter.rb')
77
+ require database_formatter
78
78
  retry
79
79
  else
80
80
  raise # let the caller decide what to do if database discovery fails
@@ -0,0 +1,28 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <script type="text/javascript" src="js/jquery.js"></script>
6
+ <script type="text/javascript" src="sequence.min.js"></script>
7
+ <script>
8
+ window.onload = function() {
9
+ var theSequence = "METLCQRLNVCQDKILTHYENDSTDLRDHIDYWKHMRLECAIYYKAREMGFKHINHQVVPTLAVSKNKALQAIELQLTLETIYNSQYSNEKWTLQDVSLEVYLTAPTGCIKKHGYTVEVQFDGDICNTMHYTNWTHIYICEEAojs SVTVVEGQVDYYGLYYVHEGIRTYFVQFKDDAEKYSKNKVWEVHAGGQVILCPTSVFSSNEVSSPEIIRQHLANHPAATHTKAVALGTEETQTTIQRPRSEPDTGNPCHTTKLLHRDSVDSAPILTAFNSSHKGRINCNSNTTPIVHLKGDANTLKCLRYRFKKHCTLYTAVSSTWHWTGHNVKHKSAIVTLTYDSEWQRDQFLSQVKIPKTITVSTGFMSI";
10
+
11
+ mySequence = new Sequence({
12
+ sequence : theSequence,
13
+ target : "holder",
14
+ format : 'CODATA',
15
+ formatOptions : {
16
+ title:false,
17
+ footer:false
18
+ },
19
+ id : 'P918283'
20
+ });
21
+ };
22
+ </script>
23
+
24
+ </head>
25
+ <body>
26
+ <div id="holder" />
27
+ </body>
28
+ </html>
@@ -0,0 +1 @@
1
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.oo=t()}}(function(){var t;return function e(t,n,o){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(r)return r(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,e,t,n,o)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(t,e){$.browser=t("jquery-browser-plugin");var n=t("js-class"),r="onSelectionChange",s="onSelectionChanged",c="onAnnotationClicked";Sequence=n({constructor:function(t){var e=this;this.opt=jQuery.extend(this.opt,t),this._container=jQuery("#"+this.opt.target),this._container.ready(function(){e._initialize()})},opt:{sequence:"",id:"",target:"",format:"FASTA",selection:{start:0,end:0},columns:{size:35,spacedEach:10},highlights:[],annotations:[],sequenceUrl:"http://www.ebi.ac.uk/das-srv/uniprot/das/uniprot/sequence",selectionColor:"Yellow",selectionFontColor:"black",highlightFontColor:"red",highlightBackgroundColor:"white",fontFamily:'"Andale mono", courier, monospace',fontSize:"12px",fontColor:"inherit",backgroundColor:"inherit",width:void 0,height:void 0,formatSelectorVisible:!0},eventTypes:["onSelectionChanged","onSelectionChange","onAnnotationClicked"],getId:function(){return this.opt.id},_headerDiv:null,_contentDiv:null,_initialize:function(){void 0!==this.opt.width&&this._container.width(this.opt.width),void 0!==this.opt.height&&this._container.height(this.opt.height),this._container.css({"-moz-user-select":"none","-webkit-user-select":"none","user-select":"none"}),this._buildFormatSelector(),this._contentDiv=jQuery("<div></div>").appendTo(this._container),this._contentDiv.css({"font-family":this.opt.fontFamily,"font-size":this.opt.fontSize,"text-align":"left"}),this._highlights=this.opt.highlights,this._annotations=this.opt.annotations,jQuery('<div id="sequenceTip'+this.opt.target.id+'"></div>').css({position:"absolute","z-index":"999999",color:"#fff","font-size":"12px",width:"auto",display:"none"}).addClass("tooltip").appendTo("body").hide(),this.opt.sequence?this._redraw():this.opt.id?this._requestSequence(this.opt.id):this.clearSequence("No sequence available","../biojs/css/images/warning_icon.png")},setSequence:function(t,e){t.match(/^([A-N,R-Z][0-9][A-Z][A-Z, 0-9][A-Z, 0-9][0-9])|([O,P,Q][0-9][A-Z, 0-9][A-Z, 0-9][A-Z, 0-9][0-9])(\.\d+)?$/i)?this._requestSequence(arguments[0]):(this.opt.sequence=t,this.opt.id=e,this._highlights=[],this._highlightsCount=0,this.opt.selection={start:0,end:0},this._annotations=[],this._contentDiv.children().remove(),this._redraw())},_requestSequence:function(t){var e=this;console.log("Requesting sequence for: "+t),jQuery.ajax({url:e.opt.sequenceUrl,dataType:"xml",data:{segment:t},success:function(t){try{var n=jQuery(t).find("SEQUENCE:first");e.setSequence(n.text(),n.attr("id"),n.attr("label"))}catch(o){console.log("Error decoding response data: "+o.message),e.clearSequence("No sequence available","../biojs/css/images/warning_icon.png")}},error:function(t,n){console.log("Error decoding response data: "+n),e.clearSequence("Error requesting the sequence to the server "+this.url,"../biojs/css/images/warning_icon.png")}})},clearSequence:function(t,e){var n=void 0;this.opt.sequence="",this.opt.id="",this._highlights=[],this._highlightsCount=0,this.opt.selection={start:0,end:0},this._annotations=[],this._contentDiv.children().remove(),this._headerDiv.hide(),void 0!==t&&(n=jQuery("<div>"+t+"</div>").appendTo(this._contentDiv).addClass("message"),void 0!==e&&n.css({background:'transparent url("'+e+'") no-repeat center left',"padding-left":"20px"}))},setSelection:function(t,e){if(t>e){var n=e;e=t,t=n}(t!=this.opt.selection.start||e!=this.opt.selection.end)&&(this._setSelection(t,e),this.trigger(s,{start:t,end:e}))},_buildFormatSelector:function(){var t=this;this._headerDiv=jQuery("<div></div>").appendTo(this._container),this._headerDiv.css({"font-family":'"Heveltica Neue", Arial, "sans serif"',"font-size":"14px"}).append("Format: "),this._formatSelector=jQuery('<select> <option value="FASTA">FASTA</option><option value="CODATA">CODATA</option><option value="PRIDE">PRIDE</option><option value="RAW">RAW</option></select>').appendTo(t._headerDiv),this._formatSelector.change(function(){t.opt.format=jQuery(this).val(),t._redraw()}),this._formatSelector.val(t.opt.format),this.formatSelectorVisible(this.opt.formatSelectorVisible)},highlight:function(t,e,n,o,i){return this.addHighlight({start:t,end:e,color:n,background:o,id:i})},addHighlight:function(t){var e="-1",n="",o="",i={};return t instanceof Object&&t.start<=t.end&&(n="string"==typeof t.color?t.color:this.opt.highlightFontColor,o="string"==typeof t.background?t.background:this.opt.highlightBackgroundColor,e="string"==typeof t.id?t.id:new Number(this._highlightsCount++).toString(),i={start:t.start,end:t.end,color:n,background:o,id:e},this._highlights.push(i),this._applyHighlight(i),this._restoreSelection(t.start,t.end)),e},_applyHighlight:function(t){for(var e=this._contentDiv.find(".sequence"),n=t.start-1;n<t.end;n++)zindex=jQuery(e[n]).css("z-index"),"auto"==zindex?(z=1,o=1):(z=0,o=.5),jQuery(e[n]).css({color:t.color,"background-color":t.background,"z-index":z,opacity:o}).addClass("highlighted")},_applyHighlights:function(t){for(var e in t)this._applyHighlight(t[e])},_restoreHighlights:function(t,e){var n=this._highlights;this._applyHighlight({start:t,end:e,color:this.opt.fontColor,background:this.opt.backgroundColor});for(var o in n)n[o].start>e||n[o].end<t||(a=n[o].start<t?t:n[o].start,b=n[o].end>e?e:n[o].end,this._applyHighlight({start:a,end:b,color:n[o].color,background:n[o].background}))},_restoreSelection:function(t,e){var n=this.opt.selection;t>n.end||e<n.start||(a=t<n.start?n.start:t,b=e>n.end?n.end:e,this._applyHighlight({start:a,end:b,color:this.opt.selectionFontColor,background:this.opt.selectionColor}))},unHighlight:function(t){this.removeHighlight(t)},removeHighlight:function(t){var e=this._highlights;for(i in e)if(e[i].id==t){start=e[i].start,end=e[i].end,e.splice(i,1),this._restoreHighlights(start,end),this._restoreSelection(start,end);break}},unHighlightAll:function(){this.removeAllHighlights()},removeAllHighlights:function(){this._highlights=[],this._restoreHighlights(1,this.opt.sequence.length),this._restoreSelection(1,this.opt.sequence.length)},setFormat:function(t){this.opt.format!=t.toUpperCase()&&(this.opt.format=t.toUpperCase(),this._redraw());var e=this;this._headerDiv.find("option").each(function(){jQuery(this).val()==e.opt.format.toUpperCase()&&jQuery(this).attr("selected","selected")})},setNumCols:function(t){this.opt.columns.size=t,this._redraw()},formatSelectorVisible:function(t){t?this._headerDiv.show():this._headerDiv.hide()},showFormatSelector:function(){this._headerDiv.show()},hideFormatSelector:function(){this._headerDiv.hide()},hide:function(){this._headerDiv.hide(),this._contentDiv.hide()},show:function(){this._headerDiv.show(),this._contentDiv.show()},_setSelection:function(t,e){var n=this.opt.selection,o={};n.start==t?n.end<e?(o.start=n.end,o.end=e):this._restoreHighlights(e+1,n.end):n.end==e?n.start>t?(o.start=t,o.end=n.start):this._restoreHighlights(n.start,t-1):(this._restoreHighlights(n.start,n.end),o.start=t,o.end=e),n.start=t,n.end=e,void 0!=o.start&&this._applyHighlight({start:o.start,end:o.end,color:this.opt.selectionFontColor,background:this.opt.selectionColor})},_repaintSelection:function(){var t=this.opt.selection;this._setSelection(0,0),this._setSelection(t.start,t.end)},_redraw:function(){this._contentDiv.children().remove(),"RAW"==this.opt.format?this._drawRaw():"CODATA"==this.opt.format?this._drawCodata():"FASTA"==this.opt.format?this._drawFasta():(this.opt.format="PRIDE",this._drawPride()),this._applyHighlights(this._highlights),this._repaintSelection(),this._addSpanEvents()},_drawFasta:function(){var t=this.opt.sequence.toUpperCase().split(""),e=jQuery("<pre></pre>").appendTo(this._contentDiv),n=">"+this.opt.id+" "+t.length+" bp<br/>",o=this.opt.columns.size;this.opt.sequence.length<this.opt.columns.size&&(o=this.opt.sequence.length);var i={numCols:o,numColsForSpace:0};n+=this._drawSequence(t,i),e.html(n),this._drawAnnotations(i)},_drawCodata:function(){var t=this.opt.sequence.toUpperCase().split(""),e=jQuery('<pre style="white-space:pre"></pre>').appendTo(this._contentDiv),n="ENTRY "+this.opt.id+"<br/>";n+="SEQUENCE<br/>",void 0!==this.opt.formatOptions&&void 0!==this.opt.formatOptions.title&&0==this.opt.formatOptions.title&&(n="");var o=this.opt.columns.size;this.opt.sequence.length<this.opt.columns.size&&(o=this.opt.sequence.length);var i={numLeft:!0,numLeftSize:7,numLeftPad:" ",numTop:!0,numTopEach:5,numCols:o,numColsForSpace:0,spaceBetweenChars:!0};n+=this._drawSequence(t,i);var r="<br/>///";void 0!==this.opt.formatOptions&&void 0!==this.opt.formatOptions.footer&&0==this.opt.formatOptions.footer&&(r=""),n+=r,e.html(n),this._drawAnnotations(i)},_drawAnnotations:function(t){var e=this,n=this.opt.sequence.toLowerCase().split(""),o=this._annotations,i="",r="",s="";t.numLeft&&(i+=this._formatIndex(" ",t.numLeftSize+2," "));for(var a=0;a<n.length;a+=t.numCols){r="";for(var h in o)o[h].id=this.getId()+"_"+h,s=this._getHTMLRowAnnot(a+1,o[h],t),s.length>0&&(r+="<br/>",r+=i,r+=s,r+="<br/>");var l=t.numCols,u=n.length-a;l>u&&(l=u),jQuery(r).insertAfter(t.numRight?"div#"+e.opt.target+" div pre span#numRight_"+this.getId()+"_"+(a+l):"div#"+e.opt.target+" div pre span#"+this.getId()+"_"+(a+l))}jQuery(this._contentDiv).find(".annotation").each(function(){e._addToolTip(this,function(){return e._getAnnotationString(jQuery(this).attr("id"))}),jQuery(this).mouseover(function(t){jQuery(".annotation."+jQuery(t.target).attr("id")).each(function(){jQuery(this).css("background-color",jQuery(this).attr("color"))})}).mouseout(function(){jQuery(".annotation").css("background-color","transparent")}).click(function(t){for(var n=void 0,o=jQuery(t.target).attr("id"),i=0;i<e._annotations.length;i++)e._annotations[i].id!=o||(n=e._annotations[i].name);e.trigger(c,{name:n})})})},_getAnnotationString:function(t){var e=this._annotations[t.substr(t.indexOf("_")+1)];return e.name+"<br/>"+(e.html?e.html:"")},_getHTMLRowAnnot:function(t,e,n){for(var o="border-left:1px solid; border-bottom:1px solid; border-color:",i="border-bottom:1px solid; border-color:",r="border-bottom:1px solid; border-right:1px solid; border-color:",s="border-left:1px solid; border-right:1px solid; border-bottom:1px solid; border-color:",a=[],c=t+n.numCols,h=n.spaceBetweenChars?" ":"",l=e.color,u=e.id,p=t;c>p;p++)for(var d in e.regions)region=e.regions[d],spaceAfter="",spaceAfter+=p%n.numColsForSpace==0?" ":"",spaceAfter+=h,color=region.color?region.color:l,data='class="annotation '+u+'" id="'+u+'" color="'+color+'" pos="'+p+'"',p==region.start&&p==region.end?(a[p]='<span style="'+s+color+'" '+data+"> ",a[p]+=spaceAfter,a[p]+="</span>"):p==region.start?(a[p]='<span style="'+o+color+'" '+data+"> ",a[p]+=spaceAfter,a[p]+="</span>"):p==region.end?(a[p]='<span style="'+r+color+' " '+data+"> ",a[p]+="</span>"):p>region.start&&p<region.end?(a[p]='<span style="'+i+color+'" '+data+"> ",a[p]+=spaceAfter,a[p]+="</span>"):a[p]||(a[p]=" ",a[p]+=spaceAfter);var f=a.join("");return-1==f.indexOf("span")?"":f},_drawRaw:function(){var t=this.opt.sequence.toLowerCase().split(""),e=jQuery("<pre></pre>").appendTo(this._contentDiv),n=this.opt.columns.size;this.opt.sequence.length<this.opt.columns.size&&(n=this.opt.sequence.length);var o={numCols:n};e.html(this._drawSequence(t,o)),this._drawAnnotations(o)},_drawPride:function(){var t=this,e=this.opt.sequence.toUpperCase().split(""),n=jQuery("<pre></pre>").appendTo(this._contentDiv),o=this.opt.columns.size;this.opt.sequence.length<this.opt.columns.size&&(o=this.opt.sequence.length),opt={numLeft:!0,numLeftSize:5,numLeftPad:"0",numRight:!0,numRightSize:5,numRightPad:"0",numCols:o,numColsForSpace:t.opt.columns.spacedEach},n.html(this._drawSequence(e,opt)),this._drawAnnotations(opt)},_drawSequence:function(t,e){var n="",o="white-space: pre;";if(e.numTop){n+='<span style="'+o+'" class="numTop">';var i=e.spaceBetweenChars?2*e.numTopEach:e.numTopEach;e.numLeft&&(n+=this._formatIndex(" ",e.numLeftSize," ")),n+=this._formatIndex(" ",i," ");for(var r=e.numTopEach;r<e.numCols;r+=e.numTopEach)n+=this._formatIndex(r,i," ",!0);n+="</span><br/>"}e.numLeft&&(n+=this._formatIndex(1,e.numLeftSize,e.numLeftPad),n+=" ");for(var s=1,a=1;a<=t.length;a++)if(a%e.numCols==0){n+='<span class="sequence" id="'+this.getId()+"_"+a+'">'+t[a-1]+"</span>",e.numRight&&(n+='<span style="'+o+'" id="numRight_'+this.getId()+"_"+a+'">',n+=" ",n+=this._formatIndex(a,e.numRightSize,e.numRightPad),n+="</span>"),n+="<br/>";var c=t.length-a;e.numLeft&&c>0&&(n+='<span id="numLeft_'+this.getId()+"_"+a+'">',n+=this._formatIndex(a+1,e.numLeftSize,e.numLeftPad),n+=" ",n+="</span>"),s=1}else n+='<span class="sequence" style="'+o+'" id="'+this.getId()+"_"+a+'">'+t[a-1],n+=s%e.numColsForSpace==0?" ":"",n+=e.spaceBetweenChars?" ":"",n+="</span>",s++;return n+="<br/>",jQuery.browser.msie&&(n="<pre>"+n+"</pre>"),n},_formatIndex:function(t,e,n,o){var i=t.toString(),r="",s=e-i.length;if(s>0){for(;s-->0;)r+="<span>"+n+"</span>";i=o?t+r:r+t}return i},_addSpanEvents:function(){var t,e=this,n=!1;e._contentDiv.find(".sequence").each(function(){jQuery(this).mousedown(function(){var o=jQuery(this).attr("id");t=parseInt(o.substr(o.indexOf("_")+1)),clickPos=t,e._setSelection(clickPos,t),n=!0,e.trigger(r,{start:e.opt.selection.start,end:e.opt.selection.end})}).mouseover(function(){var o=jQuery(this).attr("id");t=parseInt(o.substr(o.indexOf("_")+1)),n&&(t>clickPos?e._setSelection(clickPos,t):e._setSelection(t,clickPos),e.trigger(r,{start:e.opt.selection.start,end:e.opt.selection.end}))}).mouseup(function(){n=!1,e.trigger(s,{start:e.opt.selection.start,end:e.opt.selection.end})}),e._addToolTip.call(e,this,function(){return n?"["+e.opt.selection.start+", "+e.opt.selection.end+"]":t})}).css("cursor","pointer")},_addToolTip:function(t,e){var n="#sequenceTip"+this.getId();jQuery(t).mouseover(function(o){var i=jQuery(o.target).offset();jQuery(n).is(":visible")||jQuery(n).css({"background-color":"#000",padding:"3px 10px 3px 10px",top:i.top+jQuery(o.target).height()+"px",left:i.left+jQuery(o.target).width()+"px"}).animate({opacity:"0.85"},10).html(e.call(t)).show()}).mouseout(function(){jQuery(n).hide()})},setAnnotation:function(t){this.addAnnotation(t)},addAnnotation:function(t){this._annotations.push(t),this._redraw()},removeAnnotation:function(t){for(var e=0;e<this._annotations.length;e++)if(t!=this._annotations[e].name){this._annotations.splice(e,1),this._redraw();break}},removeAllAnnotations:function(){this._annotations=[],this._redraw()}}),t("biojs-events").mixin(Sequence.prototype),e.exports=Sequence},{"biojs-events":2,"jquery-browser-plugin":5,"js-class":7}],2:[function(t,e){var n=t("backbone-events-standalone");n.onAll=function(t,e){return this.on("all",t,e),this},n.oldMixin=n.mixin,n.mixin=function(t){n.oldMixin(t);for(var e=["onAll"],o=0;o<e.length;o++){var i=e[o];t[i]=this[i]}return t},e.exports=n},{"backbone-events-standalone":4}],3:[function(e,n,o){!function(){function e(){return{keys:Object.keys||function(t){if("object"!=typeof t&&"function"!=typeof t||null===t)throw new TypeError("keys() called on a non-object");var e,n=[];for(e in t)t.hasOwnProperty(e)&&(n[n.length]=e);return n},uniqueId:function(t){var e=++l+"";return t?t+e:e},has:function(t,e){return c.call(t,e)},each:function(t,e,n){if(null!=t)if(a&&t.forEach===a)t.forEach(e,n);else if(t.length===+t.length){for(var o=0,i=t.length;i>o;o++)if(e.call(n,t[o],o,t)===s)return}else for(var r in t)if(this.has(t,r)&&e.call(n,t[r],r,t)===s)return},once:function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}}}}var i,r=this,s={},a=Array.prototype.forEach,c=Object.prototype.hasOwnProperty,h=Array.prototype.slice,l=0,u=e();i={on:function(t,e,n){if(!d(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var o=this._events[t]||(this._events[t]=[]);return o.push({callback:e,context:n,ctx:n||this}),this},once:function(t,e,n){if(!d(this,"once",t,[e,n])||!e)return this;var o=this,i=u.once(function(){o.off(t,i),e.apply(this,arguments)});return i._callback=e,this.on(t,i,n)},off:function(t,e,n){var o,i,r,s,a,c,h,l;if(!this._events||!d(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events={},this;for(s=t?[t]:u.keys(this._events),a=0,c=s.length;c>a;a++)if(t=s[a],r=this._events[t]){if(this._events[t]=o=[],e||n)for(h=0,l=r.length;l>h;h++)i=r[h],(e&&e!==i.callback&&e!==i.callback._callback||n&&n!==i.context)&&o.push(i);o.length||delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=h.call(arguments,1);if(!d(this,"trigger",t,e))return this;var n=this._events[t],o=this._events.all;return n&&f(n,e),o&&f(o,arguments),this},stopListening:function(t,e,n){var o=this._listeners;if(!o)return this;var i=!e&&!n;"object"==typeof e&&(n=this),t&&((o={})[t._listenerId]=t);for(var r in o)o[r].off(e,n,this),i&&delete this._listeners[r];return this}};var p=/\s+/,d=function(t,e,n,o){if(!n)return!0;if("object"==typeof n){for(var i in n)t[e].apply(t,[i,n[i]].concat(o));return!1}if(p.test(n)){for(var r=n.split(p),s=0,a=r.length;a>s;s++)t[e].apply(t,[r[s]].concat(o));return!1}return!0},f=function(t,e){var n,o=-1,i=t.length,r=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++o<i;)(n=t[o]).callback.call(n.ctx);return;case 1:for(;++o<i;)(n=t[o]).callback.call(n.ctx,r);return;case 2:for(;++o<i;)(n=t[o]).callback.call(n.ctx,r,s);return;case 3:for(;++o<i;)(n=t[o]).callback.call(n.ctx,r,s,a);return;default:for(;++o<i;)(n=t[o]).callback.apply(n.ctx,e)}},g={listenTo:"on",listenToOnce:"once"};u.each(g,function(t,e){i[e]=function(e,n,o){var i=this._listeners||(this._listeners={}),r=e._listenerId||(e._listenerId=u.uniqueId("l"));return i[r]=e,"object"==typeof n&&(o=this),e[t](n,o,this),this}}),i.bind=i.on,i.unbind=i.off,i.mixin=function(t){var e=["on","once","off","trigger","stopListening","listenTo","listenToOnce","bind","unbind"];return u.each(e,function(e){t[e]=this[e]},this),t},"function"==typeof t?t(function(){return i}):"undefined"!=typeof o?("undefined"!=typeof n&&n.exports&&(o=n.exports=i),o.BackboneEvents=i):r.BackboneEvents=i}(this)},{}],4:[function(t,e){e.exports=t("./backbone-events-standalone")},{"./backbone-events-standalone":3}],5:[function(t,e){e.exports=t("./jquery.browser")},{"./jquery.browser":6}],6:[function(t,e){var n,o,i=function(t){t=t.toLowerCase();var e=/(opr)[\/]([\w.]+)/.exec(t)||/(chrome)[ \/]([\w.]+)/.exec(t)||/(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[],n=/(ipad)/.exec(t)||/(iphone)/.exec(t)||/(android)/.exec(t)||/(windows phone)/.exec(t)||/(win)/.exec(t)||/(mac)/.exec(t)||/(linux)/.exec(t)||/(cros)/i.exec(t)||[];return{browser:e[3]||e[1]||"",version:e[2]||"0",platform:n[0]||""}};if(n=i(window.navigator.userAgent),o={},o.uaMatch=i,n.browser&&(o[n.browser]=!0,o.version=n.version,o.versionNumber=parseInt(n.version)),n.platform&&(o[n.platform]=!0),(o.android||o.ipad||o.iphone||o["windows phone"])&&(o.mobile=!0),(o.cros||o.mac||o.linux||o.win)&&(o.desktop=!0),(o.chrome||o.opr||o.safari)&&(o.webkit=!0),o.rv){var r="msie";n.browser=r,o[r]=!0}if(o.opr){var s="opera";n.browser=s,o[s]=!0}if(o.safari&&o.android){var a="android";n.browser=a,o[a]=!0}o.name=n.browser,o.platform=n.platform,e.exports=o},{}],7:[function(t,e){(function(t){function n(t,e,n){for(;e&&e!==Object.prototype&&(Object.getOwnPropertyNames(e).forEach(function(n){if(".class"!=n&&!t.hasOwnProperty(n)){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o)}}),!n);)e=e.__proto__;return t}function o(t,e){for(;t;){if(t.type.prototype===e.prototype)return!0;for(var n in t.implements){var i=t.implements[n],r=i[".class.meta"];if(r){if(o(r,e))return!0}else for(var s=i.prototype;s;s=s.__proto__)if(s===e.prototype)return!0}t=t.base?t.base[".class.meta"]:void 0}return!1}var i=function(t,e,n){"function"!=typeof t&&(n=e,e=t,t=Object),e||(e={}),n||(n={});var o={name:n.name,base:t,"implements":[]},r=i.clone(e);n.implements&&(Array.isArray(n.implements)?n.implements:[n.implements]).forEach(function(t){"function"==typeof t&&t.prototype&&(o.implements.push(t),i.extend(r,t.prototype))}),r.__proto__=t.prototype;var s=function(){"function"==typeof this.constructor&&this.constructor.apply(this,arguments)};return o.type=s,s.prototype=r,Object.defineProperty(s,".class.meta",{value:o,enumerable:!1,configurable:!1,writable:!1}),Object.defineProperty(r,".class",{value:s,enumerable:!1,configurable:!1,writable:!1}),n.statics&&i.extend(s,n.statics),s};i.extend=n,i.clone=function(t){return n({},t)};var r=i({constructor:function(t){this.object=t},typeOf:function(t){if(this.object instanceof t)return!0;var e=i.typeInfo(this.object);return e&&o(e,t)}});r.prototype.a=r.prototype.typeOf,r.prototype.an=r.prototype.typeOf,i.is=function(t){return new r(t)},i.typeInfo=function(t){var e=t.__proto__[".class"];return e?e[".class.meta"]:void 0},i.VERSION=[0,0,2],e?e.exports=i:t.Class=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],"biojs-vis-sequence":[function(t,e){e.exports=t("./lib/index")},{"./lib/index":1}]},{},["biojs-vis-sequence"])("biojs-vis-sequence")});
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  # meta
3
3
  s.name = 'sequenceserver'
4
- s.version = '0.8.7'
4
+ s.version = '0.8.9'
5
5
  s.authors = ['Anurag Priyam', 'Ben J Woodcroft', 'Yannick Wurm']
6
6
  s.email = 'anurag08priyam@gmail.com'
7
7
  s.homepage = 'http://sequenceserver.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequenceserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anurag Priyam
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-25 00:00:00.000000000 Z
13
+ date: 2014-12-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -111,7 +111,6 @@ files:
111
111
  - bin/sequenceserver
112
112
  - config.ru
113
113
  - example.config.yml
114
- - lib/profile_code.rb
115
114
  - lib/sequenceserver.rb
116
115
  - lib/sequenceserver/blast.rb
117
116
  - lib/sequenceserver/customisation.rb
@@ -140,6 +139,8 @@ files:
140
139
  - public/js/sequenceserver.blast.js
141
140
  - public/js/sequenceserver.js
142
141
  - public/js/store.min.js
142
+ - public/sequence.html
143
+ - public/sequence.min.js
143
144
  - sequenceserver.gemspec
144
145
  - tests/database/nucleotide/Sinvicta2-2-3.cdna.subset.fasta
145
146
  - tests/database/nucleotide/Sinvicta2-2-3.cdna.subset.fasta.nhr
@@ -153,7 +154,6 @@ files:
153
154
  - tests/test_sequencehelpers.rb
154
155
  - tests/test_sequenceserver_blast.rb
155
156
  - tests/test_ui.rb
156
- - tests/test_ui.rb~
157
157
  - tests/ui.specs.todo
158
158
  - views/500.erb
159
159
  - views/_options.erb
@@ -190,9 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.2.0.rc.1
193
+ rubygems_version: 2.4.2
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: BLAST search made easy!
197
197
  test_files: []
198
- has_rdoc:
@@ -1,217 +0,0 @@
1
- require 'ruby-prof'
2
-
3
- $:.unshift '.'
4
-
5
- #require 'sinatra/base'
6
- require 'yaml'
7
- require 'logger'
8
- require 'fileutils'
9
- require 'sequenceserver/helpers'
10
- require 'sequenceserver/blast'
11
- require 'sequenceserver/sequencehelpers'
12
- require 'sequenceserver/sinatralikeloggerformatter'
13
- require 'sequenceserver/customisation'
14
- require 'sequenceserver/version'
15
-
16
- require 'sequenceserver'
17
-
18
-
19
- query = '>1111883
20
- GCTGGCGGCGTGCCTAACACATGTAAGTCGAACGGGACTGGGGGCAACTCCAGTTCAGTG
21
- GCAGACGGGTGCGTAACACGTGAGCAACTTGTCCGACGGCGGGGGATAGCCGGCCCAACG
22
- GCCGGGTAATACCGCGTACGCTCGTTTAGGGACATCCCTGAATGAGGAAAGCCGTAAGGC
23
- ACCGACGGAGAGGCTCGCGGCCTATCAGCTAGTTGGCGGGGTAACGGCCCACCAAGGCGA
24
- CGACGGGTAGCTGGTCTGAGAGGATGGCCAGCCACATTGGGACTGAGACACGGCCCAGAC
25
- TCCTACGGGAGGCAGCAGTGGGGAATCTTGCGCAATGGCCGCAAGGCTGACGCAGCGACG
26
- CCGCGTGTGGGATGACGGCCTTCGGGTTGTAAACCACTGTCGGGAGGAACGAATACTCGG
27
- CTAGTCCGAGGGTGACGGTACCTCCAAAGGAAGCACCGGCTAACTCCGTGCCAGCAGCCG
28
- CGGTAATACGGAGGGTGCGAGCGTTGTCCGGAATCACTGGGCGTAAAGGGCGCGTAGGTG
29
- GCCCGTTAAGTGGCTGGTGAAATCCCGGGGCTCAACTCCGGGGCTGCCGGTCAGACTGGC
30
- GAGCTAGAGCACGGTAGGGGCAGATGGAATTCCCGGTGTAGCGGTGGAATGCGTAGATAT
31
- CGGGAAGAATACCAGTGGCGAAGGCGTTCTGCTGGGCCGTTGCTGACACTGAGGCGCGAC
32
- AGCGTGGGGAGCAAACAGGATTAGATACCCTGGTAGTCCACGCCGTAAACGATGGACACT
33
- AGACGTCGGGGGGAGCGACCCTCCCGGTGTCGTCGCTAACGCAGTAAGTGTCCCGCCTGG
34
- GGAGTACGGCCGCAAGGCTGAAACTCAAAGGAATTGACGGGGGCCCGCACAAGCGGTGGA
35
- GCATGTGGTTTAATTCGAAGCAACGCGAAGAACCTTACCTGGGCTTGACATGCTGGTGCA
36
- AGCCGGTGGAAACATCGGCCCCTCTTCGGAGCGCCAGCACAGGTGCTGCATGGCTGTCGT
37
- CAGCTCGTGTCGTGAGATGTTGGGTTAAGTCCCGCAACGAGCGCAACTCTCGCTCCCAGT
38
- TGCCAGCGGTTCGGCCGGGGACTCTGGGGGGACTGCCGGCGTTAAGCCGGAGGAAGGTGG
39
- GGACGACGTCAAGTCATCATGGCCCTTACGTCCAGGGCGACACACGTGCTACAATGCCTG
40
- GTACAGCGCGTCGCGAACTCGCAAGAGGGAGCCAATCGCCAAAAGCCGGGCTAAGTTCGG
41
- ATTGTCGTCTGCAACTCGACGGCATGAAGCCGGAATCGCTAGTAATCGCGGATCAGCCAC
42
- GCCGCGGTGAATACGTTCCCGGGCCTTGTACACACCGCCCGTCACGCCATGGAAGCCGGA
43
- GGGACCCGAAACCGGTGGGCCAACCGCAAGGGGGCAGCCGTCTAAGGT'
44
-
45
- #blastn -db '/home/ben/git/sequenceserver/db/97_otus.fasta' -query '/tmp/sequenceserver_query20140119-10926-qt2ecp' -task blastn -num_threads 1 -html
46
- method = 'blastn'#params['method']
47
- databases = ['/home/ben/git/sequenceserver/db/97_otus.fasta']#params[:databases]
48
- sequence = query #params[:sequence]
49
- advanced_opts = '-max_target_seqs 1'#params['advanced']
50
-
51
- # evaluate empty sequence as nil, otherwise as fasta
52
- # sequence = sequence.empty? ? nil : to_fasta(sequence)
53
-
54
- # blastn implies blastn, not megablast; but let's not interfere if a user
55
- # specifies `task` herself
56
- if method == 'blastn' and not advanced_opts =~ /task/
57
- #advanced_opts << ' -task blastn '
58
- end
59
-
60
-
61
- # run blast and log
62
- blast = SequenceServer::Blast.new(method, sequence, databases.join(' '), advanced_opts)
63
- blast.run!
64
- puts('Ran: ' + blast.command)
65
-
66
-
67
- def format_blast_results(result, databases)
68
- formatted_result = ''
69
- @all_retrievable_ids = []
70
- string_of_used_databases = databases.join(' ')
71
- blast_database_number = 0
72
- line_number = 0
73
- started_query = false
74
- finished_database_summary = false
75
- finished_alignments = false
76
- reference_string = ''
77
- database_summary_string = ''
78
- result.each do |line|
79
- line_number += 1
80
- next if line_number <= 5 #skip the first 5 lines
81
-
82
- # Add the reference to the end, not the start, of the blast result
83
- if line_number >= 7 and line_number <= 15
84
- reference_string += line
85
- next
86
- end
87
-
88
- if !finished_database_summary and line_number > 15
89
- database_summary_string += line
90
- finished_database_summary = true if line.match(/total letters/)
91
- next
92
- end
93
-
94
- # Remove certain lines from the output
95
- skipped_lines = [/^<\/BODY>/,/^<\/HTML>/,/^<\/PRE>/]
96
- skip = false
97
- skipped_lines.each do |skippy|
98
- # $stderr.puts "`#{line}' matches #{skippy}?"
99
- if skippy.match(line)
100
- skip = true
101
- # $stderr.puts 'yes'
102
- else
103
- # $stderr.puts 'no'
104
- end
105
- end
106
- next if skip
107
-
108
- # Remove the javascript inclusion
109
- line.gsub!(/^<script src=\"blastResult.js\"><\/script>/, '')
110
-
111
- if line.match(/^>/) # If line to possibly replace
112
- # Reposition the anchor to the end of the line, so that it both still works and
113
- # doesn't interfere with the diagnostic space at the beginning of the line.
114
- #
115
- # There are two cases:
116
- #
117
- # database formatted _with_ -parse_seqids
118
- line.gsub!(/^>(.+)(<a.*><\/a>)(.*)/, '>\1\3\2')
119
- #
120
- # database formatted _without_ -parse_seqids
121
- line.gsub!(/^>(<a.*><\/a>)(.*)/, '>\2\1')
122
-
123
- # get hit coordinates -- useful for linking to genome browsers
124
- hit_length = result[line_number..-1].index{|l| l =~ />lcl|Lambda/}
125
- hit_coordinates = result[line_number, hit_length].grep(/Sbjct/).
126
- map(&:split).map{|l| [l[1], l[-1]]}.flatten.map(&:to_i).minmax
127
-
128
- # Create the hyperlink (if required)
129
- formatted_result += construct_sequence_hyperlink_line(line, databases, hit_coordinates)
130
- else
131
- # Surround each query's result in <div> tags so they can be coloured by CSS
132
- if matches = line.match(/^<b>Query=<\/b> (.*)/) # If starting a new query, then surround in new <div> tag, and finish the last one off
133
- line = "<div class=\"resultn\" id=\"#{matches[1]}\">\n<h3>Query= #{matches[1]}</h3><pre>"
134
- unless blast_database_number == 0
135
- line = "</pre></div>\n#{line}"
136
- end
137
- blast_database_number += 1
138
- elsif line.match(/^ Database: /) and !finished_alignments
139
- formatted_result += "</div>\n<pre>#{database_summary_string}\n\n"
140
- finished_alignments = true
141
- end
142
- formatted_result += line
143
- end
144
- end
145
- formatted_result << "</pre>"
146
-
147
- link_to_fasta_of_all = "/get_sequence/?id=#{@all_retrievable_ids.join(' ')}&db=#{string_of_used_databases}"
148
- # #dbs must be sep by ' '
149
- retrieval_text = @all_retrievable_ids.empty? ? '' : "<a href='#{url(link_to_fasta_of_all)}'>FASTA of #{@all_retrievable_ids.length} retrievable hit(s)</a>"
150
-
151
- "<h2>Results</h2>"+
152
- retrieval_text +
153
- "<br/><br/>" +
154
- formatted_result +
155
- "<br/>" +
156
- "<pre>#{reference_string.strip}</pre>"
157
- end
158
-
159
- def construct_sequence_hyperlink_line(line, databases, hit_coordinates)
160
- matches = line.match(/^>(.+)/)
161
- sequence_id = matches[1]
162
-
163
- link = nil
164
-
165
- # If a custom sequence hyperlink method has been defined,
166
- # use that.
167
- options = {
168
- :sequence_id => sequence_id,
169
- :databases => databases,
170
- :hit_coordinates => hit_coordinates
171
- }
172
-
173
- # First precedence: construct the whole line to be customised
174
- if self.respond_to?(:construct_custom_sequence_hyperlinking_line)
175
- settings.log.debug("Using custom hyperlinking line creator with sequence #{options.inspect}")
176
- link_line = construct_custom_sequence_hyperlinking_line(options)
177
- unless link_line.nil?
178
- return link_line
179
- end
180
- end
181
-
182
- # If we have reached here, custom construction of the
183
- # whole line either wasn't defined, or returned nil
184
- # (indicating failure)
185
- if self.respond_to?(:construct_custom_sequence_hyperlink)
186
- # settings.log.debug("Using custom hyperlink creator with sequence #{options.inspect}")
187
- link = construct_custom_sequence_hyperlink(options)
188
- else
189
- # settings.log.debug("Using standard hyperlink creator with sequence `#{options.inspect}'")
190
- link = construct_standard_sequence_hyperlink(options)
191
- end
192
-
193
- # Return the BLAST output line with the link in it
194
- if link.nil?
195
- # settings.log.debug('No link added link for: `'+ sequence_id +'\'')
196
- return line
197
- else
198
- settings.log.debug('Added link for: `'+ sequence_id +'\''+ link)
199
- return "><a href='#{url(link)}' target='_blank'>#{sequence_id}</a> \n"
200
- end
201
-
202
- end
203
-
204
- # Advanced options are specified by the user. Here they are checked for interference with SequenceServer operations.
205
- # raise ArgumentError if an error has occurred, otherwise return without value
206
- def validate_advanced_parameters(advanced_options)
207
- raise ArgumentError, "Invalid characters detected in the advanced options" unless advanced_options =~ /\A[a-z0-9\-_\. ']*\Z/i
208
- disallowed_options = %w(-out -html -outfmt -db -query)
209
- disallowed_options.each do |o|
210
- raise ArgumentError, "The advanced BLAST option \"#{o}\" is used internally by SequenceServer and so cannot be specified by the you" if advanced_options =~ /#{o}/i
211
- end
212
- end
213
-
214
- puts format_blast_results(blast.result, databases)
215
-
216
-
217
-
@@ -1,104 +0,0 @@
1
- require 'rspec'
2
- require 'watir-webdriver'
3
- require 'headless'
4
-
5
- # These shared examples should work for
6
- shared_examples_for 'a browser' do
7
- let(:seqserv_url){'http://localhost:4567'}
8
-
9
- it 'should simply go the seqserv webpage' do
10
- b.goto seqserv_url
11
- b.url.gsub(/\/$/,'').should eq(seqserv_url)
12
- b.ready_state.should eq('complete')
13
- end
14
-
15
- it 'should do a simple blastp' do
16
- b.goto seqserv_url
17
-
18
- # Nucleotide database should be available
19
- b.checkbox(:value => 'e205221dd32dc53ebfc9fb48cbdecd9e').enabled?.should eq(true)
20
-
21
- # First up the blast button should be disabled
22
- b.button(:id => 'method').text.should eq('BLAST')
23
- b.button(:id => 'method').enabled?.should eq(false)
24
-
25
- # Pick a protein blast database
26
- b.checkbox(:value => '6669b1c88665158621afc06407ce88ea').set
27
- b.checkbox(:value => '6669b1c88665158621afc06407ce88ea').checked?.should eq(true)
28
-
29
- # nuc dbs now disabled
30
- b.checkbox(:value => 'e205221dd32dc53ebfc9fb48cbdecd9e').enabled?.should eq(false)
31
-
32
- # The blast button should still be disabled
33
- b.button(:id => 'method').text.should eq('BLAST')
34
- b.button(:id => 'method').enabled?.should eq(false)
35
-
36
- # Give a sequence we know should hit
37
- b.textarea(:name => 'sequence').set 'YTLPPPPTKLYSAPISCRKNKTGHWMDDILSIKTGESCPVNNYLHSGFLA'
38
-
39
- #blast butn now active
40
- b.button(:id => 'method').text.should eq('BLASTP')
41
- b.button(:id => 'method').enabled?.should eq(true)
42
-
43
- # Run the blast
44
- b.button(:id => 'method').click
45
-
46
- while b.div(:id => 'result').text.include?('Waiting for BLAST to be run')
47
- end
48
-
49
- # blast should have worked
50
- b.div(:id => 'result').text.include?('Sequences producing significant alignments: ').should eq(true)
51
- end
52
- end
53
-
54
- #####################################################################################
55
- #+++++++++++ Below is admin code, hopefully not necessary to mess around with to test new UI specs
56
-
57
- # NOT thread-safe, at least because of the interaction with headless
58
- class BrowserAdmin
59
- def self.setup_browser(type)
60
- case type
61
- when :firefox then
62
- Watir::Browser.new :firefox
63
- when :chrome then
64
- Watir::Browser.new :chrome
65
- when :headless_firefox then
66
- @headless = Headless.new
67
- @headless.start
68
- Watir::Browser.new :firefox
69
- when :headless_chrome then
70
- @headless = Headless.new
71
- @headless.start
72
- Watir::Browser.new :chrome
73
- else
74
- raise "Unknown browser type asked for: #{type.inspect}"
75
- end
76
- end
77
-
78
- def self.teardown_browser(browser)
79
- browser.close
80
-
81
- # Re-head again, but maybe this makes no difference
82
- @headless.destroy unless @headless.nil?
83
- @headless = nil
84
- end
85
- end
86
-
87
-
88
- describe 'ui' do
89
- [:firefox, :chrome, :headless_firefox, :headless_chrome].each do |bro|
90
- context bro.to_s do
91
- it_behaves_like 'a browser' do
92
- browser = nil
93
- before do
94
- browser = BrowserAdmin.setup_browser bro
95
- end
96
- after do
97
- BrowserAdmin.teardown_browser browser
98
- end
99
- let(:b){browser}
100
- end
101
- end
102
- end
103
- end
104
-