-
Notifications
You must be signed in to change notification settings - Fork 42
/
simple.html
180 lines (149 loc) · 5.67 KB
/
simple.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
<!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="simple">
<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_simple_ui_2.24.5.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.151.0.min.js"></script>
<script src="icn3d_simple_ui_2.24.5.min.js"></script>
<script type="text/javascript">
// separating the GET parameters from the current URL
if(document.URL.indexOf("?") === -1) {
alert("Please include '?pdbid=1GPK,2POR,...' in your url");
}
var getParams = document.URL.split("?");
// transforming the GET parameters into a dictionary
var search = getParams[getParams.length - 1];
//var params = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
var params = {};
var decodeSearch = decodeURIComponent(search);
var hashes = decodeSearch.split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0].trim()] = (hash[1] !== undefined) ? hash[1].trim() : undefined;
}
// for mmdb structures, pass the parameters after the first "&" sign
var inpara = "";
var ampPos = document.URL.indexOf("?");
if(ampPos !== -1) {
inpara = "&" + document.URL.substr(ampPos + 1);
}
var gi = params.gi;
var mmdbid = params.mmdbid;
var mmtfid = params.mmtfid;
var pdbid = params.pdbid;
var cid = params.cid;
var mmcifid = params.mmcifid;
var urlname = params.url;
var urltype = (params.type === undefined) ? 'pdb' : params.type;
var align = params.align;
var term = params.term;
var width = params.width;
var height = params.height;
if(width === undefined) width = '100%';
if(height === undefined) height = '100%';
var resize = params.resize;
if(resize === undefined || resize == 'true' || resize == '1') {
resize = true;
}
else if(resize == 'false' || resize == '0') {
resize = false;
}
var showmenu = params.showmenu;
if(showmenu === undefined || showmenu == 'true' || showmenu == '1') {
showmenu = true;
}
else if(showmenu == 'false' || showmenu == '0') {
showmenu = false;
}
var showtitle = params.showtitle;
if(showtitle === undefined || showtitle == 'true' || showtitle == '1') {
showtitle = true;
}
else if(showtitle == 'false' || showtitle == '0') {
showtitle = false;
}
var rotate = params.rotate;
if(rotate === undefined) {
rotate = 'right';
}
$( document ).ready(function() {
function setupViewer(idName, idValue) {
var maxStructure = 5; // show max 5 structures
var idArray = idValue.replace(/\s/g, '').split(',');
if(idArray.length > 1) {
//resize = false;
if(width.indexOf('%') != -1) {
width = 400;
height = 400;
}
}
var options = {};
//Options are available at: https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#DisplayOptions
//options['proteins'] = 'sphere';
for(var i = 0, il = idArray.length; i < il && i < maxStructure; ++i) {
var cfg = {
divid: 'div' + i,
inpara: inpara,
width: width,
height: height,
resize: resize,
rotate: rotate,
showmenu: showmenu,
showtitle: showtitle
};
cfg[idName] = idArray[i];
if(Object.keys(options).length > 0) cfg['options'] = options;
var icn3dui = new iCn3DUI(cfg);
icn3dui.show3DStructure();
}
}
if(mmtfid !== undefined) setupViewer('mmtfid', mmtfid);
if(pdbid !== undefined) setupViewer('pdbid', pdbid);
if(cid !== undefined) setupViewer('cid', cid);
if(mmcifid !== undefined) setupViewer('mmcifid', mmcifid);
if(mmdbid !== undefined) setupViewer('mmdbid', mmdbid);
if(gi !== undefined) setupViewer('gi', gi);
if(term !== undefined) setupViewer('term', term);
if(urlname !== undefined) {
urlname = decodeURIComponent(urlname);
setupViewer('url', urltype + '|' + urlname);
}
// e.g., align=103701,1,4,68563,1,167 [mmdbid1,biounit,molecule,mmdbid2,biounit,molecule]
if(align !== undefined) {
var cfg = {
divid: 'div0',
inpara: inpara,
width: width,
height: height,
resize: resize,
rotate: rotate,
align: align,
showmenu: showmenu,
showtitle: showtitle
};
var icn3dui = new iCn3DUI(cfg);
icn3dui.show3DStructure();
}
}); // document ready
</script>
<!-- log & Google Analytics -->
<script type="text/javascript" src="https://www.ncbi.nlm.nih.gov/core/pinger/pinger.js"></script>
</body>
</html>