Skip to content

Commit 9c883c6

Browse files
committed
Pull request #702: Enabled to input long PDB IDs starting with pdb_0000. Fixed sequence alignment view and camera viewpoint-related issues.
Merge in STRUC/icn3d from release3.45.3 to master * commit '870fe677db67b4149b979ea7b50f59a68d9b42e4': Enabled to input long PDB IDs starting with pdb_0000. Fixed sequence alignment view and camera viewpoint-related issues.
2 parents 60e3acf + 870fe67 commit 9c883c6

File tree

5 files changed

+1136
-0
lines changed

5 files changed

+1136
-0
lines changed

dist/full2_3.45.3.html

Lines changed: 368 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,368 @@
1+
<!DOCTYPE html><html lang="en"><head>
2+
<meta charset="utf-8">
3+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
4+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
5+
<meta name="description" content="iCn3D Structure Viewer">
6+
<meta name="keywords" content="NCBI, Structure, JavaScript, iCn3D, 3D, Viewer, WebGL, three.js, sequence, chemical">
7+
<meta name="robots" content="index,follow,noarchive">
8+
<meta name="ncbi_app" content="structure">
9+
<meta name="ncbi_pdid" content="icn3d">
10+
<meta name="ncbi_page" content="full2">
11+
<meta name="ncbi_pinger_xml_http_request_override" content="false"/>
12+
<meta name="ncbi_pinger_click_ping_selector" content="button, a, input[type=submit], span[data-pinger], div[data-pinger], label[data-pinger]"/>
13+
<title>iCn3D: Web-based 3D Structure Viewer</title>
14+
<script type="text/javascript">
15+
window.ncbi_startTime = new Date();
16+
</script>
17+
</head>
18+
<body>
19+
<div id="ncbi_logo" class="us" style="width:100%; height:40px; margin:-5px 0px 3px 0px;">
20+
<!--a class="skipnav" href="#maincontent">Skip to main page content</a-->
21+
<header class="ncbi-page-header" role="banner">
22+
<div style="background:initial; float:initial;">
23+
<span class="nih" title="National Center for Biotechnology Information">
24+
<a href="https://www.ncbi.nlm.nih.gov/" title="To NCBI homepage">
25+
<img style="padding:3px; height:30px" alt="NCBI"
26+
src="https://www.ncbi.nlm.nih.gov/coreutils/nwds/img/logos/AgencyLogo.svg">
27+
</a>
28+
</span>
29+
</div>
30+
</header>
31+
</div>
32+
<div id="div0" style="float:left; padding-right:5px;"></div>
33+
<div id="div1" style="float:left;"></div>
34+
35+
<link rel="stylesheet" href="lib/jquery-ui-1.13.2.min.css">
36+
<link rel="stylesheet" href="icn3d_3.45.3.css">
37+
<script src="lib/jquery-3.5.0.min.js"></script>
38+
<script src="lib/jquery-ui-1.13.2.min.js"></script>
39+
<!---script src="lib/three_0.151.0.min.js"></script-->
40+
<script src="icn3d_3.45.3.min.js"></script>
41+
42+
<script type="text/javascript">
43+
$( document ).ready(async function() {
44+
if (navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // If Internet Explorer
45+
// iCn3D version 2.24.7 doesn't work with three_0.128.0.min.js
46+
//$.getScript('icn3d_full_ui_2.24.7.min.js', function() {
47+
// var version = 2;
48+
// launchIcn3d(version);
49+
//});
50+
51+
var fixedUrl = document.URL.replace('full2.html', 'full2_2.24.7.html');
52+
window.open(fixedUrl, '_self');
53+
54+
alert("IE does NOT work with the current iCn3D version 3. The old iCn3D version 2 is used instead.");
55+
}
56+
else {
57+
//$.getScript('icn3d_3.45.3.min.js', function() {
58+
var version = 3;
59+
await launchIcn3d(version);
60+
//});
61+
}
62+
63+
async function launchIcn3d(version) {
64+
// use the FIXED name "icn3duiHash" for side-by-side view
65+
window.icn3duiHash = {};
66+
67+
var cfg = getConfig();
68+
cfg.version = version;
69+
70+
if(cfg.bcifid !== undefined) {
71+
await setupViewer('bcifid', cfg.bcifid, cfg);
72+
}
73+
else if(cfg.mmtfid !== undefined) {
74+
await setupViewer('mmtfid', cfg.mmtfid, cfg);
75+
}
76+
else if(cfg.pdbid !== undefined) {
77+
await setupViewer('pdbid', cfg.pdbid, cfg);
78+
}
79+
else if(cfg.afid !== undefined) {
80+
await setupViewer('afid', cfg.afid, cfg);
81+
}
82+
else if(cfg.opmid !== undefined) {
83+
await setupViewer('opmid', cfg.opmid, cfg);
84+
}
85+
else if(cfg.cid !== undefined) {
86+
await setupViewer('cid', cfg.cid, cfg);
87+
}
88+
else if(cfg.mmcifid !== undefined) {
89+
await setupViewer('mmcifid', cfg.mmcifid, cfg);
90+
}
91+
else if(cfg.mmdbid !== undefined) {
92+
await setupViewer('mmdbid', cfg.mmdbid, cfg);
93+
}
94+
else if(cfg.gi !== undefined) {
95+
await setupViewer('gi', cfg.gi, cfg);
96+
}
97+
else if(cfg.blast_rep_id !== undefined) {
98+
if( (from === 'blast' || from === 'icn3d') && command == '') {
99+
command = 'view+annotations;+set+annotation+cdd;+set+annotation+site;+set+view+detailed+view;+select+chain+'
100+
+ cfg.blast_rep_id + ';+show+selection';
101+
}
102+
103+
await setupViewer('blast_rep_id', cfg.blast_rep_id, cfg);
104+
}
105+
else if(cfg.urlname !== undefined) {
106+
var urlname = decodeURIComponent(cfg.urlname);
107+
await setupViewer('url', cfg.urltype + '|' + urlname, cfg);
108+
}
109+
// e.g., align=103701,1,4,68563,1,167 [mmdbid1,biounit,molecule,mmdbid2,biounit,molecule]
110+
else if(cfg.align !== undefined) {
111+
cfg.width = '49%'; //width,
112+
cfg.mobilemenu = true; //mobilemenu,
113+
cfg.closepopup = true; //closepopup,
114+
cfg.controlGl = true;
115+
cfg.bSidebyside = true;
116+
117+
cfg.divid = 'div0';
118+
cfg.align = cfg.align;
119+
cfg.showalignseq = cfg.showalignseq;
120+
121+
// VAST+ uses biological units
122+
cfg.bu = 1;
123+
124+
cfg.idname = 'align';
125+
cfg.idvalue = cfg.align;
126+
127+
var icn3dui = new icn3d.iCn3DUI(cfg);
128+
window.icn3duiHash['div0'] = icn3dui;
129+
await icn3dui.show3DStructure();
130+
131+
var cfg2 = cfg;
132+
cfg2.divid = 'div1';
133+
var icn3dui2 = new icn3d.iCn3DUI(cfg2);
134+
window.icn3duiHash['div1'] = icn3dui2;
135+
await icn3dui2.show3DStructure();
136+
}
137+
else if(cfg.chainalign !== undefined || cfg.mmdbafid !== undefined) {
138+
cfg.width = '49%'; //width,
139+
cfg.mobilemenu = true; //mobilemenu,
140+
cfg.closepopup = true; //closepopup,
141+
cfg.controlGl = true;
142+
cfg.bSidebyside = true;
143+
144+
cfg.divid = 'div0';
145+
//cfg.chainalign = cfg.chainalign;
146+
//cfg.resnum = cfg.resnum;
147+
//cfg.showalignseq = cfg.showalignseq;
148+
149+
if(cfg.chainalign !== undefined) {
150+
cfg.idname = 'chainalign';
151+
cfg.idvalue = cfg.chainalign;
152+
}
153+
else {
154+
cfg.idname = 'mmdbafid';
155+
cfg.idvalue = cfg.mmdbafid;
156+
}
157+
158+
var icn3dui = new icn3d.iCn3DUI(cfg);
159+
window.icn3duiHash['div0'] = icn3dui;
160+
await icn3dui.show3DStructure();
161+
162+
var cfg2 = cfg;
163+
cfg2.divid = 'div1';
164+
var icn3dui2 = new icn3d.iCn3DUI(cfg2);
165+
window.icn3duiHash['div1'] = icn3dui2;
166+
await icn3dui2.show3DStructure();
167+
}
168+
else {
169+
await setupViewer('', '', cfg);
170+
}
171+
}
172+
173+
async function setupViewer(idName, idValue, cfg) {
174+
cfg.idname = idName;
175+
cfg.idvalue = idValue;
176+
177+
var maxStructure = 5; // show max 5 structures
178+
179+
var idArray = idValue.replace(/\s/g, '').split(',');
180+
181+
//if(idArray.length > 1) {
182+
cfg.resize = false;
183+
184+
if(cfg.width && cfg.width.indexOf('%') != -1) {
185+
cfg.width = 400;
186+
cfg.height = 400;
187+
}
188+
//}
189+
190+
//for(var i = 0, il = idArray.length; i < il && i < maxStructure; ++i) {
191+
var i = 0;
192+
cfg.divid = 'div' + i;
193+
cfg.width = '49%'; //width,
194+
cfg.mobilemenu = true; //mobilemenu,
195+
cfg.closepopup = true; //closepopup,
196+
cfg.controlGl = true;
197+
cfg.bSidebyside = true;
198+
199+
if(idName !== '') cfg[idName] = idArray[i];
200+
201+
var icn3dui = new icn3d.iCn3DUI(cfg);
202+
window.icn3duiHash['div0'] = icn3dui;
203+
await icn3dui.show3DStructure();
204+
if(idName === '') $("#div" + i + "_wait").hide();
205+
206+
i = 1;
207+
var cfg2 = cfg;
208+
cfg2.divid = 'div' + i;
209+
var icn3dui2 = new icn3d.iCn3DUI(cfg2);
210+
window.icn3duiHash['div1'] = icn3dui2;
211+
await icn3dui2.show3DStructure();
212+
if(idName === '') $("#div" + i + "_wait").hide();
213+
//}
214+
}
215+
216+
function getConfig() {
217+
// separating the GET parameters from the current URL
218+
// repalce "color #" with "color " in the url
219+
var url = document.URL.replace(/\#/g, '');
220+
221+
var bNopara = false;
222+
var ampPos = url.indexOf("?");
223+
if(ampPos === -1) {
224+
// alert("Please include '?pdbid=1GPK,2POR,...' in your url");
225+
bNopara = true;
226+
}
227+
228+
var params = url.split("?");
229+
// transforming the GET parameters into a dictionary
230+
var search = params[params.length - 1];
231+
232+
var cfg = {};
233+
234+
if(!bNopara) {
235+
var decodeSearch = decodeURIComponent(search).replace(/\+/g, ' ');
236+
search = search.replace(/\+/g, ' ');
237+
238+
// command could contains '&', for example when loading statefile 'load mmdb 1kq2 | parameters &atype=1'
239+
var commandPos = decodeSearch.indexOf('&command=');
240+
if(commandPos != -1) {
241+
cfg.command = decodeSearch.substr(commandPos + 9); // ";" separated commands
242+
decodeSearch = decodeSearch.substr(0, commandPos);
243+
search = search.substr(0, commandPos);
244+
245+
var paraPos = decodeSearch.indexOf(' | parameters ');
246+
247+
if(paraPos != -1) { //When loading statefile (e.g., 'load mmdb 1kq2 | parameters &atype=1'), the commands ends with '}}'.
248+
var tmpPos = cfg.command.indexOf('}}&');
249+
if(tmpPos != -1) { // more parameters after the command
250+
decodeSearch += cfg.command.substr(tmpPos + 2);
251+
search += cfg.command.substr(tmpPos + 2);
252+
cfg.command = cfg.command.substr(0, tmpPos + 2);
253+
}
254+
}
255+
else {
256+
var paraPos = cfg.command.indexOf(' | parameters ');
257+
258+
if(paraPos != -1) { // "&command=load mmdb 7DDD | parameters &mmdbid=7DDD; select..." the commands ends with '}}'.
259+
var tmpPos = cfg.command.indexOf('}}&');
260+
if(tmpPos != -1) { // more parameters after the command
261+
decodeSearch += cfg.command.substr(tmpPos + 2);
262+
search += cfg.command.substr(tmpPos + 2);
263+
cfg.command = cfg.command.substr(0, tmpPos + 2);
264+
}
265+
}
266+
else {
267+
var tmpPos = cfg.command.indexOf('&');
268+
if(tmpPos != -1) {
269+
decodeSearch += cfg.command.substr(tmpPos);
270+
search += cfg.command.substr(tmpPos);
271+
cfg.command = cfg.command.substr(0, tmpPos);
272+
}
273+
}
274+
}
275+
}
276+
else {
277+
cfg.command = '';
278+
}
279+
280+
// var hashes = decodeSearch.split('&');
281+
var hashes = search.split('&');
282+
var decodeHashes = decodeSearch.split('&');
283+
for (var i = 0; i < hashes.length; i++) {
284+
var hash = hashes[i].split('=');
285+
if(hash[0].trim() == 'smiles') {
286+
cfg[hash[0].trim()] = (hash[1] !== undefined) ? hash[1].trim() : undefined;
287+
}
288+
else {
289+
var decodeHash = decodeHashes[i].split('=');
290+
cfg[decodeHash[0].trim()] = (decodeHash[1] !== undefined) ? decodeHash[1].trim() : undefined;
291+
}
292+
}
293+
294+
// for mmdb structures, pass the parameters after the first "&" sign
295+
cfg.inpara = "&" + url.substr(ampPos + 1);
296+
}
297+
298+
// changed some parameter names
299+
cfg.rid = cfg.RID;
300+
301+
cfg.urlname = cfg.url;
302+
if(cfg.urlname && cfg.urlname.indexOf('%3A%2F%2F') === -1) { // decoded URL
303+
// should encode it
304+
cfg.urlname = encodeURIComponent(cfg.urlname);
305+
}
306+
cfg.urltype = (cfg.type === undefined) ? 'pdb' : cfg.type;
307+
308+
cfg.version = getValue(cfg.v);
309+
310+
if(cfg.version !== undefined && window.localStorage && localStorage.getItem('fixedversion')) {
311+
var fixedUrl = url.replace('full.html', 'full_' + cfg.version + '.html');
312+
window.open(fixedUrl, '_self');
313+
314+
localStorage.removeItem('fixedversion');
315+
}
316+
317+
// standardize the input values
318+
for(var i in cfg) {
319+
if(i == 'bu') {
320+
cfg[i] = getInt(cfg[i]);
321+
}
322+
else {
323+
cfg[i] = getValue(cfg[i]);
324+
}
325+
}
326+
327+
// backward compatible with showseq
328+
cfg.showanno = cfg.showanno || cfg.showseq;
329+
330+
cfg.shownote = 1; //cfg.shownote;
331+
cfg.options = (cfg.options !== undefined) ? JSON.parse(cfg.options) : undefined;
332+
333+
// default to show biological unit
334+
if(cfg.bu === undefined) cfg.bu = 1; //0;
335+
if(cfg.buidx !== undefined) cfg.bu = cfg.buidx;
336+
337+
return cfg;
338+
}
339+
340+
function getValue(input) {
341+
if(input == 'true') { // || input == '1') {
342+
input = true;
343+
}
344+
else if(input == 'false') { // || input == '0') {
345+
input = false;
346+
}
347+
348+
return input;
349+
}
350+
351+
function getInt(input) {
352+
if(input == 'true' || input == '1') {
353+
input = 1;
354+
}
355+
else if(input == 'false' || input == '0') {
356+
input = 0;
357+
}
358+
359+
return input;
360+
}
361+
}); // document ready
362+
363+
</script>
364+
365+
<!-- log & Google Analytics -->
366+
<script type="text/javascript" src="https://www.ncbi.nlm.nih.gov/core/pinger/pinger.js"></script>
367+
</body></html>
368+

0 commit comments

Comments
 (0)