-
Notifications
You must be signed in to change notification settings - Fork 0
/
url_builder.html
130 lines (101 loc) · 4.9 KB
/
url_builder.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
<html>
<head>
<script>
async function buildURL(protein, length, bioproject) {
//let protocol = window.location.protocol;
//let hostname = window.location.hostname;
//let port = window.location.port;
let path = '/tools/protein_schematic/';
//if (port != 80) {
// port = ':'+port;
//}
//else {
// port = '';
//}
let releaseVersion = 'WS278';
let releaseVersionJson = '';
//this will be what's needed when it goes into staging/production
//this can probably be a relative url too
//let releaseVersionURL = protocol + '//' + hostname + port + '/rest/version';
// let releaseVersionURL = '/rest/version';
//let releaseVersionURL = 'https://wormbase.org/rest/version';
// let releaseVersionResponse = await fetch(releaseVersionURL);
// if (releaseVersionResponse.ok) {
// releaseVersionJson = await releaseVersionResponse.json();
// releaseVersion = releaseVersionJson.version;
// }
// else {
// alert('fetching version via rest failed');
// }
// this line will have to go away when this goes into production
// it's just here for testing
// releaseVersion = 'WS274';
//probably could make this a relative url when it gets incorporated into the webiste
// let jbrowseBaseURL = protocol +'//' + hostname + port + path;
let jbrowseBaseURL = path ;
let baseURL = 'https://s3.amazonaws.com/wormbase-modencode/protein_schematic/'+ releaseVersion + '/' +bioproject + '/';
let urlTemplate = baseURL+'tracks/';
let trackPart = 'Exon%20boundaries';
//yes, the next four lines could be wrapped in a function since I'm doing the same thing over and over
let response = await fetch(urlTemplate+'seg/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2Cseg';
}
response = await fetch(urlTemplate+'signalp/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2Csignalp';
}
response = await fetch(urlTemplate+'tmhmm/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2Ctmhmm';
}
response = await fetch(urlTemplate+'ncoils/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2Cncoils';
}
response = await fetch(urlTemplate+'Catalytic%20residue/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2CCatalytic%20residue';
}
response = await fetch(urlTemplate+'Metal%20binding%20site/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2CMetal%20binding%20site';
}
response = await fetch(urlTemplate+'Post%20transcriptionally%20modified%20site/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2CPost%20transcriptionally%20modified%20site';
}
response = await fetch(urlTemplate+'Motifs/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2CMotifs';
}
response = await fetch(urlTemplate+'Selected%20BLASTP%20Homologies/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2CSelected%20BLASTP%20Homologies';
}
//console.log(urlTemplate+'Mass%20spec%20peptides/'+protein+'/trackData.jsonz');
response = await fetch(urlTemplate+'Mass%20spec%20peptides/'+protein+'/trackData.jsonz');
if (response.ok) { // if HTTP-status is 200-299
trackPart = trackPart + '%2CMass%20spec%20peptides';
}
let fullJBrowseURL = jbrowseBaseURL+'?data=data/'+bioproject+'&tracklabels=0&nav=0&tracklist=0&overview=0&loc='+protein+'%3A1..'+length+'&tracks='+trackPart;
//alert(fullJBrowseURL);
let linkoutJBrowseURL = jbrowseBaseURL+'?loc='+protein+'%3A1..'+length+'&tracks='+trackPart;
console.log(linkoutJBrowseURL);
document.getElementById("replaceme").innerHTML='<object id="innerJBrowse" type="text/html" style="width:100%;height:400px;overflow: auto;" data="'+fullJBrowseURL+'" ></object>';
document.getElementById("linkout").href = linkoutJBrowseURL;
return ;
}
</script>
</head>
<body>
<div id="replaceme" style="width:100%;height:400px;background-color:#fff;resize: vertical;overflow: auto;">hello</div>
<button type="button" onclick="buildURL('JC8.10a', 1113, 'c_elegans_PRJNA13758')">UNC-26, isoform a</button>
<button type="button" onclick="buildURL('C18D11.2', 266, 'c_elegans_PRJNA13758')">MAA-1</button>
<button type="button" onclick="buildURL('F11C7.3', 424, 'c_elegans_PRJNA13758')">VAP-1</button>
<button type="button" onclick="buildURL('Y48B6A.11', 922, 'c_elegans_PRJNA13758')">JMJD-2</button>
<button type="button" onclick="buildURL('T09D3.4a', 490, 'c_elegans_PRJNA13758')">NHR-216, isoform a</button>
<button type="button" onclick="buildURL('M7.7', 370, 'c_elegans_PRJNA13758')">M7.7</button>
<a id="linkout" href="">linkout<a/>
</body>
</html>