-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
513 lines (423 loc) · 22.6 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Rover</title>
<link href='http://fonts.googleapis.com/css?family=Ubuntu:400,700&v2' rel='stylesheet' type='text/css'>
<script src="assets/js/changecssjs.js" type="text/javascript"></script>
<script src="assets/js/jquery.1.7.min.js"></script>
<script src="assets/js/Scribl.1.1.3.min.js"></script>
<script src="assets/js/underscore-min.js"></script>
<script src="assets/js/backbone.js"></script>
<script src="assets/js/backbone.getters.setters.js"></script>
<script src="assets/js/jquery.selectBox.js"></script>
<script type="text/javascript" src="dragscrollable.js"></script>
<link rel="stylesheet" href="css/jquery.ui.aristo.all.css">
<link rel="stylesheet" type="text/css" href="css/rover.css" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="assets/js/SimplejQueryDropdowns/css/dropdown.css" />
<link rel="stylesheet" type="text/css" href="assets/css/jquery.selectBox.css" />
<script src="assets/js/jquery-ui.chase.min.js"></script>
<script src="assets/js/jsdas.0.1.6.js" ></script>
<script src="assets/js/SimplejQueryDropdowns/js/jquery.dropdownPlain.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-21069282-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script src="assets/js/handlebars-1.0.0.beta.6.js"></script>
<!-- <script src="js/rover.js" ></script> -->
<script src="js/rover.utils.js" ></script>
<script src="js/rover.source.js" ></script>
<script src="js/rover.bsource.js" ></script>
<script src="js/sources/rover.bsource.json.js" ></script>
<script src="js/sources/rover.bsource.das.js" ></script>
<script src="js/rover.btrack.js" ></script>
<script src="js/rover.btracks.js" ></script>
<script src="js/sources/rover.source.das.js" ></script>
<script src="js/sources/rover.source.bam.js" ></script>
<script src="js/sources/rover.source.json.js" ></script>
<script src="js/rover.track.js" ></script>
<script>
// initilization variables
var splash = true;
var rover = undefined;
$(document).ready(function() {
rover = new window.Rover({
viewer: document.getElementById('rover'),
zoomer: document.getElementById('zoom-slider'),
scroller: document.getElementById('scroll-slider'),
zoomMin: 100,
zoomMax: 100000,
});
// $('.rover-canvas-listable:nth-child(odd) .rover-canvas-div').css('background-color', 'red');
// test if there are any tracks left after track remove
rover.onRemoveTrack = function(id) { if (rover.isEmpty()) {toggleSplashPage(true)} };
// turn on splash page
toggleSplashPage();
window.RoverRouter = Backbone.Router.extend({
routes: {
'': 'home'
},
initialize: function() {
this.tracksView = new BTracksView({ collection: rover.tracks, rover: rover });
// this.viewerView = new ViewerView({ model: rover });
this.zoomView = new ZoomView({ model: rover });
this.scaleView = new ScaleView({ model: rover });
// this.scaleView = new ScaleView({ model: rover });
},
home: function() {
var $roverDiv = $('#rover');
var $zoom = $('#zoom-slider');
$roverDiv.empty();
//$container.append(this.viewerView.render().el);
// this.viewerView.render();
// $('#viewer').append(this.tracksView.render().el);
$('#viewer').prepend(this.scaleView.render().el);
$roverDiv.append(this.tracksView.render().el);
$('#container, #rover-canvas-list').dragscrollable({
dragSelector: '.dragger',
acceptPropagatedEvent: true,
stop: function(event) {
var currPx = $('#'+event.data.scrollable).scrollLeft();
if(event.data.prevScrolls.length == 0)
return;
var currPx = event.data.prevScrolls[0].left;
var prevPx = event.data.prevScrolls[1].left;
var time = event.data.prevScrolls[0].timeStamp - event.data.prevScrolls[1].timeStamp;
var rate = (currPx - prevPx) / time;
var inertialTime = 400;
var inertialPx = rate * inertialTime + currPx;
if(Math.abs(currPx - prevPx) > 20) {
$('#rover-canvas-list').animate({scrollLeft:inertialPx}, inertialTime, 'easeOutQuad');
// $('#rover-canvas-list').stop();
}
}
});
//$container.append( this.zoomView.render().el);
//this.controlsView.render();
//$zoom.html(this.controlsView.render().el);
loadUrlQuery();
}
});
$(function() {
window.App = new RoverRouter();
Backbone.history.start();
//Backbone.history.start({pushState:true});
});
// inital 1000G sources
rover.init1000GSources();
//loadUrlQuery();
// watch for enter key on jump input box
$("#jump-to").keyup(function(event) {
// check for enter key
if(event.keyCode == 13) {
var jumpToPos = parseInt($('#jump-to').val());
rover.jumpTo(jumpToPos);
}
});
// watch for enter key on chromosome box
$("#chromosome").keyup(function(event) {
// check for enter key
if(event.keyCode == 13) {
rover.tracks.each( function(track) {
track.set({ chromosome: $("#chromosome").val() });
});
// change chromosome for all tracks
// for (var i in rover.tracks)
// rover.tracks[i].setChromosome( $("#chromosome").val() );
//
// // fetch and draw new data
// rover.fetchAll(rover.min, rover.max, 'center');
// rover.draw(rover.min, rover.max, rover.getWidthWithBuffers(), rover.getDisplayMinNts());
}
});
// stupid hack to fix dragscrollable eating the click events on the edit div
$('input').live('click', function(){$(this).focus()});
// $('select').live('click', function(){
// $(this).focus();
// var options = $(this).find('option').length;
// $(this).attr('size', options);
// });
});
function zoomOut() {
// everything is backwards
var step = 15000;
var min = $('#zoom-slider').slider('option', 'min');
var value = $('#zoom-slider').slider('value');
var newValue = Math.max(min, value - step);
$('#zoom-slider').slider('value', newValue);
}
function zoomIn() {
// everything is backwards
var step = 15000;
var max = $('#zoom-slider').slider('option', 'max');
var value = $('#zoom-slider').slider('value');
var newValue = Math.min(max, value + step);
$('#zoom-slider').slider('value', newValue);
}
function addTrack() {
if (rover.isEmpty())
toggleSplashPage(false);
var newTrack = new window.BTrack;
rover.tracks.add( newTrack ); // add to beginning of collection
newTrack.set({ edit:true });
}
function toggleSplashPage(force){
if (force != undefined)
splash = force;
if (!splash) {
$('#splash').css('display', 'none')
$('#viewer').css('visibility', 'visible')
$('#zoom').css('display', 'inline')
splash = false
} else {
$('#splash').css('display', 'inline')
$('#viewer').css('visbility', 'hidden')
$('#zoom').css('display', 'none')
splash = true;
}
}
function toggleAbout() {
var about = document.getElementById('about');
if (about.style.display == 'none' || about.style.display == "")
about.style.display = "inline";
else
about.style.display = "none";
}
function toggleLinkUrl() {
if( $('#link-url').css('display') == 'none' ) {
$('#link-url-input').val(rover.toURL());
$('#link-url').css('display', 'inherit');
$('#embed-url-input').val(rover.toIframe());
}
else
$('#link-url').css('display', 'none')
}
function maximizeViewer(header, controls, copyright) {
if (!header) $('#header').css('display', 'none');
if (!copyright) {
$('#chase').css('display', 'none');
$('#copyright').css('text-align', 'right');
$('#copyright').css('padding-right', '10px');
}
if (!controls) $('#right-buttons').css('display', 'none');
// make controls text smaller
changecss('.controls', 'font-size', '17px');
changecss('#top-controls .viewerButtonLeft', 'padding', '0px 10px');
changecss('#top-controls .viewerButtonRight', 'padding', '0px 10px');
// hide track edit panel help div
changecss('.rover-info-div', 'display', 'none');
}
function exportToFigureMaker() {
var figureMakerUrl = "http://chmille4.github.com/figureMaker/index.html";
window.open(figureMakerUrl + rover.toURLParams());
}
function loadUrlQuery() {
if (rover.loadFromURL(location.href)) {
if (rover.urlQuerys['embed'])
maximizeViewer(rover.urlQuerys['header'], rover.urlQuerys['controls'], rover.urlQuerys['copyright']);
// set chromosome
//$('#chromosome').val( rover.getChromosome() );
}
}
</script>
<script type="application/javascript">
jQuery(function() {
// window.btracks.fetch();
});
</script>>
</head>
<body>
<!-- Header -->
<div id="header">
Rover <span style="font-style: italic; font-size: 11px; color:#bbbfc3; text-shadow: 0 0px 0px black;">HTML5 Genome Browser</span>
</div>
<!-- Controls -->
<div id="top-controls" class="controls">
<ul class='left'>
<li>Chromosome <input id='chromosome'></input></li>
<li>Jump To <input id='jump-to'></input></li>
</ul>
<ul class='right'>
<li onClick="addTrack()">+ Track</li>
<li onClick='exportToFigureMaker()' title="Export view to Figure Maker">Figurize</li>
<li style="width: 2em" onClick='toggleLinkUrl()' title="Link to current view">Link
<div onClick='event.stopPropagation()' id="link-url">
<div style="box-shadow: 4px 4px 4px -2px rgb(170,170,170);">
<div>Link to current view</div><input id="link-url-input"></input><br/>
<div>Embed in website</div><input id="embed-url-input"></input>
</div>
</li>
</ul>
</div>
<!-- container -->
<div id='container'>
<!-- splash screen/no-data -->
<div id='splash'>
<p>To get started <a href="#" onClick="toggleDasSources()">add DAS sources</a> to see annotation data</p>
<p>Or</p>
<p>Try out a <a href='http://chmille4.github.com/Rover/index.html?urls=http://useast.ensembl.org/das/Homo_sapiens.NCBI36.transcript,http://bioinformatics.bc.edu/ngsserver/json/vcf/./public/ALL.2of4intersection.20100804.sites.vcf.gz,http://bioinformatics.bc.edu/ngsserver/json/bam/./public/NA06985.chrom1.LS454.ssaha2.CEU.exon_targetted.20100311.bam&names=Ensembl%20NCBI36/hg18,./public/ALL.2of4intersection.20100804.sites,./public/NA06985.chrom1.LS454.ssaha2.CEU.exon_targetted.20100311&min=18149537&max=18149629&display=collapse,collapse,expand&segment=1&types=refGene,,' onClick='location.reload(true)'>demo</a> with pre-selected sources</p>
<p style="font-size: 13px"><a href="#" onClick="toggleAbout()">About DAS Browser</a></p>
</div>
<!-- Viewer -->
<div id='viewer'>
<div id='rover' class="dragger"></div>
</div>
<!-- Zoom Slider -->
<div id='zoom'>
<div style="float:left; height:100%">
<div class="ui-icon ui-icon-circle-plus" onclick="zoomIn()"></div>
<div id="zoom-slider"></div>
<div class="ui-icon ui-icon-circle-minus" onclick="zoomOut()"></div>
</div>
<div id="zoom-title">
z<br/>o<br/>o<br/>m
</div>
</div>
</div> <!-- close container div >
<!-- footer -->
<div id='footer'>
<!-- Scroll Slider -->
<!-- <div style="width:342px; margin-left:auto; margin-right:auto">
<div style="margin-top:4px; float:left" class="ui-icon ui-icon-circle-minus"></div>
<div id='scroll-slider'></div>
<div style="margin-top:4px; float:right" class="ui-icon ui-icon-circle-plus"></div>
<div style="clear:both"></div>
</div> -->
</div>
<!-- About -->
<div id="aboutLink">
<a style='cursor:pointer' onClick="toggleAbout()">About</a>
</div>
<div id='about'>
<span style="width:100%">About</span>
<p>Rover is a HTML5 Genome Browser that displays annotation data from any database that supports the <a href='http://www.biodas.org/wiki/Main_Page'>DAS</a> protocol.</p><p>DAS sources can be added from the <a href="http://www.dasregistry.org/listSources.jsp?organism=any&CSName=any&CSTypes=any&capabilities=features&labels=any&spec=any&cmd=find">DAS registry</a> by clicking +Track at the top right of the viewer.</p>
<p>Source code is available <a href='https://github.com/chmille4/Rover'>here</a>. Feel free to use, modify, and contribute.</p>
<button onClick="toggleAbout()">Close</button>
</div>
<!-- Copyright -->
<div id="copyright">
Powered By <a href="http://chmille4.github.com/Scribl/">Scribl</a>
<span id='chase'><span style='margin-left:6px'>© </span>
<a href="http://github.com/chmille4">Chase Miller</a> 2011</span>
</div>
<script id="scale-template" type="text/x-handlebars-template">
<canvas class="rover-canvas" height="20"/>
</script>
<script id="tracks-template" type="text/x-handlebars-template">
<div id="rover-canvas-list">
</div>
</script>
<script id="track-template" type="text/x-handlebars-template">
<div class="rover-canvas-div dragger">
<div class="rover-track-menu">
<ul class="dropdown">
<li><a style="margin-top:-4px; width: 32px"><img style="float:left" width="16" src="./images/gear_white.png"</img>
<div class="ui-icon ui-icon-triangle-1-s"></div></a>
<ul class="sub_menu" style="text-align: center">
<div id ="top-border"></div>
<li>
<span style="padding-left:8px">View As ></span>
<ul class="draw-style">
<li><a data-drawstyle="collapse">Collapsed</a></li>
<li><a data-drawstyle="expand" >Expanded</a></li>
<li><a data-drawstyle="line">Line Chart</a></li>
</ul>
</li>
<li><a class="edit">Edit</a></li>
</ul>
</li>
</ul>
</div>
<div class="rover-remove-track-button">X</div>
<span class="rover-canvas-label">
<a class="rover-error">Error, Retry</a>
<span class="spinner">
<img src="images/spinner.gif">
retrieving from:
</img>
</span><span class='track-edit-label'>{{name}}</span>
</span>
<div class="rover-track-edit-div">
<div class="columns">
<div style="float: left; text-align: center; width: 430px;">
<div style="float: left; text-align: right;">
<div>
<form>
<span class="labels">1000G Data</span>
<select id="{{track.id}}-edit-thousandG" style="width:125px">
<option></option>
{{#each thousandGSources}}
<option>{{this}}</option>
{{/each}}
</select>
</form>
</div>
<div>
<span class="labels">Source URL</span><input class="track-edit-urlInput" value={{url}} />
</div>
<!-- <div>
<span class="labels">Source File(s)</span><input type="file" multiple=
"multiple" />
</div> -->
</div>
<div style="float: right; text-align: right;">
<div>
<span class="labels">Name</span><input class="track-edit-name" value={{name}} />
</div>
<!-- <div>
<span class="labels">Chromosome</span><input class="track-edit-chromosome" value={{chromosome}} disabled="disabled" />
</div> -->
<div>
<span class="labels">Type Filter</span><input class="track-edit-typefilter" value={{typefilter}} />
</div>
</div>
<div style="clear:both"></div>
<div style="margin-top:5px">
<button class="track-edit-save">Save</button>
<button class="track-edit-close" >X</button>
</div>
<div style="font-size: 10px;">
More DAS sources can be found at the <a href=
"http://www.dasregistry.org/listSources.jsp?organism=any&CSName=any&CSTypes=any&capabilities=features&labels=any&spec=any&cmd=find">
DAS registry</a>
</div>
</div>
<div class="rover-info-div">
<div>
<span class="info-title">Name</span><span>the display name for the track</span>
</div>
<div>
<span class="info-title">Source Url</span><span>the url to the remote data via
<a href="http://www.biodas.org/wiki/Main_Page">DAS</a> or <a href=
"https://github.com/chmille4/Ngs_server">Ngs Server</a></span>
</div>
<div>
<span class="info-title">Source File(s)</span><span>Path to file. <a href=
"site/supportedFormats.html">More Info</a></span>
</div>
<div>
<span class="info-title">1000G</span><span>subset of the 1000G dataset -
1000genomes.org</span>
</div>
<div>
<span class="info-title">Chromosome</span><span>the chromosome or segment</span>
</div>
<div>
<span class="info-title">Type Filter</span><span>annotation types of biological
significance that correspond roughly to EMBL/GenBank feature table tags (e.g.
exon, refGene). However each database can use their own</span>
</div>
</div>
</div>
</div>
<canvas class="rover-canvas">
</div>
</script>
</body>
</html>