-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
303 lines (258 loc) · 9.22 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<html>
<head>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="jquery.mousewheel.min.js"></script>
<link rel="stylesheet" href="css/smoothness/jquery-ui-1.8.13.custom.css">
<link rel="stylesheet" href="css/dev.css">
<link rel="stylesheet" href="css/uiblast.css">
<script src="js/jquery-ui-1.8.13.custom.min.js"></script>
<script src="jQRangeSlider.js"></script>
<script src="js/jquery.gchart.min.js"></script>
<script src="js/jquery.gchart.ext.min.js"></script>
<script src="js/jquery-geturlparams.js"></script>
<script src="js/uiblast.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
//getXML();
}
</script>
<meta name="description" content="Blast result vizualisation tool" />
<meta name="keywords" content="blast,result,viewer,tool" />
<meta name="author" content="Olivier Sallou" />
</head>
<body>
<script type = "text/javascript">
$(document).ready( function()
{
imagedata = null;
context = document.getElementById("blastcanvas").getContext("2d");
initDone=0;
yPos = 10;
xPos = 10;
size=50;
step=10;
context.font = step+"px Courier New";
Xseq = 200;
canvasMaxHeight=0;
seqdef = "Blast result";
seqlen = 1000;
maxSlicer = 100;
iter_cur=0;
sequences = new Array();
iterations = new Array();
$( "#blasttabs" ).tabs();
$("#iteration_list").change(function(e){
var iter_selected="";
$("select option:selected").each(function () {
iter_selected = parseInt($(this).val());
});
iter_cur = iter_selected-1;
sequences = getIterationHits(iter_cur);
zoom = false;
$('#zoom').css('border-style','outset');
context.putImageData(imagedata,0,0);
resetCanvas();
});
$("#savecanvas").click(function(e){
var canvasData = document.getElementById("blastcanvas").toDataURL("image/png");
ajax = new XMLHttpRequest();
ajax.open("POST",'savecanvas.php',false);
ajax.onreadystatechange = savecallbackFunction;
ajax.setRequestHeader('Content-Type', 'application/upload');
ajax.send(canvasData );
});
$("#demo").button();
$("#demo").click(function(e){
xmlUrl = "demo/blast.xml";
$('#remotexmlurl').val(xmlUrl);
$('#blasttabs').tabs().tabs('select',1);
getXML();
});
$("#remotexml").button();
$("#remotexml").click(function(e){
xmlUrl = "getRemoteXML.php?url="+encodeURI($('#remotexmlurl').val());
$('#blasttabs').tabs().tabs('select',1);
getXML();
});
if($.getURLParam("file")) {
$('#remotexmlurl').val(decodeURI($.getURLParam("file")));
xmlUrl = "getRemoteXML.php?url="+encodeURI($('#remotexmlurl').val());
$('#blasttabs').tabs().tabs('select',1);
getXML();
}
$("#sortScore").button();
$("#sortScore").click(function(e){
sequences.sort(sortScore);
drawSequences(0,maxSlicer);
});
$("#sortFrom").button();
$("#sortFrom").click(function(e){
sequences.sort(sortFrom);
drawSequences(0,maxSlicer);
});
$("#savecanvas").button();
$("#blastcanvas").click(function(e){
var position = getPosition(e,document.getElementById("blastcanvas"));
var y = Math.floor(position.Y/10);
window.open("sequence.html?hitnum="+sequences[y]["hitnum"]+"&hspnum="+sequences[y]["hspnum"]+"&file="+encodeURI($('#remotexmlurl').val()));
//http://localhost/test/sequence.html?hitnum=1
});
zoom = false;
$("#zoom").button();
$("#zoom").click(function(e){
if(zoom==false) {
zoom = true;
$('#zoom').css('border-style','inset');
imagedata = context.getImageData(0,0,$("#blastcanvas").width(),$("#blastcanvas").height());
}
else {
zoom = false;
$('#zoom').css('border-style','outset');
context.putImageData(imagedata,0,0);
}
});
$("#blastcanvas").mousemove(function(e){
if(zoom) {
var position = getPosition(e,document.getElementById("blastcanvas"));
context.putImageData(imagedata,0,0);
magnify = context.getImageData(position.X-50,position.Y-step,100,3*step);
if(position.X>10 && position.X < ($("#blastcanvas").width()-10) && position.Y>10 && position.Y < ($("#blastcanvas").height()-10)) {
var y = Math.floor(position.Y/10);
sequence = sequences[y];
context.save();
context.fillStyle = "#000000";
context.fillRect (position.X-255, position.Y-55, 200 , 110);
context.fillStyle = "#F1EBEB";
context.fillRect (position.X-250, position.Y-50, 200 , 100);
context.font = step+"px Courier New";
context.fillStyle = "#000000";
steppy = step * 1.5;
if(y>1) {
sequence = sequences[y-1];
context.fillText(sequence["id"], position.X - 240, position.Y - steppy);
}
sequence = sequences[y];
context.fillText(sequence["id"], position.X - 240, position.Y);
if(y<sequences.length-1) {
sequence = sequences[y+1];
context.fillText(sequence["id"], position.X - 240, position.Y + steppy);
}
context.strokeStyle = "#000000";
context.fillStyle = "#555";
context.beginPath();
context.arc(position.X,position.Y,115,0,Math.PI*2,true);
context.closePath();
context.stroke();
context.fill();
context.strokeStyle = "#000000";
context.fillStyle = "#F1EBEB";
context.beginPath();
context.arc(position.X,position.Y,110,0,Math.PI*2,true);
context.closePath();
context.stroke();
context.fill();
// Sequences:
var newCanvas = $("<canvas>")
.attr("width", magnify.width)
.attr("height", magnify.height)[0];
newCanvas.getContext("2d").putImageData(magnify, 0, 0);
context.scale(2, 2);
context.drawImage(newCanvas, position.X/2 - 50 , position.Y/2 - 15 );
context.restore();
}
}
});
});
function getXML() {
$.ajax( {
type: "GET",
url: xmlUrl,
dataType: "xml",
success: function(xml)
{
sequences = new Array();
var options="";
$(xml).find('Iteration').each( function(){
var iter_num = $(this).find('Iteration_iter-num').text();
var iter_id = $(this).find('Iteration_query-ID').text();
var iter_def = $(this).find('Iteration_query-def').text();
options += "<option value=\""+iter_num+"\">"+iter_def+"</option>\n";
getHits(iter_num,$(this));
});
$("#iteration_list").html(options);
iter_cur=0;
sequences = getIterationHits(iter_cur);
resetCanvas();
}
});
}
</script>
<!--
<div id="zoomin">plus</div>
<div id="zoomout">minus</div>
-->
<div class="header">
GenOuest Blast XML display
</div>
<div class="content">
<div id="blasttabs">
<ul>
<li><a href="#tab-upload">File selection</a></li>
<li><a href="#tab-blast">View</a></li>
<li><a href="#tab-about">About</a></li>
</ul>
<div id="tab-upload">
<h2>Select Blast XML file</h2>
<div>
<div>
<button id="demo">View demo</button>
</div>
<div>
<label for="blasturl">Blast XML file URL</label>
<input type="text" id="remotexmlurl"></input>
<button id="remotexml">View remote XML file</button>
</div>
</div>
</div>
<div id="tab-blast">
<!-- <div id="blast" class="label"></div> -->
<div id="iteration_div">
<form action="#">
<fieldset>
<select name="iteration_list" id="iteration_list">
</select>
</fieldset>
</form>
</div>
<div id="chart_div"></div>
<div id="sortbutton">Sort by
<input type="radio" id="sortScore" name="radio" /><label for="sortScore">Score</label>
<input type="radio" id="sortFrom" name="radio" /><label for="sortFrom">From</label>
</div>
<br/>
<div id="savecanvas">Save alignment image</div>
<div id="zoom">Zoom</div>
<div id="selector" class="selector">
<div id="seqslider" class="slider"></div>
</div>
<div id="legend">ID - SCORE - SEQUENCE, click on a sequence for details</div>
<canvas id="blastcanvas" width="1200" height="6000"></canvas>
</div>
<div id="tab-about">
<p>This blast visualization tool takes as input a Blast XML result file (its URL).</p>
<p>It displays the results in a graphical way with a plot of hits with their score. List can be ordered by score or position.</p>
<p>If a sequence is selected, a new window is opened to get the details of the alignment and the seqcrawler tool is triggered to
try to get additional information (genes for example) from our index (Genbank, Bacteria, UniProt/SwissProt). If information is available, it is displayed
with the alignment at the corresponding position.</p>
<p>You can also have a look at our phylogenetic tree visualisation page <a href="uiphy.html">here</a></p>
<p>This tool is a GenOuest platform product (open source), while still experimental.</p>
<p>Contact: <a href="mailto:[email protected]">support[at]genouest.org</a></p>
</div>
</div> <!-- blasttabs -->
</div> <!-- content -->
<div class="footer"></div>
</body>
</html>