forked from ncbi/icn3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
285 lines (235 loc) · 9.92 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
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="iCn3D Structure Viewer">
<meta name="keywords" content="NCBI, Structure, JavaScript, iCn3D, 3D, Viewer, WebGL, three.js, sequence, chemical">
<meta name="robots" content="index,follow,noarchive">
<meta name="ncbi_app" content="structure">
<meta name="ncbi_pdid" content="icn3d">
<meta name="ncbi_page" content="full">
<meta name="ncbi_pinger_xml_http_request_override" content="false"/>
<title>iCn3D: Web-based 3D Structure Viewer</title>
<script type="text/javascript">
window.ncbi_startTime = new Date();
</script>
</head>
<body>
<div id="div0"></div>
<link rel="stylesheet" href="lib/jquery-ui-1.13.2.min.css">
<link rel="stylesheet" href="icn3d.css">
<script src="lib/jquery-3.5.0.min.js"></script>
<script src="lib/jquery-ui-1.13.2.min.js"></script>
<script src="lib/three_0.137.0.min.js"></script>
<script src="icn3d.min.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
if (navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // If Internet Explorer
// iCn3D version 2.24.7 doesn't work with three_0.128.0.min.js
//$.getScript('icn3d_full_ui_2.24.7.min.js', function() {
// var version = 2;
// launchIcn3d(version);
//});
var fixedUrl = document.URL.replace('full.html', 'full_2.24.7.html');
window.open(fixedUrl, '_self');
alert("IE does NOT work with the current iCn3D version 3. The old iCn3D version 2 is used instead.");
}
else {
//$.getScript('icn3d.min.js', function() {
var version = 3;
launchIcn3d(version);
//});
}
function launchIcn3d(version) {
var cfg = getConfig();
cfg.version = version;
if(cfg.mmtfid !== undefined) {
setupViewer('mmtfid', cfg.mmtfid, cfg);
}
else if(cfg.pdbid !== undefined) {
setupViewer('pdbid', cfg.pdbid, cfg);
}
else if(cfg.afid !== undefined) {
setupViewer('afid', cfg.afid, cfg);
}
else if(cfg.opmid !== undefined) {
setupViewer('opmid', cfg.opmid, cfg);
}
else if(cfg.cid !== undefined) {
setupViewer('cid', cfg.cid, cfg);
}
else if(cfg.mmcifid !== undefined) {
setupViewer('mmcifid', cfg.mmcifid, cfg);
}
else if(cfg.mmdbid !== undefined) {
setupViewer('mmdbid', cfg.mmdbid, cfg);
}
else if(cfg.gi !== undefined) {
setupViewer('gi', cfg.gi, cfg);
}
else if(cfg.uniprotid !== undefined) {
setupViewer('uniprotid', cfg.uniprotid, cfg);
}
else if(cfg.blast_rep_id !== undefined) {
if( (cfg.from === 'blast' || cfg.from === 'icn3d') && cfg.command == '') {
command = 'view+annotations;+set+annotation+cdd;+set+annotation+site;+set+view+detailed+view;+select+chain+'
+ cfg.blast_rep_id + ';+show+selection';
}
setupViewer('blast_rep_id', cfg.blast_rep_id, cfg);
}
else if(cfg.urlname !== undefined) {
var urlname = decodeURIComponent(cfg.urlname);
setupViewer('url', cfg.urltype + '|' + urlname, cfg);
}
// e.g., align=103701,1,4,68563,1,167 [mmdbid1,biounit,molecule,mmdbid2,biounit,molecule]
else if(cfg.align !== undefined) {
cfg.divid = 'div0';
//cfg.align = cfg.align;
//cfg.showalignseq = cfg.showalignseq;
// VAST+ uses biological units
cfg.bu = 1;
var icn3dui = new icn3d.iCn3DUI(cfg);
icn3dui.show3DStructure();
}
else if(cfg.chainalign !== undefined || cfg.mmdbafid !== undefined) {
cfg.divid = 'div0';
var icn3dui = new icn3d.iCn3DUI(cfg);
icn3dui.show3DStructure();
}
else {
setupViewer('', '', cfg);
}
}
function setupViewer(idName, idValue, cfg) {
var maxStructure = 5; // show max 5 structures
var idArray = idValue.toString().replace(/\s/g, '').split(',');
if(idArray.length > 1) {
resize = false;
if(cfg.width && cfg.width.indexOf('%') != -1) {
cfg.width = 400;
cfg.height = 400;
}
}
for(var i = 0, il = idArray.length; i < il && i < maxStructure; ++i) {
cfg.divid = 'div' + i;
if(idName !== '') cfg[idName] = idArray[i];
var icn3dui = new icn3d.iCn3DUI(cfg);
$.when(icn3dui.show3DStructure()).then(function() {
//icn3dui.setOption('color', 'spectrum');
});
if(idName === '') $("#div" + i + "_wait").hide();
}
}
function getConfig() {
// separating the GET parameters from the current URL
// repalce "color #" with "color " in the url
var url = document.URL.replace(/\#/g, '');
var bNopara = false;
var ampPos = url.indexOf("?");
if(ampPos === -1) {
// alert("Please include '?pdbid=1GPK,2POR,...' in your url");
bNopara = true;
}
var params = url.split("?");
// transforming the GET parameters into a dictionnary
var search = params[params.length - 1];
var cfg = {};
if(!bNopara) {
var decodeSearch = decodeURIComponent(search).replace(/\+/g, ' ');
// command could contains '&', for example when loading statefile 'load mmdb 1kq2 | parameters &atype=1'
var commandPos = decodeSearch.indexOf('&command=');
if(commandPos != -1) {
cfg.command = decodeSearch.substr(commandPos + 9); // ";" separated commands
decodeSearch = decodeSearch.substr(0, commandPos);
var paraPos = decodeSearch.indexOf(' | parameters ');
if(paraPos != -1) { //When loading statefile (e.g., 'load mmdb 1kq2 | parameters &atype=1'), the commands ends with '}}'.
var tmpPos = cfg.command.indexOf('}}&');
if(tmpPos != -1) { // more parameters after the command
decodeSearch += cfg.command.substr(tmpPos + 2);
cfg.command = cfg.command.substr(0, tmpPos + 2);
}
}
else {
var paraPos = cfg.command.indexOf(' | parameters ');
if(paraPos != -1) { //"&command=load mmdb 7DDD | parameters &mmdbid=7DDD; select..." the commands ends with '}}'.
var tmpPos = cfg.command.indexOf('}}&');
if(tmpPos != -1) { // more parameters after the command
decodeSearch += cfg.command.substr(tmpPos + 2);
cfg.command = cfg.command.substr(0, tmpPos + 2);
}
}
else {
var tmpPos = cfg.command.indexOf('&');
if(tmpPos != -1) {
decodeSearch += cfg.command.substr(tmpPos);
cfg.command = cfg.command.substr(0, tmpPos);
}
}
}
}
else {
cfg.command = '';
}
var hashes = decodeSearch.split('&');
for (var i = 0; i < hashes.length; i++) {
var hash = hashes[i].split('=');
cfg[hash[0].trim()] = (hash[1] !== undefined) ? hash[1].trim() : undefined;
}
// for mmdb structures, pass the parameters after the first "&" sign
cfg.inpara = "&" + url.substr(ampPos + 1);
}
// changed some parameter names
cfg.rid = cfg.RID;
cfg.urlname = cfg.url;
if(cfg.urlname && cfg.urlname.indexOf('%3A%2F%2F') === -1) { // decoded URL
// should encode it
cfg.urlname = encodeURIComponent(cfg.urlname);
}
cfg.urltype = (cfg.type === undefined) ? 'pdb' : cfg.type;
cfg.version = getValue(cfg.v);
if(cfg.version !== undefined && window.localStorage && localStorage.getItem('fixedversion')) {
var fixedUrl = url.replace('full.html', 'full_' + cfg.version + '.html');
window.open(fixedUrl, '_self');
localStorage.removeItem('fixedversion');
}
// standardize the input values
for(var i in cfg) {
if(i == 'bu') {
cfg[i] = getInt(cfg[i]);
}
else {
cfg[i] = getValue(cfg[i]);
}
}
// backward compatible with showseq
cfg.showanno = cfg.showanno || cfg.showseq;
cfg.shownote = 1; //cfg.shownote;
cfg.options = (cfg.options !== undefined) ? JSON.parse(cfg.options) : undefined;
// default to show biological unit
if(cfg.bu === undefined) cfg.bu = 1; //0;
if(cfg.buidx !== undefined) cfg.bu = cfg.buidx;
return cfg;
}
function getValue(input) {
if(input == 'true' || input == '1') {
input = true;
}
else if(input == 'false' || input == '0') {
input = false;
}
return input;
}
function getInt(input) {
if(input == 'true' || input == '1') {
input = 1;
}
else if(input == 'false' || input == '0') {
input = 0;
}
return input;
}
}); // document ready
</script>
<!-- log & Google Analytics -->
<script type="text/javascript" src="https://www.ncbi.nlm.nih.gov/core/pinger/pinger.js"></script>
</body></html>