sequenceserver 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sequenceserver might be problematic. Click here for more details.
- data/lib/blast.rb~ +200 -0
- data/lib/sequenceserver/database_formatter.rb~ +190 -0
- data/public/css/beige.css.css +254 -0
- data/public/css/beige.css~ +226 -0
- data/public/js/Scribl.min.js +53 -0
- data/public/js/sequenceserver.js~ +250 -0
- data/sequenceserver.gemspec +2 -2
- data/tests/database/nucleotide/head.fa +10 -0
- data/tests/database/nucleotide/head.faVno_parse.html +96 -0
- data/tests/database/nucleotide/head.faVparse.html +96 -0
- data/tests/database/nucleotide/headVno_parse.archive +151 -0
- data/tests/database/nucleotide/headVno_parse.archive.csv +1 -0
- data/tests/database/nucleotide/headVparse.archive +148 -0
- data/tests/database/nucleotide/headVparse.archive.csv +1 -0
- data/tests/database/nucleotide/no_parse.fa +5486 -0
- data/tests/database/nucleotide/no_parse.fa.nhr +0 -0
- data/tests/database/nucleotide/no_parse.fa.nin +0 -0
- data/tests/database/nucleotide/no_parse.fa.nsq +0 -0
- data/tests/database/nucleotide/no_parse.info +7 -0
- data/tests/database/nucleotide/parse.fa +5486 -0
- data/tests/database/nucleotide/parse.fa.nhr +0 -0
- data/tests/database/nucleotide/parse.fa.nin +0 -0
- data/tests/database/nucleotide/parse.fa.nog +0 -0
- data/tests/database/nucleotide/parse.fa.nsd +946 -0
- data/tests/database/nucleotide/parse.fa.nsi +0 -0
- data/tests/database/nucleotide/parse.fa.nsq +0 -0
- data/tests/database/nucleotide/parse.info +7 -0
- data/views/search.erb~ +164 -0
- metadata +56 -28
@@ -0,0 +1,226 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #2B3E42;
|
3
|
+
/*background: #3f4555;*/
|
4
|
+
font-family: Tahoma, Arial, sans-serif;
|
5
|
+
}
|
6
|
+
|
7
|
+
.container {
|
8
|
+
width: 800px;
|
9
|
+
margin: 50px auto;
|
10
|
+
background-color: white;
|
11
|
+
border: 2px solid white;
|
12
|
+
border-radius: 10px;
|
13
|
+
-moz-border-radius: 10px;
|
14
|
+
}
|
15
|
+
|
16
|
+
h1 {
|
17
|
+
margin: 0px;
|
18
|
+
padding: 0px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.banner {
|
22
|
+
font-weight: bold;
|
23
|
+
background: #ebcd7b;
|
24
|
+
font-size: 300%;
|
25
|
+
font-family: Tahoma, Arial, sans-serif;
|
26
|
+
color: black;
|
27
|
+
padding: 2%;
|
28
|
+
margin-bottom: 2%;
|
29
|
+
|
30
|
+
border-bottom-left-radius: 0px;
|
31
|
+
border-bottom-right-radius: 0px;
|
32
|
+
border-top-left-radius: 10px;
|
33
|
+
border-top-right-radius: 10px;
|
34
|
+
|
35
|
+
-moz-border-radius-bottomleft: 0px;
|
36
|
+
-moz-border-radius-bottomright: 0px;
|
37
|
+
-moz-border-radius-topleft: 10px;
|
38
|
+
-moz-border-radius-topright: 10px;
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
.underbar {
|
43
|
+
background-color: #ebcd7b;
|
44
|
+
font-family:arial;
|
45
|
+
font-size: 12px;
|
46
|
+
text-align: center;
|
47
|
+
color: #333333;
|
48
|
+
padding: 1px 1px 1px 1px;
|
49
|
+
margin: 2% 0 0 0;
|
50
|
+
border-bottom-left-radius: 10px;
|
51
|
+
border-bottom-right-radius: 10px;
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
.entryfield {
|
56
|
+
padding:0;
|
57
|
+
margin:0;
|
58
|
+
float:left; /* otherwise each div is under the next. */
|
59
|
+
width:82%;
|
60
|
+
}
|
61
|
+
|
62
|
+
.entryfield textarea {
|
63
|
+
padding:0;
|
64
|
+
margin:0;
|
65
|
+
width:100%;
|
66
|
+
height: 168px;
|
67
|
+
border-color:black;
|
68
|
+
}
|
69
|
+
|
70
|
+
.blastmethods {
|
71
|
+
float : right;
|
72
|
+
width : 15%;
|
73
|
+
background : #222222;
|
74
|
+
border : none;
|
75
|
+
height : 150px;
|
76
|
+
|
77
|
+
border-top-right-radius : 10px;
|
78
|
+
border-top-left-radius : 0px;
|
79
|
+
border-bottom-right-radius: 10px;
|
80
|
+
border-bottom-left-radius : 0px;
|
81
|
+
|
82
|
+
-moz-border-radius-topright: 10px;
|
83
|
+
-moz-border-radius-topleft: 0px;
|
84
|
+
-moz-border-radius-bottomright: 10px;
|
85
|
+
-moz-border-radius-bottomleft: 0px;
|
86
|
+
|
87
|
+
|
88
|
+
font-size : 1.5em;
|
89
|
+
font-family: Tahoma, Arial, sans-serif;
|
90
|
+
color: black;
|
91
|
+
margin:0;
|
92
|
+
padding:0;
|
93
|
+
}
|
94
|
+
|
95
|
+
fieldset {
|
96
|
+
margin:0;
|
97
|
+
padding:0;
|
98
|
+
}
|
99
|
+
|
100
|
+
.horizontal {
|
101
|
+
margin: 2%;
|
102
|
+
padding-bottom:15px;
|
103
|
+
padding-top:15px;
|
104
|
+
width: 96%;
|
105
|
+
clear:both;
|
106
|
+
}
|
107
|
+
|
108
|
+
.rounded {
|
109
|
+
border-radius :10px;
|
110
|
+
-moz-border-radius:10px;
|
111
|
+
}
|
112
|
+
|
113
|
+
.box {
|
114
|
+
background : #D5E1DD;
|
115
|
+
/* background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000)); */
|
116
|
+
|
117
|
+
border : none;
|
118
|
+
|
119
|
+
padding : 10px;
|
120
|
+
margin: 0;
|
121
|
+
font-family : Tahoma, Arial, sans-serif;
|
122
|
+
color : black;
|
123
|
+
}
|
124
|
+
|
125
|
+
.databases {
|
126
|
+
width :46.5%;
|
127
|
+
}
|
128
|
+
.nucleotide {
|
129
|
+
float :left;
|
130
|
+
}
|
131
|
+
.protein {
|
132
|
+
float : right;
|
133
|
+
}
|
134
|
+
|
135
|
+
.radiobutton{
|
136
|
+
margin: 9px 5px 0px 0px;
|
137
|
+
padding: 0;
|
138
|
+
vertical-align: top;
|
139
|
+
}
|
140
|
+
.dbcheckbox { /* within each "database box" */
|
141
|
+
float:left;
|
142
|
+
clear:both;
|
143
|
+
margin: 5px 10px 0 0;
|
144
|
+
padding: 0;
|
145
|
+
}
|
146
|
+
.dbdescription {
|
147
|
+
float:left;
|
148
|
+
}
|
149
|
+
|
150
|
+
.advanced {
|
151
|
+
float:left;
|
152
|
+
width: 78%;
|
153
|
+
}
|
154
|
+
|
155
|
+
.greytext {
|
156
|
+
color: #A9A9A9;
|
157
|
+
}
|
158
|
+
|
159
|
+
.pointer {
|
160
|
+
cursor:pointer;
|
161
|
+
}
|
162
|
+
|
163
|
+
.advanced pre {
|
164
|
+
display: none;
|
165
|
+
}
|
166
|
+
.advanced input {
|
167
|
+
float:right;
|
168
|
+
width: 60%;
|
169
|
+
}
|
170
|
+
|
171
|
+
.submit_button {
|
172
|
+
float:right;
|
173
|
+
width: 17.5%;
|
174
|
+
}
|
175
|
+
.submit_button input {
|
176
|
+
width: 100%;
|
177
|
+
background-color : #323292;
|
178
|
+
background: -webkit-gradient(linear, left top, right bottom, from(#0066CC), to(#192D53));
|
179
|
+
background: -moz-linear-gradient(45deg,#0066CC,#192D53);
|
180
|
+
|
181
|
+
border : 2px solid #192D53;
|
182
|
+
border-radius : 10px;
|
183
|
+
-moz-border-radius: 10px;
|
184
|
+
color : white;
|
185
|
+
padding : 2.5px 10px 2.5px 10px;
|
186
|
+
cursor : pointer;
|
187
|
+
font-size : 1.8em;
|
188
|
+
font-family : Tahoma, Arial, sans-serif;
|
189
|
+
margin: 0 0 0 0;
|
190
|
+
|
191
|
+
}
|
192
|
+
.submit_button input:active {
|
193
|
+
color: #1f2126;
|
194
|
+
|
195
|
+
}
|
196
|
+
.submit_button input:hover {
|
197
|
+
background: -webkit-gradient(linear, left top, right bottom, from(#009cff), to(#0261c2));
|
198
|
+
background: -moz-linear-gradient(45deg,#009cff,#0261c2);
|
199
|
+
|
200
|
+
}
|
201
|
+
|
202
|
+
h2, .bigtext{
|
203
|
+
font-family: Tahoma, Arial, serif;
|
204
|
+
font-weight: bold;
|
205
|
+
font-size: 20px;
|
206
|
+
color: black;
|
207
|
+
margin:0;
|
208
|
+
padding: 0px;
|
209
|
+
/* margin: 8px 0 10px 0;*/
|
210
|
+
}
|
211
|
+
|
212
|
+
.smalltext{
|
213
|
+
font-size:10px;
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
#result{
|
218
|
+
clear:both;
|
219
|
+
background-color: white;
|
220
|
+
padding-left: 5%;
|
221
|
+
margin: 0 18px 0 18px;
|
222
|
+
}
|
223
|
+
|
224
|
+
a {
|
225
|
+
color: #b22222;
|
226
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
(function(){var a=!1,b=/xyz/.test(function(){})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(c){function d(){!a&&this.init&&this.init.apply(this,arguments)}var e=this.prototype;a=!0;var g=new this;a=!1;for(var i in c)g[i]=typeof c[i]=="function"&&typeof e[i]=="function"&&b.test(c[i])?function(a,b){return function(){var c=this._super;this._super=e[a];var d=b.apply(this,arguments);this._super=c;return d}}(i,c[i]):c[i];d.prototype=g;d.constructor=d;d.extend=arguments.callee;return d}})();var Scribl=Class.extend({init:function(a,b){this.scrolled=!1;var c=a.getContext("2d");this.width=b;this.laneSizes=50;this.laneBuffer=5;this.trackBuffer=25;this.offset=void 0;this.canvas=a;this.ctx=c;this.scale={};this.scale.pretty=!0;this.scale.max=void 0;this.scale.min=void 0;this.scale.auto=!0;this.scale.off=!1;this.scale.size=15;this.scale.font={};this.scale.font.size=15;this.scale.font.color="black";this.scale.font.buffer=10;this.glyph={};this.glyph.roundness=6;this.glyph.borderWidth=1;this.glyph.color=
|
2
|
+
["#99CCFF","rgb(63, 128, 205)"];this.glyph.text={};this.glyph.text.color="black";this.glyph.text.size="13";this.glyph.text.font="arial";this.glyph.text.align="center";this.gene={};this.gene.text={};this.protein={};this.protein.text={};this.events={};this.events.hasClick=!1;this.events.hasMouseover=!1;this.events.clicks=[];this.events.mouseovers=[];this.events.added=!1;this.tick={};this.tick.auto=!0;this.tick.major={};this.tick.major.size=10;this.tick.major.color="black";this.tick.minor={};this.tick.minor.size=
|
3
|
+
1;this.tick.minor.color="rgb(55,55,55)";this.tick.halfColor="rgb(10,10,10)";this.tooltips={};this.tooltips.text={};this.tooltips.text.font="arial";this.tooltips.text.size=12;this.tooltips.borderWidth=1;this.tooltips.roundness=5;this.tooltips.fade=!1;this.tooltips.style="light";this.scrollable=!1;this.scrollValues=[0,void 0];this.drawStyle="expand";this.myMouseEventHandler=new MouseEventHandler(this);this.tracks=[]},getScaleHeight:function(){return this.scale.font.size+this.scale.size},getHeight:function(){var a=
|
4
|
+
0;this.scale.off||(a+=this.getScaleHeight());for(var b=this.tracks.length,c=0;c<b;c++)a+=this.trackBuffer,a+=this.tracks[c].getHeight();return a},addTrack:function(){var a=new Track(this.ctx);a.chart=this;if(this.tracks.length==1&&this.tracks[0]==void 0)this.tracks=[];this.tracks.push(a);return a},loadGenbank:function(a){genbank(a,this)},loadBed:function(a){bed(a,this)},loadFeatures:function(a){for(var b=0;b<a.length;b++)this.addFeature(a[b])},addGene:function(a,b,c,d){return this.addFeature(new BlockArrow("gene",
|
5
|
+
a,b,c,d))},addProtein:function(a,b,c,d){return this.addFeature(new BlockArrow("protein",a,b,c,d))},addFeature:function(a){(this.tracks[0]||this.addTrack()).addFeature(a);return a},slice:function(a,b,c){c=c||"inclusive";for(var d=this.tracks.length,e=new Scribl(this.canvas,this.width),g=0;g<d;g++){var i=this.tracks[g],k=e.addTrack();k.drawStyle=i.drawStyle;for(var j=i.lanes.length,m=0;m<j;m++){newLane=k.addLane();for(var l=i.lanes[m].features,n=0;n<l.length;n++){var o=l[n].position+l[n].length,p=l[n].position;
|
6
|
+
if(c=="inclusive")p>=a&&p<=b?newLane.addFeature(l[n]):o>a&&o<b?newLane.addFeature(l[n]):p<a&&o>b?newLane.addFeature(l[n]):p>a&&o<b&&newLane.addFeature(l[n]);else if(c=="strict")if(p>=a&&p<=b)if(o>a&&o<b)newLane.addFeature(l[n]);else{var q=l[n].clone();q.length=Math.abs(b-p);newLane.addFeature(q)}else if(o>a&&o<b)q=l[n].clone(),q.position=a,q.length=Math.abs(o-a),newLane.addFeature(q);else{if(p<a&&o>b)q=l[n].clone(),q.position=a,q.length=Math.abs(b-a),newLane.addFeature(q)}else c=="exclusive"&&p>=
|
7
|
+
a&&p<=b&&o>a&&o<b&&newLane.addFeature(l[n])}}}e.laneSizes=this.laneSizes;e.drawStyle=this.drawStyle;e.loadFeatures([]);return e},draw:function(){var a=this.ctx,b=this.tracks;this.scrollable==!0&&this.initScrollable();a.save();if(this.scale.pretty){if(this.tick.auto)this.tick.major.size=this.determineMajorTick(),this.tick.minor.size=Math.round(this.tick.major.size/10);if(this.scale.auto)this.scale.min-=this.scale.min%this.tick.major.size,this.scale.max=Math.round(this.scale.max/this.tick.major.size+
|
8
|
+
0.4)*this.tick.major.size}this.offset=this.scale.min.offset?a.measureText(this.getTickText(this.scale.min)).width/2+10:a.measureText("0").width/2+10;a.save();if(!this.scale.off){var c=a.fillStyle;this.drawScale();a.fillStyle=c}a.save();this.scale.off||a.translate(0,this.getScaleHeight()+this.laneBuffer);for(c=0;c<b.length;c++)b[c].draw();a.restore();a.restore();a.restore();this.events.added||this.registerEventListeners()},redraw:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
|
9
|
+
this.tracks.length>0&&this.draw()},drawScale:function(){var a=this.ctx,b=this.scale.font.size+this.scale.size,c=this.scale.font.size+2,d=this.scale.font.size+this.scale.size*0.66,e=this.scale.font.size+this.scale.size*0.33;a.font=this.scale.font.size+"px arial";a.textBaseline="top";a.fillStyle=this.scale.font.color;for(var g=this.scale.min%this.tick.minor.size==0?this.scale.min:this.scale.min-this.scale.min%this.tick.minor.size+this.tick.minor.size;g<=this.scale.max;g+=this.tick.minor.size){a.beginPath();
|
10
|
+
var i=this.pixelsToNts(g-this.scale.min)+this.offset;if(g%this.tick.major.size==0){var k=this.getTickText(g);a.textAlign="center";a.fillText(k,i,0);a.moveTo(i,b);a.lineTo(i,c);a.strokeStyle=this.tick.major.color}else a.moveTo(i,b),g%(this.tick.major.size/2)==0?(a.strokeStyle=this.tick.halfColor,a.lineTo(i,e)):(a.strokeStyle=this.tick.minor.color,a.lineTo(i,d));a.stroke()}},pixelsToNts:function(a){return a==void 0?this.width/(this.scale.max-this.scale.min):this.width/(this.scale.max-this.scale.min)*
|
11
|
+
a},ntsToPixels:function(a){return a==void 0?1/this.pixelsToNts():a/this.width},initScrollable:function(){var a;if(!this.scrolled){a=document.createElement("div");var b=document.createElement("div"),c=document.createElement("div");c.id="scribl-zoom-slider";c.className="slider";c.style.cssFloat="left";c.style.height=new String(this.canvas.height*0.5)+"px";c.style.margin="30px auto auto -20px";a.style.cssText=this.canvas.style.cssText;this.canvas.style.cssText="";parentWidth=parseInt(this.canvas.width)+
|
12
|
+
25;a.style.width=parentWidth+"px";b.style.width=this.canvas.width+"px";b.style.overflow="auto";b.id="scroll-wrapper";this.canvas.parentNode.replaceChild(a,this.canvas);a.appendChild(c);b.appendChild(this.canvas);a.appendChild(b);$(b).dragscrollable({dragSelector:"canvas:first",acceptPropagatedEvent:!1})}b=this.scale.max-this.scale.min;var d=this.scrollValues[1]||this.scale.max-b*0.35;a=this.scrollValues[0]!=void 0?this.scrollValues[0]:this.scale.max+b*0.35;var e=(d-a)/document.getElementById("scroll-wrapper").style.width.split("px")[0];
|
13
|
+
e=b/e;this.canvas.width=e;this.width=e-30;schart=this;d=(d-a)/(this.scale.max-this.scale.min)*100;$(c).slider({orientation:"vertical",range:"min",min:1,max:100,value:d,slide:function(a,b){var c=schart.scale.max-schart.scale.min,d=b.value/100*schart.canvas.width,e=document.getElementById("scroll-wrapper");e=e.scrollLeft+parseInt(e.style.width.split("px")[0])/2;schart.scrollValues=[(e-d/2)/schart.canvas.width*c,(e+d/2)/schart.canvas.width*c];schart.ctx.clearRect(0,0,schart.canvas.width,schart.canvas.height);
|
14
|
+
schart.draw()}});c=(a-this.scale.min)/b*this.canvas.width;document.getElementById("scroll-wrapper").scrollLeft=c;this.scrolled=!0},determineMajorTick:function(){this.ctx.font=this.scale.font.size+"px arial";var a=(this.scale.max-this.scale.min)/(this.width/(this.ctx.measureText(this.getTickTextDecimalPlaces(this.scale.max)).width+this.scale.font.buffer)),b=Math.pow(10,parseInt(a).toString().length-1);this.tick.major.size=Math.ceil(a/b)*b;a=Math.pow(10,(this.tick.major.size+"").length);b=this.tick.major.size/
|
15
|
+
a;b>0.1&&b<=0.5?b=0.5:b>0.5&&(b=1);return b*a},getTickText:function(a){if(!this.tick.auto)return a;var b=a;a>=1E6?(a=Math.pow(10,5),b=Math.round(b/1E6*a)/a+"m"):a>=1E3&&(a=Math.pow(10,2),b=Math.round(b/1E3*a)/a+"k");return b},getTickTextDecimalPlaces:function(a){if(!this.tick.auto)return a;var b=a;a>=1E6?b=Math.round(b/(1E6/Math.pow(10,5)))+"m":a>=1E3&&(b=Math.round(b/(1E3/Math.pow(10,2)))+"k");return b},handleMouseEvent:function(a,b){this.myMouseEventHandler.setMousePosition(a);for(var c=this.myMouseEventHandler.mouseY,
|
16
|
+
d,e=0;e<this.tracks.length;e++)for(var g=0;g<this.tracks[e].lanes.length;g++){var i=this.tracks[e].lanes[g].getPixelPositionY(),k=i+this.tracks[e].lanes[g].getHeight();if(c>=i&&c<=k){d=this.tracks[e].lanes[g];break}}if(d){this.ctx.save();d.erase();this.ctx.translate(0,d.getPixelPositionY());d.draw();(e=this.LastToolTip)&&this.ctx.putImageData(e.pixels,e.x,e.y);this.ctx.restore();c=b=="click"?this.events.clicks:this.events.mouseovers;for(e=0;e<c.length;e++)c[e](this);this.myMouseEventHandler.reset(this)}},
|
17
|
+
addClickEventListener:function(a){this.events.clicks.push(a)},addMouseoverEventListener:function(a){this.events.mouseovers.push(a)},registerEventListeners:function(){var a=this;this.events.mouseovers.length>0&&this.canvas.addEventListener("mousemove",function(b){a.handleMouseEvent(b,"mouseover")},!1);this.events.clicks.length>0&&this.canvas.addEventListener("click",function(b){a.handleMouseEvent(b,"click")},!1);this.events.added=!0}});var Track=Class.extend({init:function(a){this.lanes=[];this.ctx=a;this.uid=_uniqueId("track");this.drawStyle=void 0;this.coverageData=[];this.maxDepth=0},addLane:function(){var a=new Lane(this.ctx,this);this.lanes.push(a);return a},addGene:function(a,b,c,d){return this.addFeature(new BlockArrow("gene",a,b,c,d))},addProtein:function(a,b,c,d){return this.addFeature(new BlockArrow("protein",a,b,c,d))},addFeature:function(a){for(var b,c=!0,d=0;d<this.lanes.length;d++){var e=this.lanes[d].features[this.lanes[d].features.length-
|
18
|
+
1];if(e!=void 0&&a.position-3/this.chart.pixelsToNts()>e.position+e.length){c=!1;b=this.lanes[d];break}}c&&(b=this.addLane());b.addFeature(a);return a},getDrawStyle:function(){return this.drawStyle?this.drawStyle:this.chart.drawStyle},getHeight:function(){var a=0,b=this.lanes.length,c=this.chart.laneBuffer,d=this.getDrawStyle();if(d=="line"||d=="collapse")b=1;for(d=0;d<b;d++)a+=c,a+=this.lanes[d].getHeight();a-=c;return a},getPixelPositionY:function(){for(var a=this.chart.getScaleHeight()+this.chart.laneBuffer,
|
19
|
+
b=0;b<this.chart.tracks.length;b++){if(this.uid==this.chart.tracks[b].uid)break;a+=this.chart.trackBuffer;a+=this.chart.tracks[b].getHeight()}return a},calcCoverageData:function(){for(var a=this.lanes,b=0;b<a.length;b++)for(var c=0;c<a[b].features.length;c++){var d=a[b].features[c],e=Math.round(d.getPixelPositionX());for(d=Math.round(e+d.getPixelLength());e<=d;e++)this.coverageData[e]=this.coverageData[e]+1||1,this.maxDepth=Math.max(this.coverageData[e],this.maxDepth)}},erase:function(){this.chart.ctx.clearRect(0,
|
20
|
+
this.getPixelPositionY(),this.chart.width,this.getHeight())},draw:function(){var a=this.getDrawStyle(),b=this.chart.laneSizes,c=this.lanes,d=this.chart.laneBuffer,e=this.chart.trackBuffer,g=b+e,i=this.ctx;if(a==void 0||a=="expand")for(a=0;a<c.length;a++)c[a].y=g,c[a].draw(),b=c[a].getHeight(),i.translate(0,b+d),g=g+b+d;else if(a=="collapse"){b=[];for(a=0;a<c.length;a++)b=b.concat(c[a].features);b.sort(function(a,b){return a.position-b.position});for(g=0;g<b.length;g++){a=b[g].length;var k=b[g].name,
|
21
|
+
j=void 0;for(j=g+1;j<b.length;j++)if(b[g].getEnd()>=b[j].position)b[g].length=Math.max(b[g].getEnd(),b[j].getEnd())-b[g].position,b[g].name="";else break;b[g].draw();b[g].length=a;b[g].name=k;g=j-1}i.translate(0,c[0].getHeight()+d)}else if(a=="line"){this.coverageData.length==0&&this.calcCoverageData();g=this.maxDepth;i.beginPath();for(a=this.chart.offset;a<=this.chart.width+this.chart.offset;a++)k=this.coverageData[a]/g*b||0,k=b-k,i.lineTo(a,k);i.lineTo(this.chart.width+this.chart.offset,b);i.stroke();
|
22
|
+
i.translate(0,c[0].getHeight()+d)}i.translate(0,e-d)}});var Lane=Class.extend({init:function(a,b){this.height=void 0;this.features=[];this.ctx=a;this.track=b;this.chart=b.chart;this.uid=_uniqueId("lane")},addGene:function(a,b,c,d){return this.addFeature(new BlockArrow("gene",a,b,c,d))},addProtein:function(a,b,c,d){return this.addFeature(new BlockArrow("protein",a,b,c,d))},addFeature:function(a){a.lane=this;this.features.push(a);this.chart[a.type]||(this.chart[a.type]={text:{}});if(a.length+a.position>this.chart.scale.max||this.chart.scale.max==void 0)this.chart.scale.max=
|
23
|
+
a.length+a.position;if(a.position<this.chart.scale.min||this.chart.scale.min==void 0)this.chart.scale.min=a.position;return a},loadFeatures:function(a){for(var b=a.length,c=0;c<b;c++)this.addFeature(a[c])},getHeight:function(){return this.height!=void 0?this.height:this.chart.laneSizes},getPixelPositionY:function(){for(var a=this.track.getPixelPositionY(),b=this.getHeight(),c=0;c<this.track.lanes.length;c++){if(this.uid==this.track.lanes[c].uid)break;a+=this.track.chart.laneBuffer;a+=b}return a},
|
24
|
+
erase:function(){this.chart.ctx.clearRect(0,this.getPixelPositionY(),this.track.chart.width,this.getHeight())},draw:function(){for(var a=0;a<this.features.length;a++)this.features[a].draw()}});var tooltips=Class.extend({init:function(a){this.chart=a;this.ctx=a.ctx},fire:function(a){var b=this.ctx.globalAlpha;this.chart.tooltips.fade?h=1:this.draw(a,1);this.ctx.globalAlpha=b},draw:function(a,b){this.ctx.globalAlpha=b;var c=this.chart.tooltips.roundness,d=this.chart.tooltips.text.font,e=this.chart.tooltips.text.size;this.ctx.save();this.ctx.font=e+"px "+d;d=this.ctx.measureText(a.onMouseover);var g=[a.onMouseover],i=e+10,k=d.width+10,j=i-4,m,l;d=a.getPixelPositionX()+10;j=a.getPixelPositionY()-
|
25
|
+
j;a.getPixelLength();if(k>200)g=this.ctx.measureText("s").width,g=parseInt(200/g),g=ScriblWrapLines(g,a.onMouseover),k=210,i=g[1]*e+10,g=g[0];k+d>this.chart.width&&(d=this.chart.width-k);if(this.chart.tooltips.style=="light")m=this.chart.ctx.createLinearGradient(d+k/2,j,d+k/2,j+i),m.addColorStop(0,"rgb(253, 248, 196)"),m.addColorStop(0.75,"rgb(253, 248, 196)"),m.addColorStop(1,"white"),l=this.chart.ctx.createLinearGradient(d+k/2,j,d+k/2,j+i),l.addColorStop(0,"black"),l.addColorStop(1,"rgb(64, 64, 64)"),
|
26
|
+
this.chart.tooltips.text.color="black";else if(this.chart.tooltips.style=="dark")m=this.chart.ctx.createLinearGradient(d+k/2,j,d+k/2,j+i),m.addColorStop(0,"rgb(64, 64, 64)"),m.addColorStop(1,"rgb(121, 121, 121)"),l="white",this.chart.tooltips.text.color="white";this.chart.LastToolTip={pixels:this.ctx.getImageData(d-1,j-1,k+2,i+2),x:d-1,y:j-1};this.ctx.fillStyle=m;this.ctx.beginPath();tlc_ctrl_x=d;tlc_ctrl_y=j;tlc_lgth_x=d+c;tlc_lgth_y=j;tlc_wdth_x=d;tlc_wdth_y=j+c;blc_ctrl_x=d;blc_ctrl_y=j+i;blc_lgth_x=
|
27
|
+
d+c;blc_lgth_y=j+i;blc_wdth_x=d;blc_wdth_y=j+i-c;brc_ctrl_x=d+k;brc_ctrl_y=j+i;brc_lgth_x=d+k-c;brc_lgth_y=j+i;brc_wdth_x=d+k;brc_wdth_y=j+i-c;trc_ctrl_x=d+k;trc_ctrl_y=j;trc_lgth_x=d+k-c;trc_lgth_y=j;trc_wdth_x=d+k;trc_wdth_y=j+c;this.ctx.moveTo(tlc_lgth_x,tlc_lgth_y);this.ctx.quadraticCurveTo(tlc_ctrl_x,tlc_ctrl_y,tlc_wdth_x,tlc_wdth_y);this.ctx.lineTo(blc_wdth_x,blc_wdth_y);this.ctx.quadraticCurveTo(blc_ctrl_x,blc_ctrl_y,blc_lgth_x,blc_lgth_y);this.ctx.lineTo(brc_lgth_x,brc_lgth_y);this.ctx.quadraticCurveTo(brc_ctrl_x,
|
28
|
+
brc_ctrl_y,brc_wdth_x,brc_wdth_y);this.ctx.lineTo(trc_wdth_x,trc_wdth_y);this.ctx.quadraticCurveTo(trc_ctrl_x,trc_ctrl_y,trc_lgth_x,trc_lgth_y);this.ctx.lineTo(tlc_lgth_x,tlc_lgth_y);this.ctx.fill();this.ctx.lineWidth=this.chart.tooltips.borderWidth;this.ctx.strokeStyle=l;this.ctx.stroke();this.ctx.textBaseline="middle";this.ctx.fillStyle=this.chart.tooltips.text.color;for(c=0;c<g.length;c++)this.ctx.measureText(g[c]),this.ctx.fillText(g[c],d+5,j+e*(c+1));this.ctx.restore()}});var MouseEventHandler=Class.extend({init:function(a){this.chart=a;this.mouseY=this.mouseX=null;this.eventElement=void 0;this.isEventDetected=!1;this.tooltip=new tooltips(this.chart)},addEvents:function(a){var b=this.chart,c=b.ctx,d=b.myMouseEventHandler;if(a.onMouseover&&!b.events.hasMouseover)b.addMouseoverEventListener(b.myMouseEventHandler.handleMouseover),b.events.hasMouseover=!0;else if(a.parent&&a.parent.onMouseover&&!b.events.hasMouseover)b.addMouseoverEventListener(b.myMouseEventHandler.handleMouseover),
|
29
|
+
b.events.hasMouseover=!0;if(a.onClick&&!b.events.hasClick)b.addClickEventListener(b.myMouseEventHandler.handleClick),b.addMouseoverEventListener(b.myMouseEventHandler.handleMouseStyle),b.events.hasClick=!0;else if(a.parent&&a.parent.onClick&&!b.events.hasClick)b.addClickEventListener(b.myMouseEventHandler.handleClick),b.addMouseoverEventListener(b.myMouseEventHandler.handleMouseStyle),b.events.hasClick=!0;if(!d.isEventDetected&&c.isPointInPath_mozilla(d.mouseX,d.mouseY))d.eventElement=a,d.isEventDetected=
|
30
|
+
!0},setMousePosition:function(a){if(a!=null){var b=this.chart.canvas.getBoundingClientRect();this.mouseX=a.clientX-b.left;this.mouseY=a.clientY-b.top}},handleClick:function(a){a=a.myMouseEventHandler.eventElement;var b;if(a!=void 0&&a.onClick!=void 0)b=a.onClick;else if(a&&a.parent&&a.parent.onClick)b=a.parent.onClick;b&&(typeof b=="string"?window.open(b):typeof b=="function"&&b(a))},setMousePosition:function(a){if(a!=null){var b=this.chart.canvas.getBoundingClientRect();this.mouseX=a.clientX-b.left;
|
31
|
+
this.mouseY=a.clientY-b.top}},handleClick:function(a){a=a.myMouseEventHandler.eventElement;var b;if(a!=void 0&&a.onClick!=void 0)b=a.onClick;else if(a&&a.parent&&a.parent.onClick)b=a.parent.onClick;b&&(typeof b=="string"?window.open(b):typeof b=="function"&&b(a))},handleMouseover:function(a){a=a.myMouseEventHandler;var b=a.eventElement;if(b!=void 0&&b.onMouseover!=void 0)a.tooltip.fire(b);else if(b&&b.parent&&b.parent.onMouseover)b.onMouseover=b.parent.onMouseover,a.tooltip.fire(b)},handleMouseStyle:function(a){var b=
|
32
|
+
a.myMouseEventHandler.eventElement;a.ctx.canvas.style.cursor=b&&b.onClick!=void 0?"pointer":b&&b.parent&&b.parent.onClick!=void 0?"pointer":"auto"},reset:function(a){a=a.myMouseEventHandler;a.mouseX=null;a.mouseY=null;a.eventElement=void 0;a.isEventDetected=null;a.elementIndexCounter=0}});
|
33
|
+
CanvasRenderingContext2D.prototype.isPointInPath_mozilla=function(a,b){if(navigator.userAgent.indexOf("Firefox")!=-1){this.save();this.setTransform(1,0,0,1,0,0);var c=this.isPointInPath(a,b);this.restore()}else c=this.isPointInPath(a,b);return c};function ScriblWrapLines(a,b){for(var c=[],d="",e=0,g=(""+b).split(" "),i=0;i<g.length;i++)g[i].length+d.length<=a?d+=" "+g[i]:d==""?(trunc1=g[i].slice(0,a-1),d+=" "+trunc1+"-",trunc2=g[i].slice(a,g[i].length),g.splice(i+1,0,trunc2),c.push(d),d="",e++):(i--,c.push(d),e++,d="");e++;c.push(d);return[c,e]}var idCounter=0;_uniqueId=function(a){var b=idCounter++;return a?a+b:b};var CanvasToSVG={idCounter:0,convert:function(a,b,c,d){var e=a.toDataURL(),g=document.createElementNS("http://www.w3.org/2000/svg","image");g.setAttribute("id","importedCanvas_"+this.idCounter++);g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e);g.setAttribute("x",c?c:0);g.setAttribute("y",d?d:0);g.setAttribute("width",a.width);g.setAttribute("height",a.height);g.imageData=a.toDataURL();b.appendChild(g)}},toXml=function(a){return $("<p/>").text(a).html()},svgToString=function(a){for(;removeUnusedDefElems()>
|
34
|
+
0;);pathActions.clear(!0);$.each(a.childNodes,function(b,c){b&&c.nodeType==8&&c.data.indexOf("Created with")>=0&&a.insertBefore(c,a.firstChild)});current_group&&(leaveContext(),selectOnly([current_group]));var b=[];$(a).find("g:data(gsvg)").each(function(){for(var a=this.attributes,c=a.length,g=0;g<c;g++)(a[g].nodeName=="id"||a[g].nodeName=="style")&&c--;if(c<=0)a=this.firstChild,b.push(a),$(this).replaceWith(a)});var c=svgToString(a,0);b.length&&$(b).each(function(){groupSvgElem(this)});return c};
|
35
|
+
svgToString=function(a,b){var c=[];if(a){var d=a.attributes,e,g,i=a.childNodes;for(g=0;g<b;g++)c.push(" ");c.push("<");c.push(a.nodeName);if(a.id=="svgcontent"){g=getResolution();c.push(' width="'+g.w+'" height="'+g.h+'" xmlns="'+svgns+'"');var k={};$(a).find("*").andSelf().each(function(){$.each(this.attributes,function(a,b){var d=b.namespaceURI;d&&!k[d]&&nsMap[d]!=="xmlns"&&nsMap[d]!=="xml"&&(k[d]=!0,c.push(" xmlns:"+nsMap[d]+'="'+d+'"'))})});for(g=d.length;g--;){e=d.item(g);var j=toXml(e.nodeValue);
|
36
|
+
if(e.nodeName.indexOf("xmlns:")!==0&&j!=""&&["width","height","xmlns","x","y","viewBox","id","overflow"].indexOf(e.localName)==-1&&(!e.namespaceURI||nsMap[e.namespaceURI]))c.push(" "),c.push(e.nodeName),c.push('="'),c.push(j),c.push('"')}}else for(g=d.length-1;g>=0;g--)e=d.item(g),j=toXml(e.nodeValue),!(["-moz-math-font-style","_moz-math-font-style"].indexOf(e.localName)>=0)&&j!=""&&j.indexOf("pointer-events")!==0&&!(e.localName==="class"&&j.indexOf("se_")===0)&&(c.push(" "),e.localName==="d"&&(j=
|
37
|
+
pathActions.convertPath(a,!0)),c.push(e.nodeName),c.push('="'),c.push(j),c.push('"'));if(a.hasChildNodes()){c.push(">");b++;d=!1;for(g=0;g<i.length;g++)switch(e=i.item(g),e.nodeType){case 1:c.push("\n");c.push(svgToString(i.item(g),b));break;case 3:e=e.nodeValue.replace(/^\s+|\s+$/g,"");e!=""&&(d=!0,c.push(toXml(e)+""));break;case 8:c.push("\n"),c.push(Array(b+1).join(" ")),c.push("<\!--"),c.push(e.data),c.push("--\>")}b--;if(!d){c.push("\n");for(g=0;g<b;g++)c.push(" ")}c.push("</");c.push(a.nodeName);
|
38
|
+
c.push(">")}else c.push("/>")}return c.join("")};var Glyph=Class.extend({init:function(a,b,c,d,e){this.uid=_uniqueId("feature");this.position=b;this.length=c;this.strand=d;this.type=a;this.name="";this.borderColor="none";this.borderWidth=void 0;this.text={};this.text.font=void 0;this.text.size=void 0;this.text.color=void 0;this.onMouseover=this.onClick=this.text.align=void 0;for(var g in e)this[g]=e[g]},setColorGradient:function(){if(arguments.length==1)this.color=arguments[0];else{for(var a=this.lane.ctx.createLinearGradient(this.length/2,0,this.length/
|
39
|
+
2,this.getHeight()),b,c=0;b=arguments[c],c<arguments.length;c++)a.addColorStop(c/(arguments.length-1),b);this.color=a}},getPixelLength:function(){return this.lane.chart.pixelsToNts(this.length)||1},getPixelPositionX:function(){var a=parseInt(this.lane.track.chart.offset)||0;return this.lane.chart.pixelsToNts(this.parent?this.position+this.parent.position-this.lane.track.chart.scale.min:this.position-this.lane.track.chart.scale.min)+a},getPixelPositionY:function(){return this.lane.getPixelPositionY()},
|
40
|
+
getEnd:function(){return this.position+this.length},clone:function(){var a=this;return a=f.orientation?eval("new"+f.glyphType+"("+f.type+","+f.position+","+f.length+","+f.orientation):eval("new"+f.glyphType+"("+f.type+","+f.position+","+f.length)},getAttr:function(a){a=a.split("-");for(var b=this,c=0;c<a.length;c++)b=b[a[c]];if(b)return b;if(this.parent){b=this.parent;for(c=0;c<a.length;c++)b=b[a[c]];if(b)return b}if(b=this.lane.chart[this.type]){for(c=0;c<a.length;c++)b=b[a[c]];if(b)return b}b=this.lane.chart.glyph;
|
41
|
+
for(c=0;c<a.length;c++)b=b[a[c]];if(b)return b},drawText:function(a){var b=this.lane.chart.ctx,c=this.getPixelLength(),d=this.getHeight(),e=this.getAttr("text-size"),g=this.getAttr("text-style");b.font=e+"px "+g;b.textBaseline="middle";b.fillStyle=this.getAttr("text-color");var i=void 0,k=this.getAttr("text-align");k=="start"?k=this.strand=="+"?"left":"right":k=="end"&&(k=this.strand=="+"?"right":"left");b.textAlign=k;k=="left"?i=5:k=="center"?i=c/2:k=="right"&&(i=c-5);var j=b.measureText(a);if(a&&
|
42
|
+
a!=""){for(;c-j.width<4;)if(e=/^\d+/.exec(b.font),e--,j=b.measureText(a),b.font=e+"px "+g,e<=8){a="";break}this.glyphType=="Complex"&&(c=0,e=/^\d+/.exec(b.font),k=="center"&&(c=-(b.measureText(a).width/2+2.5)),b.clearRect(i+c,d/2-e/2,b.measureText(a).width+5,e));b.fillText(a,i,d/2)}},calcRoundness:function(){return this.getHeight()*this.getAttr("roundness")/100},isContainedWithinRect:function(a,b,c,d){var e=this.getPixelPositionY(),g=this.getPixelPositionX(),i=this.getPixelPositionX()+this.getPixelLength(),
|
43
|
+
k=e+this.getHeight();return g>=a&&i<=c&&e>=b&&k<=d},getHeight:function(){return this.lane.getHeight()},getFillStyle:function(){var a=this.getAttr("color");if(a instanceof Array){for(var b=this.lane.ctx.createLinearGradient(this.length/2,0,this.length/2,this.getHeight()),c,d=0;c=a[d],d<a.length;d++)b.addColorStop(d/(a.length-1),c);return b}else return a},getStrokeStyle:function(){var a=this.getAttr("borderColor");if(typeof a=="object"){for(var b=this.lane.ctx.createLinearGradient(this.length/2,0,this.length/
|
44
|
+
2,this.getHeight()),c,d=0;c=a[d],d<a.length;d++)b.addColorStop(d/(a.length-1),c);return b}else return a},isSubFeature:function(){return this.parent!=void 0},erase:function(){this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(this.getPixelPositionX(),this.getPixelPositionY(),this.getPixelLength(),this.getHeight());this.ctx.restore()},draw:function(){this.ctx=this.lane.chart.ctx;this.ctx.beginPath();/^\d+/.exec(this.ctx.font);var a=/\S+$/.exec(this.ctx.font);this.onClick=this.getAttr("onClick");
|
45
|
+
this.onMouseover=this.getAttr("onMouseover");this.ctx.fillStyle=this.getFillStyle();var b=this.ctx.fillStyle,c=this.getPixelPositionX(),d=this.getHeight();d<10?this.ctx.font="10px "+a:this.ctx.font=d*0.9+"px "+a;this.ctx.translate(c,0);this.strand=="-"&&!this.isSubFeature()&&this.ctx.transform(-1,0,0,1,this.getPixelLength(),0);this._draw();if(this.borderColor!="none")this.color=="none"&&this.parent.glyphType=="Complex"&&this.erase(),a=this.ctx.strokeStyle,d=this.ctx.lineWidth,this.ctx.strokeStyle=
|
46
|
+
this.getStrokeStyle(),this.ctx.lineWidth=this.getAttr("borderWidth"),this.ctx.stroke(),this.ctx.strokeStyle=a,this.ctx.lineWidth=d;this.color!="none"&&this.ctx.fill();this.strand=="-"&&!this.isSubFeature()&&this.ctx.transform(-1,0,0,1,this.getPixelLength(),0);this.drawText(this.getAttr("name"));this.ctx.translate(-c,0);this.ctx.fillStyle=b;this.lane.chart.myMouseEventHandler.addEvents(this)}});var BlockArrow=Glyph.extend({init:function(a,b,c,d,e){this._super(a,b,c,d,e);this.slope=1;this.glyphType="BlockArrow"},_draw:function(a,b,c,d){a=a||this.ctx;b=b||this.getPixelLength();c=c||this.getHeight();d=d+1||this.calcRoundness();d!=void 0&&(d-=1);tc_ctrl_y=tc_ctrl_x=x=y=0;tc_lgth_x=x+d;tc_lgth_y=y;tc_wdth_x=x;tc_wdth_y=y+d;bc_ctrl_x=x;bc_ctrl_y=y+c;bc_lgth_x=x+d;bc_lgth_y=y+c;bc_wdth_x=x;bc_wdth_y=y+c-d;a_b_x=x+b-d;a_t_x=x+b-d;a_max_x=x+b;t=0.5;a_ctrl_x=(a_max_x-(1-t)*(1-t)*a_b_x-t*t*a_t_x)/
|
47
|
+
(2*(1-t)*t);a_ctrl_y=y+c/2;bs_slope=this.slope;bs_intercept=-a_ctrl_y-bs_slope*a_ctrl_x;ts_slope=-this.slope;ts_intercept=-a_ctrl_y-ts_slope*a_ctrl_x;a_b_y=-(bs_slope*a_b_x+bs_intercept);a_t_y=-(ts_slope*a_t_x+ts_intercept);bs_ctrl_y=y+c;bs_ctrl_x=(-bs_ctrl_y-bs_intercept)/this.slope;bs_ctrl_x<x?(new Rect(this.type,0,b))._draw(a,b,c,d):(bs_lgth_y=y+c,bs_lgth_x=bs_ctrl_x-d,bs_slpe_x=bs_ctrl_x+d,bs_slpe_y=-(bs_slope*bs_slpe_x+bs_intercept),ts_ctrl_y=y,ts_ctrl_x=(ts_ctrl_y+ts_intercept)/this.slope,ts_lgth_y=
|
48
|
+
y,ts_lgth_x=ts_ctrl_x-d,ts_slpe_x=ts_ctrl_x+d,ts_slpe_y=-(ts_slope*ts_slpe_x+ts_intercept),a.beginPath(),a.moveTo(tc_lgth_x,tc_lgth_y),a.quadraticCurveTo(tc_ctrl_x,tc_ctrl_y,tc_wdth_x,tc_wdth_y),a.lineTo(bc_wdth_x,bc_wdth_y),a.quadraticCurveTo(bc_ctrl_x,bc_ctrl_y,bc_lgth_x,bc_lgth_y),a.lineTo(bs_lgth_x,bs_lgth_y),a.quadraticCurveTo(bs_ctrl_x,bs_ctrl_y,bs_slpe_x,bs_slpe_y),a.lineTo(a_b_x,a_b_y),a.quadraticCurveTo(a_ctrl_x,a_ctrl_y,a_t_x,a_t_y),a.lineTo(ts_slpe_x,ts_slpe_y),a.quadraticCurveTo(ts_ctrl_x,
|
49
|
+
ts_ctrl_y,ts_lgth_x,ts_lgth_y),a.lineTo(tc_lgth_x,tc_lgth_y))}});var Rect=Glyph.extend({init:function(a,b,c,d){this._super(a,b,c,"+",d);this.glyphType="Rect"},_draw:function(a,b,c,d){a=a||this.ctx;b=b||this.getPixelLength();c=c||this.getHeight();d=d+1||this.calcRoundness();d!=void 0&&(d-=1);x=y=0;a.beginPath();tlc_ctrl_x=x;tlc_ctrl_y=y;tlc_lgth_x=x+d;tlc_lgth_y=y;tlc_wdth_x=x;tlc_wdth_y=y+d;blc_ctrl_x=x;blc_ctrl_y=y+c;blc_lgth_x=x+d;blc_lgth_y=y+c;blc_wdth_x=x;blc_wdth_y=y+c-d;brc_ctrl_x=x+b;brc_ctrl_y=y+c;brc_lgth_x=x+b-d;brc_lgth_y=y+c;brc_wdth_x=x+b;brc_wdth_y=
|
50
|
+
y+c-d;trc_ctrl_x=x+b;trc_ctrl_y=y;trc_lgth_x=x+b-d;trc_lgth_y=y;trc_wdth_x=x+b;trc_wdth_y=y+d;a.moveTo(tlc_lgth_x,tlc_lgth_y);a.quadraticCurveTo(tlc_ctrl_x,tlc_ctrl_y,tlc_wdth_x,tlc_wdth_y);a.lineTo(blc_wdth_x,blc_wdth_y);a.quadraticCurveTo(blc_ctrl_x,blc_ctrl_y,blc_lgth_x,blc_lgth_y);a.lineTo(brc_lgth_x,brc_lgth_y);a.quadraticCurveTo(brc_ctrl_x,brc_ctrl_y,brc_wdth_x,brc_wdth_y);a.lineTo(trc_wdth_x,trc_wdth_y);a.quadraticCurveTo(trc_ctrl_x,trc_ctrl_y,trc_lgth_x,trc_lgth_y);a.lineTo(tlc_lgth_x,tlc_lgth_y)}});var Line=Glyph.extend({init:function(a,b,c,d){this.thickness=2;this._super(a,b,c,"+",d);this.glyphType="Line"},_draw:function(a,b,c){a=a||this.ctx;b=b||this.getPixelLength();c=c||this.getHeight();x=y=0;a.beginPath();a.moveTo(x,c/2-this.thickness/2);a.lineTo(x,c/2+this.thickness/2);a.lineTo(x+b,c/2+this.thickness/2);a.lineTo(x+b,c/2-this.thickness/2)}});var Complex=Glyph.extend({init:function(a,b,c,d,e,g){this._super(a,b,c,d,g);this.slope=1;this.glyphType="Complex";this.subFeatures=e;this.line=new Line(a,0,c);this.line.parent=this;this.line.color="black";this.line.thickness=2},addSubFeature:function(a){this.subFeatures.push(a)},_draw:function(a,b,c,d){a=a||this.ctx;b||this.getPixelLength();c||this.getHeight();d+1||this.calcRoundness();x=y=0;a.translate(-this.getPixelPositionX(),0);this.line.lane=this.lane;this.line.draw();b=this.subFeatures.length;
|
51
|
+
for(c=0;c<b;c++)this.subFeatures[c].parent=this,this.subFeatures[c].lane=this.lane,this.subFeatures[c].draw();a.translate(this.getPixelPositionX(),0);a.beginPath()}});var Arrow=Glyph.extend({init:function(a,b,c,d){this._super(a,b,0,c,d);this.slope=1;this.glyphType="Arrow";this.thickness=4.6},getPixelThickness:function(){return this.thickness/10*(this.getHeight()/2/Math.tan(Math.atan(this.slope)))},erase:function(){var a=this.getPixelThickness();this.ctx.clearRect(-a,0,a,this.getHeight())},_draw:function(a,b,c,d){a=a||this.ctx;c=c||this.getHeight();d=d+1||this.calcRoundness();d!=void 0&&(d-=1);b=this.getPixelThickness();x=y=0;a_b_x=x-0-d;a_t_x=x-0-d;a_max_x=x-0;
|
52
|
+
t=0.5;a_ctrl_x=(a_max_x-(1-t)*(1-t)*a_b_x-t*t*a_t_x)/(2*(1-t)*t);a_ctrl_y=y+c/2;bs_slope=this.slope;bs_intercept=-a_ctrl_y-bs_slope*a_ctrl_x;ts_slope=-this.slope;ts_intercept=-a_ctrl_y-ts_slope*a_ctrl_x;a_b_y=-(bs_slope*a_b_x+bs_intercept);a_t_y=-(ts_slope*a_t_x+ts_intercept);a.beginPath();bs_ctrl_y=y+c;bs_ctrl_x=(-bs_ctrl_y-bs_intercept)/this.slope;bs_slpe_x=bs_ctrl_x+d+d;bs_slpe_y=-(bs_slope*bs_slpe_x+bs_intercept);a.moveTo(bs_slpe_x,bs_slpe_y);a.lineTo(a_b_x,a_b_y);a.quadraticCurveTo(a_ctrl_x,
|
53
|
+
a_ctrl_y,a_t_x,a_t_y);ts_ctrl_y=y;ts_ctrl_x=(ts_ctrl_y+ts_intercept)/this.slope;ts_slpe_x=ts_ctrl_x+d+d;ts_slpe_y=-(ts_slope*ts_slpe_x+ts_intercept);a.lineTo(ts_slpe_x,ts_slpe_y);var e=Math.PI-Math.abs(Math.atan(this.slope))-Math.PI/2;d=Math.sin(e)*b;e=Math.cos(e)*b;a.bezierCurveTo(ts_ctrl_x,ts_ctrl_y,ts_ctrl_x-d,ts_ctrl_y+e,ts_slpe_x-d,ts_slpe_y+e);a.lineTo(a_max_x-b,y+c/2);a.lineTo(bs_slpe_x-d,bs_slpe_y-e);a.bezierCurveTo(bs_ctrl_x-d,bs_ctrl_y-e,bs_ctrl_x,bs_ctrl_y,bs_slpe_x,bs_slpe_y)}});function genbank(a,b){for(var c=a.split("\n"),d=RegExp(/\s+gene\s+([a-z]*)\(?(\d+)\.\.(\d+)/),e=[],g=void 0,i=void 0,k=0;k<c.length;k++){var j;if(j=c[k].match(d)){j.shift();e.push(j);var m=j[2];if(g==void 0||g>m)g=m;j=j[1];if(i==void 0||i<j)i=j}}b.scale.max=g;b.scale.min=i;for(c=0;c<e.length;c++)d="+",e[c][0]=="complement"&&(d="-"),j=e[c][1],m=e[c][2],j=j-1+1,b.addGene(j,m-j,d)};function bed(a,b){var c=a.split("\n");numFeatures=c.length;for(var d=1;d<numFeatures;d++){if(c[d]=="")break;var e=c[d].split(" "),g=parseInt(e[1]),i=parseInt(e[2]),k=e[0]+": "+e[3],j=e[5],m=e[8],l=e[10].split(",");e=e[11].split(",");g=b.addFeature(new Complex("complex",g,i,j,[],{color:m,name:k}));for(i=0;i<l.length;i++){if(l[i]=="")break;g.addSubFeature(new BlockArrow("complex",parseInt(e[i]),parseInt(l[i]),j))}}};
|
@@ -0,0 +1,250 @@
|
|
1
|
+
//helpers methods to disable, enable, and uncheck radio buttons and checkboxes
|
2
|
+
(function( $ ){
|
3
|
+
//disable an element
|
4
|
+
$.fn.disable = function() {
|
5
|
+
return this.attr('disabled', 'disabled');
|
6
|
+
};
|
7
|
+
})( jQuery );
|
8
|
+
|
9
|
+
(function( $ ){
|
10
|
+
//enable an element
|
11
|
+
$.fn.enable = function() {
|
12
|
+
return this.removeAttr('disabled');
|
13
|
+
};
|
14
|
+
})( jQuery );
|
15
|
+
|
16
|
+
(function( $ ){
|
17
|
+
//uncheck an element
|
18
|
+
$.fn.uncheck = function() {
|
19
|
+
return this.removeAttr('checked');
|
20
|
+
this.attr('checked') && this.removeAttr('checked');
|
21
|
+
return this;
|
22
|
+
};
|
23
|
+
})( jQuery );
|
24
|
+
|
25
|
+
(function( $ ){
|
26
|
+
//check an element
|
27
|
+
$.fn.check = function() {
|
28
|
+
return this.attr('checked', 'checked');
|
29
|
+
};
|
30
|
+
})( jQuery );
|
31
|
+
|
32
|
+
(function( $ ){
|
33
|
+
//(pre-)check the only active database checkbox
|
34
|
+
$.onedb = function(selector) {
|
35
|
+
active_dbs = $(".databases input[type=checkbox]").not(":disabled")
|
36
|
+
if (active_dbs.length == 1){
|
37
|
+
active_dbs.check()
|
38
|
+
}
|
39
|
+
return active_dbs;
|
40
|
+
};
|
41
|
+
})( jQuery );
|
42
|
+
|
43
|
+
(function( $ ){
|
44
|
+
//highlight an element
|
45
|
+
$.fn.highlight = function() {
|
46
|
+
return this.addClass('focussed');
|
47
|
+
};
|
48
|
+
})( jQuery );
|
49
|
+
|
50
|
+
(function( $ ){
|
51
|
+
//unhighlight an element
|
52
|
+
$.fn.unhighlight = function() {
|
53
|
+
return this.removeClass('focussed');
|
54
|
+
};
|
55
|
+
})( jQuery );
|
56
|
+
|
57
|
+
(function ($) {
|
58
|
+
$.fn.poll = function () {
|
59
|
+
var that, val, tmp;
|
60
|
+
|
61
|
+
that = this;
|
62
|
+
|
63
|
+
(function ping () {
|
64
|
+
tmp = that.val();
|
65
|
+
|
66
|
+
if (tmp != val){
|
67
|
+
val = tmp;
|
68
|
+
that.change();
|
69
|
+
}
|
70
|
+
|
71
|
+
setTimeout(ping, 100);
|
72
|
+
}());
|
73
|
+
|
74
|
+
return this;
|
75
|
+
};
|
76
|
+
}(jQuery));
|
77
|
+
|
78
|
+
/*
|
79
|
+
SS - SequenceServer's JavaScript module
|
80
|
+
|
81
|
+
Define a global SS (acronym for SequenceServer) object containing the
|
82
|
+
following methods:
|
83
|
+
|
84
|
+
main():
|
85
|
+
Initializes SequenceServer's various modules.
|
86
|
+
*/
|
87
|
+
|
88
|
+
//define global SS object
|
89
|
+
var SS;
|
90
|
+
if (!SS) {
|
91
|
+
SS = {};
|
92
|
+
}
|
93
|
+
|
94
|
+
//SS module
|
95
|
+
(function () {
|
96
|
+
|
97
|
+
/*
|
98
|
+
ask each module to initialize itself
|
99
|
+
*/
|
100
|
+
SS.main = function () {
|
101
|
+
SS.blast.init();
|
102
|
+
}
|
103
|
+
}()); //end SS module
|
104
|
+
|
105
|
+
$(document).ready(function(){
|
106
|
+
// poll the sequence textbox for a change in user input
|
107
|
+
$('#sequence').poll();
|
108
|
+
|
109
|
+
// start SequenceServer's event loop
|
110
|
+
SS.main();
|
111
|
+
$('input:submit').disable();
|
112
|
+
|
113
|
+
$('form').on('blast_valid', function () {
|
114
|
+
$('input:submit').enable();
|
115
|
+
});
|
116
|
+
|
117
|
+
$('form').on('blast_invalid', function () {
|
118
|
+
$('input:submit').disable();
|
119
|
+
});
|
120
|
+
|
121
|
+
$('#sequence').bind('sequence_type_changed', function(event, type){
|
122
|
+
if (type == "nucleotide"){
|
123
|
+
$("#blastn, #tblastx, #blastx").enable();
|
124
|
+
$("#blastp, #tblastn").uncheck().disable().first().change();
|
125
|
+
}
|
126
|
+
else if (type == "protein"){
|
127
|
+
$("#blastp, #tblastn").enable();
|
128
|
+
$("#blastn, #tblastx, #blastx").uncheck().disable().first().change();
|
129
|
+
}
|
130
|
+
else if (type == undefined){
|
131
|
+
//reset blast methods
|
132
|
+
$('.blastmethods input[type=radio]').enable().first().change();
|
133
|
+
}
|
134
|
+
});
|
135
|
+
|
136
|
+
$(".advanced label").click(function(event){
|
137
|
+
//toggle display of advanced options when "Advanced parameters" text is
|
138
|
+
//clicked
|
139
|
+
$(".advanced .help").toggle("fast");
|
140
|
+
|
141
|
+
//stop event propagation here; jQuery will call `click()` on input box
|
142
|
+
//otherwise
|
143
|
+
return false;
|
144
|
+
});
|
145
|
+
|
146
|
+
$(".advanced input").click(function(event){
|
147
|
+
//but for input box toggling might get annoying
|
148
|
+
$(".advanced .help").show("fast");
|
149
|
+
});
|
150
|
+
|
151
|
+
$("input#advanced").enablePlaceholder({"withPlaceholderClass": "greytext"});
|
152
|
+
$("textarea#sequence").enablePlaceholder({"withPlaceholderClass": "greytext"});
|
153
|
+
|
154
|
+
//when a blast method is selected
|
155
|
+
$('#blastp, #blastx, #blastn, #tblastx, #tblastn').change(function(event){
|
156
|
+
//then find the selected blast method
|
157
|
+
var method = $('.blastmethods input[type=radio]').filter(':checked').val();
|
158
|
+
|
159
|
+
//and accordingly disable incompatible databases
|
160
|
+
if (method == 'blastx' || method == 'blastp'){
|
161
|
+
$('.databases.nucleotide input[type=checkbox]').uncheck().disable();
|
162
|
+
$('.databases.protein input[type=checkbox]').enable();
|
163
|
+
}
|
164
|
+
else if (method == 'blastn' || method == 'tblastx' || method == 'tblastn'){
|
165
|
+
$('.databases.protein input[type=checkbox]').uncheck().disable();
|
166
|
+
$('.databases.nucleotide input[type=checkbox]').enable();
|
167
|
+
}
|
168
|
+
else{
|
169
|
+
$('.databases input[type=checkbox]').enable();
|
170
|
+
}
|
171
|
+
|
172
|
+
$.onedb();
|
173
|
+
});
|
174
|
+
|
175
|
+
$('#blast').submit(function(){
|
176
|
+
//parse AJAX URL
|
177
|
+
var action = $(this).attr('action');
|
178
|
+
var index = action.indexOf('#');
|
179
|
+
var url = action.slice(0, index);
|
180
|
+
var hash = action.slice(index, action.length);
|
181
|
+
|
182
|
+
var button = $(this).find('input:submit');
|
183
|
+
|
184
|
+
//prevent submitting another query while this one is being processed
|
185
|
+
button.disable();
|
186
|
+
|
187
|
+
//overlay div will contain the spinner
|
188
|
+
$('body').append('<div id="overlay"></div>')
|
189
|
+
|
190
|
+
//activate spinner to indicate query in progress
|
191
|
+
$('#overlay').css({
|
192
|
+
top: '0px',
|
193
|
+
left: '0px',
|
194
|
+
width: '100%',
|
195
|
+
height: '100%',
|
196
|
+
position: 'fixed',
|
197
|
+
'z-index': 1000,
|
198
|
+
'pointer-events': 'none',
|
199
|
+
}).activity({
|
200
|
+
segments: 8,
|
201
|
+
length: 40,
|
202
|
+
width: 16,
|
203
|
+
speed: 1.8
|
204
|
+
});
|
205
|
+
|
206
|
+
// BLAST now
|
207
|
+
$.post(url, $('form').serialize()).
|
208
|
+
done(function (data) {
|
209
|
+
// BLASTed successfully
|
210
|
+
|
211
|
+
// display the result
|
212
|
+
$('#result').html(data);
|
213
|
+
location.hash = hash;
|
214
|
+
}).
|
215
|
+
fail(function (jqXHR, status, error) {
|
216
|
+
// BLAST failed
|
217
|
+
|
218
|
+
//alert user
|
219
|
+
alert('BLAST failed: ' + error);
|
220
|
+
}).
|
221
|
+
always(function () {
|
222
|
+
// BLAST complete (succefully or otherwise)
|
223
|
+
|
224
|
+
// remove progress notification
|
225
|
+
$('#overlay').activity(false).remove();
|
226
|
+
|
227
|
+
// allow submitting a new query
|
228
|
+
button.enable();
|
229
|
+
});
|
230
|
+
|
231
|
+
return false;
|
232
|
+
});
|
233
|
+
|
234
|
+
$(window).scroll(function() {
|
235
|
+
var areaHeight = $(this).height();
|
236
|
+
|
237
|
+
$('.resultn').each(function() {
|
238
|
+
var scrolled = $(window).scrollTop();
|
239
|
+
var start = $(this).offset().top - screen.height/2;
|
240
|
+
var end = start + $(this).height();
|
241
|
+
|
242
|
+
if (scrolled > start && scrolled < end){
|
243
|
+
$(this).highlight();
|
244
|
+
}
|
245
|
+
else {
|
246
|
+
$(this).unhighlight();
|
247
|
+
}
|
248
|
+
});
|
249
|
+
});
|
250
|
+
});
|
data/sequenceserver.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
# meta
|
3
3
|
s.name = 'sequenceserver'
|
4
|
-
s.version = '0.8.
|
4
|
+
s.version = '0.8.4'
|
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'
|
@@ -13,7 +13,7 @@ SequenceServer lets you rapidly set up a BLAST+ server with an intuitive user in
|
|
13
13
|
DESC
|
14
14
|
|
15
15
|
# dependencies
|
16
|
-
s.add_dependency('bundler', '~> 1.2
|
16
|
+
s.add_dependency('bundler', '~> 1.2')
|
17
17
|
s.add_dependency('sinatra', '~> 1.3.0')
|
18
18
|
s.add_dependency('ptools')
|
19
19
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
>SI2.2.0_06267 Si_gnF.scaffold02592[1282609..1284114].pep_2
|
2
|
+
ATGAATACCCTCTGGCTCTCTTTATGGGATTATCCCGGTAAGCTTCCCTTAAACTTCATG
|
3
|
+
GTGTTTGACACGAAGGATGATCTGCAAGCAGCGTATTGGAGAGATCCTTACAGCATACCT
|
4
|
+
CTGGCAGTTATCTTCGAGGACCCCCAACCGATATCACAGCGACTTATATATGAAATTAGG
|
5
|
+
ACGAATCCTTCATACACTTTGCCGCCACCGCCAACCAAATTGTATTCTGCTCCGATCAGT
|
6
|
+
TGTCGAAAGAATAAAACTGGTCACTGGATGGACGACATTTTATCGATAAAAACCGGTGAA
|
7
|
+
TCTTGTCCCGTTAACAATTACTTGCATTCTGGCTTCTTGGCTCTGCAAATGATAACGGAT
|
8
|
+
ATCACAAAGATAAAATTGGAAAATTCTGACGTGACAATACCGGATATTAAACTCATAATG
|
9
|
+
TTTCCTAAAGAGCCGTATACCGCTGACTGGATGCTGGCCTTCAGAGTTGTTATTCCGCTT
|
10
|
+
TACATGGTCTTGGCTCTCTCGCAATTTATCACTTATCTTCTGATCCTAATAGTTGGCGAG
|