forked from GMOD/jbrowse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
117 lines (103 loc) · 5.1 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JBrowse</title>
<link rel="stylesheet" type="text/css" href="css/genome.css">
<script type="text/javascript">
// jshint unused: false
var dojoConfig = {
async: true,
baseUrl: './src',
has: {
'host-node': false // Prevent dojo from being fooled by Electron
}
};
// Move Electron's require out before loading Dojo
if(window.process&&process.versions&&process.versions.electron) {
window.electronRequire = require;
delete window.require;
}
</script>
<script type="text/javascript" src="src/dojo/dojo.js"></script>
<script type="text/javascript" src="src/JBrowse/init.js"></script>
<script type="text/javascript">
window.onerror=function(msg){
if( document.body )
document.body.setAttribute("JSError",msg);
}
// puts the main Browser object in this for convenience. feel
// free to move it into function scope if you want to keep it
// out of the global namespace
var JBrowse;
require(['JBrowse/Browser', 'dojo/io-query', 'dojo/json' ],
function (Browser,ioQuery,JSON) {
// the initial configuration of this JBrowse
// instance
// NOTE: this initial config is the same as any
// other JBrowse config in any other file. this
// one just sets defaults from URL query params.
// If you are embedding JBrowse in some other app,
// you might as well just set this initial config
// to something like { include: '../my/dynamic/conf.json' },
// or you could put the entire
// dynamically-generated JBrowse config here.
// parse the query vars in the page URL
var queryParams = ioQuery.queryToObject( window.location.search.slice(1) );
var config = {
containerID: "GenomeBrowser",
dataRoot: queryParams.data,
queryParams: queryParams,
location: queryParams.loc,
forceTracks: queryParams.tracks,
initialHighlight: queryParams.highlight,
show_nav: queryParams.nav,
show_tracklist: queryParams.tracklist,
show_overview: queryParams.overview,
show_menu: queryParams.menu,
show_fullviewlink: queryParams.fullviewlink,
show_tracklabels: queryParams.tracklabels,
update_browser_title: queryParams.browsertitle,
highResolutionMode: queryParams.highres,
stores: { url: { type: "JBrowse/Store/SeqFeature/FromConfig", features: [] } },
bookmarks: { },
makeFullViewURL: function( browser ) {
// the URL for the 'Full view' link
// in embedded mode should be the current
// view URL, except with 'nav', 'tracklist',
// and 'overview' parameters forced to 1.
return browser.makeCurrentViewURL({ nav: 1, tracklist: 1, overview: 1 });
},
updateBrowserURL: true
};
//if there is ?addFeatures in the query params,
//define a store for data from the URL
if( queryParams.addFeatures ) {
config.stores.url.features = JSON.parse( queryParams.addFeatures );
}
// if there is ?addTracks in the query params, add
// those track configurations to our initial
// configuration
if( queryParams.addTracks ) {
config.tracks = JSON.parse( queryParams.addTracks );
}
// if there is ?addBookmarks, add those to configuration
if( queryParams.addBookmarks ) {
config.bookmarks.features = JSON.parse( queryParams.addBookmarks );
}
// if there is ?addStores in the query params, add
// those store configurations to our initial
// configuration
if( queryParams.addStores ) {
config.stores = JSON.parse( queryParams.addStores );
}
// create a JBrowse global variable holding the JBrowse instance
JBrowse = new Browser( config );
});
</script>
</head>
<body>
<div id="GenomeBrowser" style="height: 100%; width: 100%; padding: 0; border: 0;"></div>
<div style="display: none">JBrowseDefaultMainPage</div>
</body>
</html>