icn3d 3.31.13 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/icn3d.js +1048 -793
  2. package/icn3d.min.js +5 -5
  3. package/icn3d.module.js +1048 -793
  4. package/package.json +1 -1
package/icn3d.js CHANGED
@@ -9018,7 +9018,7 @@ class ClickMenu {
9018
9018
  });
9019
9019
 
9020
9020
  me.myEventCls.onIds("#" + me.pre + "mn1_mmciffile", "click", function(e) { me.icn3d; //e.preventDefault();
9021
- me.htmlCls.dialogCls.openDlg('dl_mmciffile', 'Please input mmCIF File');
9021
+ me.htmlCls.dialogCls.openDlg('dl_mmciffile', 'Please append mmCIF File');
9022
9022
  });
9023
9023
 
9024
9024
  me.myEventCls.onIds("#" + me.pre + "mn1_mmcifid", "click", function(e) { me.icn3d; //e.preventDefault();
@@ -11684,7 +11684,7 @@ class SetMenu {
11684
11684
  // html += this.getLink('mn1_pdbfile', 'PDB File');
11685
11685
  // html += this.getLink('mn1_pdbfile_app', 'PDB File (append)');
11686
11686
  html += this.getLink('mn1_pdbfile_app', 'PDB Files (appendable)', 1, 2);
11687
- html += this.getLink('mn1_mmciffile', 'mmCIF File', undefined, 2);
11687
+ html += this.getLink('mn1_mmciffile', 'mmCIF File (appendable)', undefined, 2);
11688
11688
  html += this.getLink('mn1_mol2file', 'Mol2 File', undefined, 2);
11689
11689
  html += this.getLink('mn1_sdffile', 'SDF File', undefined, 2);
11690
11690
  html += this.getLink('mn1_xyzfile', 'XYZ File', undefined, 2);
@@ -14028,8 +14028,8 @@ class SetDialog {
14028
14028
  html += "</div>";
14029
14029
 
14030
14030
  html += me.htmlCls.divStr + "dl_mmciffile' class='" + dialogClass + "'>";
14031
- html += this.addNotebookTitle('dl_mmciffile', 'Please input an mmCIF file');
14032
- html += "mmCIF File: " + me.htmlCls.inputFileStr + "id='" + me.pre + "mmciffile' value='1TUP' size=8> ";
14031
+ html += this.addNotebookTitle('dl_mmciffile', 'Please append mmCIF files');
14032
+ html += "Multiple mmCIF Files: <input type='file' multiple id='" + me.pre + "mmciffile' size=8> ";
14033
14033
  html += me.htmlCls.buttonStr + "reload_mmciffile'>Load</button>";
14034
14034
  html += "</div>";
14035
14035
 
@@ -15284,17 +15284,15 @@ class Events {
15284
15284
  }
15285
15285
  }
15286
15286
 
15287
- async readFile(bAppend, files, index, dataStrAll) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
15287
+ async readFile(bAppend, files, index, dataStrAll, bmmCIF) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
15288
15288
  let file = files[index];
15289
15289
  let commandName = (bAppend) ? 'append': 'load';
15290
+ commandName += (bmmCIF) ? ' mmcif file ': ' pdb file ';
15290
15291
 
15291
15292
  let reader = new FileReader();
15292
15293
  reader.onload = async function(e) {
15293
- //++ic.loadedFileCnt;
15294
-
15295
15294
  let dataStr = e.target.result; // or = reader.result;
15296
- //thisClass.setLogCmd(commandName + ' pdb file ' + $("#" + me.pre + fileId).val(), false);
15297
- thisClass.setLogCmd(commandName + ' pdb file ' + file.name, false);
15295
+ thisClass.setLogCmd(commandName + file.name, false);
15298
15296
 
15299
15297
  if(!bAppend) {
15300
15298
  ic.init();
@@ -15308,7 +15306,7 @@ class Events {
15308
15306
  }
15309
15307
 
15310
15308
  ic.bInputfile = true;
15311
- ic.InputfileType = 'pdb';
15309
+ ic.InputfileType = (bmmCIF) ? 'mmcif' : 'pdb';
15312
15310
  ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + dataStr : dataStr;
15313
15311
 
15314
15312
  dataStrAll = (index > 0) ? dataStrAll + '\nENDMDL\n' + dataStr : dataStr;
@@ -15318,15 +15316,21 @@ class Events {
15318
15316
  ic.hAtoms = {};
15319
15317
  ic.dAtoms = {};
15320
15318
  }
15321
- await ic.pdbParserCls.loadPdbData(dataStrAll, undefined, undefined, bAppend);
15319
+ if(bmmCIF) {
15320
+ await ic.mmcifParserCls.loadMultipleMmcifData(dataStrAll, undefined, bAppend);
15321
+ }
15322
+ else {
15323
+ await ic.pdbParserCls.loadPdbData(dataStrAll, undefined, undefined, bAppend);
15324
+ }
15325
+
15326
+ //ic.InputfileType = undefined; // reset
15322
15327
  }
15323
15328
  else {
15324
- await thisClass.readFile(bAppend, files, index + 1, dataStrAll);
15329
+ await thisClass.readFile(bAppend, files, index + 1, dataStrAll, bmmCIF);
15325
15330
  }
15326
15331
 
15327
15332
  if(bAppend) {
15328
15333
  if(ic.bSetChainsAdvancedMenu) ic.definedSetsCls.showSets();
15329
- //if(ic.bSetChainsAdvancedMenu) ic.legendTableCls.showSets();
15330
15334
 
15331
15335
  ic.bResetAnno = true;
15332
15336
 
@@ -15343,9 +15347,7 @@ class Events {
15343
15347
  }
15344
15348
  }
15345
15349
 
15346
- async loadPdbFile(bAppend) { let me = this.icn3dui, ic = me.icn3d;
15347
- let fileId = (bAppend) ? 'pdbfile_app' : 'pdbfile';
15348
-
15350
+ async loadPdbFile(bAppend, fileId, bmmCIF) { let me = this.icn3dui, ic = me.icn3d;
15349
15351
  //me = ic.setIcn3dui(this.id);
15350
15352
  ic.bInitial = true;
15351
15353
  if(!me.cfg.notebook) dialog.dialog( "close" );
@@ -15369,7 +15371,7 @@ class Events {
15369
15371
 
15370
15372
  ic.dataStrAll = '';
15371
15373
 
15372
- await this.readFile(bAppend, files, 0, '');
15374
+ await this.readFile(bAppend, files, 0, '', bmmCIF);
15373
15375
  }
15374
15376
  }
15375
15377
 
@@ -16726,14 +16728,14 @@ class Events {
16726
16728
  e.preventDefault();
16727
16729
 
16728
16730
  let bAppend = false;
16729
- await thisClass.loadPdbFile(bAppend);
16731
+ await thisClass.loadPdbFile(bAppend, 'pdbfile');
16730
16732
  });
16731
16733
 
16732
16734
  me.myEventCls.onIds("#" + me.pre + "reload_pdbfile_app", "click", async function(e) { let ic = me.icn3d;
16733
16735
  e.preventDefault();
16734
16736
 
16735
16737
  ic.bAppend = true;
16736
- await thisClass.loadPdbFile(ic.bAppend);
16738
+ await thisClass.loadPdbFile(ic.bAppend, 'pdbfile_app');
16737
16739
  });
16738
16740
 
16739
16741
  me.myEventCls.onIds("#" + me.pre + "reload_mol2file", "click", function(e) { let ic = me.icn3d;
@@ -16917,49 +16919,13 @@ class Events {
16917
16919
  await ic.pdbParserCls.downloadUrl(url, type);
16918
16920
  });
16919
16921
 
16920
- me.myEventCls.onIds("#" + me.pre + "reload_mmciffile", "click", function(e) { let ic = me.icn3d;
16922
+ me.myEventCls.onIds("#" + me.pre + "reload_mmciffile", "click", async function(e) { let ic = me.icn3d;
16921
16923
  e.preventDefault();
16922
- ic.bInitial = true;
16923
- if(!me.cfg.notebook) dialog.dialog( "close" );
16924
- //close all dialog
16925
- if(!me.cfg.notebook) {
16926
- $(".ui-dialog-content").dialog("close");
16927
- }
16928
- else {
16929
- ic.resizeCanvasCls.closeDialogs();
16930
- }
16931
- let file = $("#" + me.pre + "mmciffile")[0].files[0];
16932
- if(!file) {
16933
- var aaa = 1; //alert("Please select a file before clicking 'Load'");
16934
- }
16935
- else {
16936
- me.htmlCls.setHtmlCls.fileSupport();
16937
- let reader = new FileReader();
16938
- reader.onload = async function(e) {
16939
- let dataStr = e.target.result; // or = reader.result;
16940
- thisClass.setLogCmd('load mmcif file ' + $("#" + me.pre + "mmciffile").val(), false);
16941
- ic.molTitle = "";
16942
-
16943
- // let url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
16944
- // //ic.bCid = undefined;
16945
16924
 
16946
- // let dataObj = {'mmciffile': dataStr};
16947
- // let data = await me.getAjaxPostPromise(url, dataObj, true);
16948
-
16949
- let bText = true;
16950
- // let bcifData = ic.bcifParserCls.getBcifJson(dataStr, undefined, bText);
16951
- // let data = JSON.parse(bcifData);
16952
-
16953
- //ic.initUI();
16954
- ic.init();
16955
- ic.bInputfile = true;
16956
- ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + data : dataStr;
16957
- ic.InputfileType = 'mmcif';
16958
- // await ic.mmcifParserCls.loadMmcifData(data);
16959
- await ic.opmParserCls.loadOpmData(dataStr, undefined, undefined, 'mmcif', undefined, bText);
16960
- };
16961
- reader.readAsText(file);
16962
- }
16925
+ ic.bAppend = true;
16926
+ let bmmCIF = true;
16927
+ let fileId = 'mmciffile';
16928
+ await thisClass.loadPdbFile(ic.bAppend, fileId, bmmCIF);
16963
16929
  });
16964
16930
 
16965
16931
  me.myEventCls.onIds("#" + me.pre + "applycustomcolor", "click", function(e) { let ic = me.icn3d;
@@ -39949,9 +39915,24 @@ class AnnoCddSite {
39949
39915
  pssmid2toArray = {};
39950
39916
  }
39951
39917
 
39952
- let indexl =(domainArray !== undefined) ? domainArray.length : 0;
39918
+ if(domainArray === undefined) domainArray = [];
39919
+ let indexl = domainArray.length;
39953
39920
  let maxTextLen =(type == 'domain') ? 14 : 19;
39954
39921
  let titleSpace =(type == 'domain') ? 100 : 120;
39922
+
39923
+ // sort domainArray
39924
+ domainArray.sort(function(a, b) {
39925
+ let domainRepeatArray = a.locs;
39926
+ let segArray = (type == 'domain' || type == 'ig') ? domainRepeatArray[0].segs : [domainRepeatArray[0]];
39927
+ let domainFrom1 = Math.round(segArray[0].from);
39928
+
39929
+ domainRepeatArray = b.locs;
39930
+ segArray = (type == 'domain' || type == 'ig') ? domainRepeatArray[0].segs : [domainRepeatArray[0]];
39931
+ let domainFrom2 = Math.round(segArray[0].from);
39932
+
39933
+ return domainFrom1 - domainFrom2;
39934
+ });
39935
+
39955
39936
  for(let index = 0; index < indexl; ++index) {
39956
39937
  let pssmid = (type == 'domain') ? domainArray[index].pssmid : 0;
39957
39938
 
@@ -40820,6 +40801,7 @@ class AnnoIg {
40820
40801
  async showIg(chnid, template) { let ic = this.icn3d; ic.icn3dui;
40821
40802
  // if(!ic.bRunRefnum || Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
40822
40803
  if(ic.bRunRefnumAgain) {
40804
+ // run for all chains
40823
40805
  await ic.refnumCls.showIgRefNum(template);
40824
40806
  // ic.bRunRefnum = true;
40825
40807
  }
@@ -41477,9 +41459,7 @@ class AnnoDomain {
41477
41459
 
41478
41460
  let result = ic.domain3dCls.c2b_NewSplitChain(atoms);
41479
41461
  let subdomains = result.subdomains;
41480
- let pos2resi = result.pos2resi;
41481
- //let substruct = result.substruct;
41482
- //let jsonStr = ic.domain3dCls.getDomainJsonForAlign(atoms);
41462
+ // let pos2resi = result.pos2resi;
41483
41463
 
41484
41464
  for(let i = 0, il = subdomains.length; i < il; ++i) {
41485
41465
  // domain item: {"sdid":1722375,"intervals":[[1,104],[269,323]]}
@@ -41493,7 +41473,7 @@ class AnnoDomain {
41493
41473
  data.domains[chainid].domains.push(domain);
41494
41474
  }
41495
41475
 
41496
- data.domains[chainid].pos2resi = pos2resi;
41476
+ // data.domains[chainid].pos2resi = pos2resi;
41497
41477
  }
41498
41478
  }
41499
41479
 
@@ -41526,11 +41506,26 @@ class AnnoDomain {
41526
41506
  this.showDomainPerStructure(i);
41527
41507
  }
41528
41508
  }
41509
+
41510
+ getResiFromNnbiresid(ncbiresid) { let ic = this.icn3d; ic.icn3dui;
41511
+ let resid = (ic.ncbi2resid[ncbiresid]) ? ic.ncbi2resid[ncbiresid] : ncbiresid;
41512
+ let resi = resid.substr(resid.lastIndexOf('_') + 1);
41513
+
41514
+ return resi;
41515
+ }
41516
+
41517
+ getNcbiresiFromResid(resid) { let ic = this.icn3d; ic.icn3dui;
41518
+ let ncbiresid = (ic.resid2ncbi[resid]) ? ic.resid2ncbi[resid] : resid;
41519
+ let resi = ncbiresid.substr(ncbiresid.lastIndexOf('_') + 1);
41520
+
41521
+ return resi;
41522
+ }
41523
+
41529
41524
  showDomainWithData(chnid, data, bCalcDirect) { let ic = this.icn3d, me = ic.icn3dui;
41530
41525
  let html = '<div id="' + ic.pre + chnid + '_domainseq_sequence" class="icn3d-dl_sequence">';
41531
41526
  let html2 = html;
41532
41527
  let html3 = html;
41533
- let domainArray, pos2resi, proteinname;
41528
+ let domainArray, proteinname;
41534
41529
  let pos = chnid.indexOf('_');
41535
41530
  let chain = chnid.substr(pos + 1);
41536
41531
  // MMDB symmetry chain has the form of 'A1'
@@ -41541,7 +41536,7 @@ class AnnoDomain {
41541
41536
  // if(bCalcDirect) {
41542
41537
  proteinname = chnid;
41543
41538
  domainArray = (data.domains[chnid]) ? data.domains[chnid].domains : [];
41544
- pos2resi = data.domains[chnid].pos2resi;
41539
+ // pos2resi = data.domains[chnid].pos2resi;
41545
41540
  /*
41546
41541
  }
41547
41542
  else {
@@ -41569,40 +41564,33 @@ class AnnoDomain {
41569
41564
  let title =(fulltitle.length > 17) ? fulltitle.substr(0,17) + '...' : fulltitle;
41570
41565
  let subdomainArray = domainArray[index].intervals;
41571
41566
  // remove duplicate, e.g., at https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=1itw
41572
- let domainFromHash = {}, domainToHash = {};
41573
- let fromArray = [], toArray = [], posFromArray = [], posToArray = [];
41567
+ // let domainFromHash = {}, domainToHash = {};
41568
+ let fromArray = [], toArray = []; // posFromArray = [], posToArray = [];
41574
41569
  let resiHash = {};
41575
41570
  let resCnt = 0;
41576
41571
 
41572
+ // subdomainArray contains NCBI residue number
41577
41573
  for(let i = 0, il = subdomainArray.length; i < il; ++i) {
41578
- let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
41579
- let domainTo = Math.round(subdomainArray[i][1]) - 1;
41574
+ // let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
41575
+ // let domainTo = Math.round(subdomainArray[i][1]) - 1;
41580
41576
 
41581
- if(domainFromHash.hasOwnProperty(domainFrom) || domainToHash.hasOwnProperty(domainTo)) {
41582
- continue; // do nothing for duplicated "from" or "to", e.g, PDBID 1ITW, 5FWI
41583
- }
41584
- else {
41585
- domainFromHash[domainFrom] = 1;
41586
- domainToHash[domainTo] = 1;
41587
- }
41577
+ let domainFrom = parseInt(subdomainArray[i][0]);
41578
+ let domainTo = parseInt(subdomainArray[i][1]);
41588
41579
 
41589
- // use the NCBI residue number, and convert to PDB residue number during selection
41590
- // if(ic.bNCBI || bCalcDirect) {
41591
- fromArray.push(pos2resi[domainFrom]);
41592
- toArray.push(pos2resi[domainTo]);
41593
41580
 
41594
- posFromArray.push(domainFrom);
41595
- posToArray.push(domainTo);
41596
- // }
41597
- // else {
41598
- // fromArray.push(domainFrom + ic.baseResi[chnid]);
41599
- // toArray.push(domainTo + ic.baseResi[chnid]);
41600
- // }
41581
+ // fromArray.push(pos2resi[domainFrom]);
41582
+ // toArray.push(pos2resi[domainTo]);
41583
+
41584
+ fromArray.push(domainFrom);
41585
+ toArray.push(domainTo);
41586
+
41587
+ // posFromArray.push(domainFrom);
41588
+ // posToArray.push(domainTo);
41601
41589
 
41602
41590
  resCnt += domainTo - domainFrom + 1;
41603
41591
  for(let j = domainFrom; j <= domainTo; ++j) {
41604
- // resiHash[j+1] = 1;
41605
- let resi = pos2resi[j];
41592
+ // let resi = pos2resi[j];
41593
+ let resi = this.getResiFromNnbiresid(chnid + '_' + j);
41606
41594
  resiHash[resi] = 1;
41607
41595
  }
41608
41596
  }
@@ -41613,21 +41601,22 @@ class AnnoDomain {
41613
41601
 
41614
41602
  if(!ic.resid2domain) ic.resid2domain = {};
41615
41603
  if(!ic.resid2domain[chnid]) ic.resid2domain[chnid] = [];
41616
- for(let i = 0, il = posFromArray.length; i < il; ++i) {
41617
- let from = parseInt(posFromArray[i]);
41618
- let to = parseInt(posToArray[i]);
41604
+ // for(let i = 0, il = posFromArray.length; i < il; ++i) {
41605
+ for(let i = 0, il = fromArray.length; i < il; ++i) {
41606
+ let from = fromArray[i];
41607
+ let to = toArray[i];
41619
41608
  for(let j = from; j <= to; ++j) {
41620
41609
  // 0-based
41621
41610
  let obj = {};
41622
41611
  // let resi = ic.ParserUtilsCls.getResi(chnid, j);
41623
- let resi = pos2resi[j];
41624
- obj[chnid + '_' + resi] = domainName;
41612
+ let resid = ic.ncbi2resid(chnid + '_' + j);
41613
+ obj[resid] = domainName;
41625
41614
  ic.resid2domain[chnid].push(obj);
41626
41615
  }
41627
41616
  }
41628
41617
  }
41629
41618
 
41630
- let htmlTmp2 = '<div class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + posFromArray + '" to="' + posToArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + chnid + '_3d_domain_' +(index+1).toString() + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">' + title + ' </div>';
41619
+ let htmlTmp2 = '<div class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + fromArray + '" to="' + toArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + chnid + '_3d_domain_' +(index+1).toString() + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">' + title + ' </div>';
41631
41620
  let htmlTmp3 = '<span class="icn3d-residueNum" title="residue count">' + resCnt.toString() + ' Res</span>';
41632
41621
  html3 += htmlTmp2 + htmlTmp3 + '<br>';
41633
41622
  let htmlTmp = '<span class="icn3d-seqLine">';
@@ -41667,12 +41656,12 @@ class AnnoDomain {
41667
41656
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
41668
41657
 
41669
41658
  if(me.cfg.blast_rep_id != chnid) { // regular
41670
- for(let i = 0, il = posFromArray.length; i < il; ++i) {
41659
+ for(let i = 0, il = fromArray.length; i < il; ++i) {
41671
41660
  // let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i] - ic.baseResi[chnid] - 1) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
41672
- let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(posFromArray[i]) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(posFromArray[i] - posToArray[i-1] - 1) / ic.maxAnnoLength);
41661
+ let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i]) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
41673
41662
 
41674
41663
  html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
41675
- html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(posToArray[i] - posFromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + posFromArray + '" to="' + posToArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + chnid + '_3d_domain_' +(index+1).toString() + '" id="' + chnid + '_3d_domain_' + index + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">3D domain ' +(index+1).toString() + '</div>';
41664
+ html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(toArray[i] - fromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + fromArray + '" to="' + toArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + chnid + '_3d_domain_' +(index+1).toString() + '" id="' + chnid + '_3d_domain_' + index + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">3D domain ' +(index+1).toString() + '</div>';
41676
41665
  }
41677
41666
  }
41678
41667
  else { // with potential gaps
@@ -43184,6 +43173,7 @@ class Domain3d {
43184
43173
  //c2b_NewSplitChain(string asymId, let seqLen, let* x0, let* y0, let* z0) { let ic = this.icn3d, me = ic.icn3dui;
43185
43174
  // x0, y0, z0: array of x,y,z coordinates of C-alpha atoms
43186
43175
  //c2b_NewSplitChain(chnid, dcut) { let ic = this.icn3d, me = ic.icn3dui;
43176
+ // this function works for a single chain
43187
43177
  c2b_NewSplitChain(atoms, dcut) { let ic = this.icn3d; ic.icn3dui;
43188
43178
  this.init3ddomain();
43189
43179
 
@@ -43239,14 +43229,11 @@ class Domain3d {
43239
43229
  // pos2resi[i+1] = resi;
43240
43230
  pos2resi[i] = resi;
43241
43231
 
43242
- ic.posid2resid[atom.structure + '_' + atom.chain + '_' + (i+1).toString()] = resid;
43243
- // let residNCBI = ic.resid2ncbi[resid];
43244
- // let pos = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
43245
- // pos2resi[pos] = resi;
43246
-
43232
+ // ic.posid2resid[atom.structure + '_' + atom.chain + '_' + (i+1).toString()] = resid;
43247
43233
  if(atom.ssend) {
43248
43234
  //substructItem.To = parseInt(resi);
43249
43235
  substructItem.To = i + 1;
43236
+ // substructItem.To = ic.annoDomainCls.getNcbiresiFromResid(resid);
43250
43237
  substructItem.x2 = atom.coord.x;
43251
43238
  substructItem.y2 = atom.coord.y;
43252
43239
  substructItem.z2 = atom.coord.z;
@@ -43261,6 +43248,7 @@ class Domain3d {
43261
43248
  if(atom.ssbegin) {
43262
43249
  //substructItem.From = parseInt(resi);
43263
43250
  substructItem.From = i + 1;
43251
+ // substructItem.From = ic.annoDomainCls.getNcbiresiFromResid(resid);
43264
43252
  substructItem.x1 = atom.coord.x;
43265
43253
  substructItem.y1 = atom.coord.y;
43266
43254
  substructItem.z1 = atom.coord.z;
@@ -43268,17 +43256,19 @@ class Domain3d {
43268
43256
  }
43269
43257
 
43270
43258
  let nsse = substruct.length;
43271
-
43272
- if (nsse <= 3)
43259
+
43260
+ if (nsse <= 3) {
43273
43261
  // too small, can't split or trim
43274
- return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi};
43262
+ substruct = this.standardizeSubstruct(chnid, substruct, pos2resi);
43263
+ return {subdomains: subdomains, substruct: substruct};
43264
+ }
43275
43265
 
43276
43266
  if (nsse > this.MAX_SSE) {
43277
43267
  // we have a problem...
43278
-
43279
- return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi};
43268
+ substruct = this.standardizeSubstruct(chnid, substruct, pos2resi);
43269
+ return {subdomains: subdomains, substruct: substruct};
43280
43270
  }
43281
-
43271
+
43282
43272
  let seqLen = residueArray.length; // + resiOffset;
43283
43273
  //let lastResi = resiArray[seqLen - 1];
43284
43274
  let lastResi = seqLen;
@@ -43599,7 +43589,8 @@ class Domain3d {
43599
43589
  let k = prts[i] - 1;
43600
43590
 
43601
43591
  if ((k < 0) || (k >= substruct.length)) {
43602
- return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi};
43592
+ substruct = this.standardizeSubstruct(chnid, substruct, pos2resi);
43593
+ return {subdomains: subdomains, substruct: substruct};
43603
43594
  }
43604
43595
 
43605
43596
  //SSE_Rec sserec = substruct[k];
@@ -43686,16 +43677,23 @@ class Domain3d {
43686
43677
 
43687
43678
  if (inseg && (rf == 0)) {
43688
43679
  // segment ends
43689
- segments.push(startseg);
43690
- segments.push(i);
43680
+ // segments.push(startseg);
43681
+ // segments.push(i);
43682
+
43683
+ let resiRangeArray = this.getNcbiresiRangeFromPos(chnid, startseg, i, pos2resi);
43684
+ segments = segments.concat(resiRangeArray);
43685
+
43691
43686
  inseg = false;
43692
43687
  }
43693
43688
  }
43694
43689
 
43695
43690
  // check for the last segment
43696
43691
  if (inseg) {
43697
- segments.push(startseg);
43698
- segments.push(lastResi);
43692
+ // segments.push(startseg);
43693
+ // segments.push(lastResi);
43694
+
43695
+ let resiRangeArray = this.getNcbiresiRangeFromPos(chnid, startseg, lastResi, pos2resi);
43696
+ segments = segments.concat(resiRangeArray);
43699
43697
  }
43700
43698
 
43701
43699
  subdomains.push(segments);
@@ -43716,61 +43714,114 @@ class Domain3d {
43716
43714
  }
43717
43715
  }
43718
43716
 
43719
- return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi };
43717
+ substruct = this.standardizeSubstruct(chnid, substruct, pos2resi);
43718
+
43719
+ // return {subdomains: subdomains, substruct: substruct};
43720
+ //subdomains contains NCBI residue numbers
43721
+ return {subdomains: subdomains, substruct: substruct};
43720
43722
  } // end c2b_NewSplitChain
43721
43723
 
43722
- getDomainJsonForAlign(atoms, bForceOneDomain) { let ic = this.icn3d, me = ic.icn3dui;
43724
+ standardizeSubstruct(chnid, substruct, pos2resi) { let ic = this.icn3d; ic.icn3dui;
43725
+ // adjust substruct to use NCBI residue number
43726
+ for (let i = 0; i < substruct.length; i++) {
43727
+ //SSE_Rec sserec = substruct[i];
43728
+ let sserec = substruct[i];
43729
+ let FromPos = sserec.From;
43730
+ let ToPos = sserec.To;
43731
+
43732
+ let FromResi = pos2resi[FromPos - 1];
43733
+ let ToResi = pos2resi[ToPos - 1];
43734
+
43735
+ let FromNcbiResid = ic.annoDomainCls.getNcbiresiFromResid(chnid + '_' + FromResi);
43736
+ let ToNcbiResid = ic.annoDomainCls.getNcbiresiFromResid(chnid + '_' + ToResi);
43737
+
43738
+ substruct[i].From = FromNcbiResid.substr(FromNcbiResid.lastIndexOf('_') + 1);
43739
+ substruct[i].To = ToNcbiResid.substr(ToNcbiResid.lastIndexOf('_') + 1);
43740
+
43741
+ substruct[i].From = parseInt(substruct[i].From);
43742
+ substruct[i].To = parseInt(substruct[i].To);
43743
+ }
43744
+
43745
+ return substruct;
43746
+ }
43747
+
43748
+ getNcbiresiRangeFromPos(chnid, startPos, endPos, pos2resi) { let ic = this.icn3d; ic.icn3dui;
43749
+ let resiArray = [];
43750
+ for(let i = startPos; i <= endPos; ++i) {
43751
+ let resi = pos2resi[i - 1];
43752
+ let residNCBI = (ic.resid2ncbi[chnid + '_' + resi]) ? ic.resid2ncbi[chnid + '_' + resi] : chnid + '_' + resi;
43753
+ let ncbiresi = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
43754
+ resiArray.push(parseInt(ncbiresi));
43755
+ }
43756
+
43757
+ let resiRangeArray = ic.resid2specCls.resi2range(resiArray);
43758
+
43759
+ return resiRangeArray;
43760
+ }
43761
+
43762
+ /*
43763
+ // this function works for atoms in a single chain
43764
+ // getDomainJsonForAlign(atoms, bForceOneDomain) { let ic = this.icn3d, me = ic.icn3dui;
43765
+ getDomainJsonForAlign(atoms) { let ic = this.icn3d, me = ic.icn3dui;
43723
43766
  let result = this.c2b_NewSplitChain(atoms);
43724
43767
 
43725
43768
  let subdomains = result.subdomains;
43726
43769
  let substruct = result.substruct;
43727
- let pos2resi = result.pos2resi;
43770
+ // let pos2resi = result.pos2resi;
43728
43771
 
43729
- let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(atoms);
43730
- let residueArray = Object.keys(residueHash);
43731
- let chnid = residueArray[0].substr(0, residueArray[0].lastIndexOf('_'));
43732
43772
 
43733
- if(bForceOneDomain) subdomains = [];
43773
+ let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(atoms);
43774
+ // let residueArray = Object.keys(residueHash);
43775
+ // let chnid = residueArray[0].substr(0, residueArray[0].lastIndexOf('_'));
43734
43776
 
43735
- //the whole structure is also considered as a large domain
43736
- //if(subdomains.length == 0) {
43737
- //subdomains.push([parseInt(ic.chainsSeq[chnid][0].resi), parseInt(ic.chainsSeq[chnid][ic.chainsSeq[chnid].length - 1].resi)]);
43777
+ let firstAtom = ic.firstAtomObjCls.getFirstAtomObj(atoms);
43778
+ let chnid = firstAtom.structure + '_' + firstAtom.chain;
43738
43779
 
43739
- // subdomains.push([parseInt(residueArray[0].substr(residueArray[0].lastIndexOf('_') + 1)),
43740
- // parseInt(residueArray[residueArray.length-1].substr(residueArray[residueArray.length-1].lastIndexOf('_') + 1))]);
43780
+ // if(bForceOneDomain) subdomains = [];
43741
43781
 
43742
- // use position based
43743
- subdomains.push([1, residueArray.length]);
43744
-
43745
- //}
43782
+ //the whole structure is also considered as a large domain
43783
+ if(subdomains.length == 0) {
43784
+ let resid1 = residueArray[0];
43785
+ let resid2 = residueArray[residueArray.length - 1];
43786
+ let ncbiresid1 = (ic.resid2ncbi[resid1]) ? ic.resid2ncbi[resid1] : resid1;
43787
+ let ncbiresid2 = (ic.resid2ncbi[resid2]) ? ic.resid2ncbi[resid2] : resid2;
43788
+ subdomains.push([parseInt(ncbiresid1.substr(ncbiresid1.lastIndexOf('_') + 1)), parseInt(ncbiresid2.substr(ncbiresid2.lastIndexOf('_') + 1))]);
43789
+ }
43746
43790
 
43747
43791
  // m_domains1: {"data": [ {"ss": [[1,20,30,x,y,z,x,y,z], [2,50,60,x,y,z,x,y,z]], "domain": [[1,43,x,y,z],[2,58,x,y,z], ...]}, {"ss": [[1,20,30,x,y,z,x,y,z], [2,50,60,x,y,z,x,y,z]],"domain": [[1,43,x,y,z],[2,58,x,y,z], ...]} ] }
43748
43792
  let jsonStr = '{"data": [';
43793
+ //merge all subdomains into one domain
43794
+ jsonStr += '{"ss": ['; //secondary structure
43795
+
43796
+ let ssCnt = 0, startAll = 999, endAll = -999;
43749
43797
  for(let i = 0, il = subdomains.length; i < il; ++i) {
43750
- if(i > 0) jsonStr += ', ';
43751
- //secondary structure
43752
- jsonStr += '{"ss": [';
43753
- let ssCnt = 0;
43798
+ // if(i > 0) jsonStr += ', ';
43799
+ // jsonStr += '{"ss": ['; //secondary structure
43800
+
43754
43801
  for(let j = 0, jl = subdomains[i].length; j < jl; j += 2) {
43755
43802
  let start = subdomains[i][j];
43756
43803
  let end = subdomains[i][j + 1];
43757
-
43804
+
43805
+ if(start < startAll) startAll = start;
43806
+ if(end > endAll) endAll = end;
43807
+
43758
43808
  for(let k = 0, kl = substruct.length; k < kl; ++k) {
43759
43809
  //ss: sstype ss_start ss_end x1 y1 z1 x2 y2 z2
43760
43810
  //sstype: 1 (helix), 2 (sheet)
43761
43811
  let sstype = (substruct[k].Sheet) ? 2 : 1;
43762
- let from = pos2resi[substruct[k].From - 1]; // 1-based to 0-based
43763
- let to = pos2resi[substruct[k].To - 1];
43812
+ // let from = pos2resi[substruct[k].From - 1]; // 1-based to 0-based
43813
+ // let to = pos2resi[substruct[k].To - 1];
43764
43814
 
43765
43815
  // 1-based residue numbers
43766
43816
  let fromPos = substruct[k].From;
43767
43817
  let toPos = substruct[k].To;
43768
43818
 
43769
- let residFrom = chnid + "_" + from;
43819
+ let residFrom = ic.ncbi2resid[chnid + "_" + fromPos];
43770
43820
  let atomFrom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[residFrom]);
43821
+
43771
43822
  if(!atomFrom || !ic.hAtoms.hasOwnProperty(atomFrom.serial)) continue;
43772
43823
 
43773
- let residTo = chnid + "_" + to;
43824
+ let residTo = ic.ncbi2resid[chnid + "_" + toPos];
43774
43825
  let atomTo = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[residTo]);
43775
43826
  if(!atomTo || !ic.hAtoms.hasOwnProperty(atomTo.serial)) continue;
43776
43827
 
@@ -43782,45 +43833,170 @@ class Domain3d {
43782
43833
  }
43783
43834
  }
43784
43835
  }
43785
- jsonStr += ']';
43836
+ }
43837
+ jsonStr += ']';
43838
+
43839
+ // domain
43840
+ jsonStr += ', "domain": [';
43841
+ let domainCnt = 0;
43842
+ let fakeCoord = 0; //-100000; // the fake corrd is not read anyway
43786
43843
 
43787
- // domain
43788
- jsonStr += ', "domain": [';
43789
- let domainCnt = 0;
43790
- for(let j = 0, jl = subdomains[i].length; j < jl; j += 2) {
43791
- let start = subdomains[i][j];
43792
- let end = subdomains[i][j + 1];
43844
+ // resi should be the continuous number starting from 1. make this correction in the backend
43845
+ for(let j = startAll; j <= endAll; ++j) {
43846
+ let ncbiResid = chnid + '_' + j;
43847
+ let resid = ic.ncbi2resid[ncbiResid];
43848
+
43849
+ let pos = j;
43793
43850
 
43794
- for(let k = 0, kl = residueArray.length; k < kl; ++k) {
43795
- let resid = residueArray[k];
43851
+ if(domainCnt > 0) jsonStr += ', ';
43852
+
43853
+ if(!residueHash.hasOwnProperty(resid)) {
43854
+ jsonStr += '[' + pos + ',' + 0 + ',' + fakeCoord + ',' + fakeCoord + ',' + fakeCoord + ']';
43855
+ }
43856
+ else {
43857
+ let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[resid]);
43858
+
43859
+ //domain: resi, restype, x, y, z
43860
+ let restype = (me.parasCls.resn2restype[atom.resn]) ? me.parasCls.resn2restype[atom.resn] : 0;
43861
+
43862
+ jsonStr += '[' + pos + ',' + restype + ',' + atom.coord.x.toFixed(2) + ',' + atom.coord.y.toFixed(2) + ',' + atom.coord.z.toFixed(2) + ']';
43863
+ }
43864
+
43865
+ ++domainCnt;
43866
+ }
43867
+ jsonStr += ']}';
43868
+
43869
+ jsonStr += ']}';
43870
+
43871
+ return jsonStr;
43872
+ }
43873
+ */
43874
+ // this function works for atoms in a single chain
43875
+ getDomainJsonForAlign(atoms) { let ic = this.icn3d, me = ic.icn3dui;
43876
+ // let result = this.c2b_NewSplitChain(atoms);
43877
+
43878
+ // let subdomains = result.subdomains;
43879
+ // let substruct = result.substruct;
43880
+
43881
+ let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(atoms);
43882
+ let residueArray = Object.keys(residueHash);
43883
+ let chnid = residueArray[0].substr(0, residueArray[0].lastIndexOf('_'));
43884
+
43885
+ // let resid1 = residueArray[0];
43886
+ // let resid2 = residueArray[residueArray.length - 1];
43887
+ // let ncbiresid1 = (ic.resid2ncbi[resid1]) ? ic.resid2ncbi[resid1] : resid1;
43888
+ // let ncbiresid2 = (ic.resid2ncbi[resid2]) ? ic.resid2ncbi[resid2] : resid2;
43889
+ // let startAll = parseInt(ncbiresid1.substr(ncbiresid1.lastIndexOf('_') + 1));
43890
+ // let endAll = parseInt(ncbiresid2.substr(ncbiresid2.lastIndexOf('_') + 1));
43891
+
43892
+ let substruct = [];
43893
+ let substructItem = {};
43894
+ let pos2resi = {}; // 0-based
43895
+ let startAll = 999, endAll = -999;
43896
+ for(let i = 0; i < residueArray.length; ++i) {
43897
+ let resid = residueArray[i];
43898
+ let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[resid]);
43899
+
43900
+ let resi = resid.substr(resid.lastIndexOf('_') + 1);
43901
+ pos2resi[i] = resi;
43796
43902
 
43797
- // let resi = resid.substr(resid.lastIndexOf('_') + 1);
43798
- // let residNCBI = ic.resid2ncbi[resid];
43799
- // let pos = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
43800
- let pos = k + 1;
43903
+ let ncbiresid = (ic.resid2ncbi[resid]) ? ic.resid2ncbi[resid] : resid;
43904
+ let ncbiresi = parseInt(ncbiresid.substr(ncbiresid.lastIndexOf('_') + 1));
43905
+
43906
+ if(ncbiresi < startAll) startAll = ncbiresi;
43907
+ if(ncbiresi > endAll) endAll = ncbiresi;
43908
+
43909
+ if(atom.ssend) {
43910
+ substructItem.To = i + 1;
43911
+ substructItem.x2 = atom.coord.x;
43912
+ substructItem.y2 = atom.coord.y;
43913
+ substructItem.z2 = atom.coord.z;
43914
+
43915
+ substructItem.Sheet = (atom.ss == 'sheet') ? true : false;
43916
+
43917
+ substruct.push(substructItem);
43918
+ substructItem = {};
43919
+ }
43920
+
43921
+ // a residue could be both start and end. check ssend first, then check ssbegin
43922
+ if(atom.ssbegin) {
43923
+ substructItem.From = i + 1;
43924
+ substructItem.x1 = atom.coord.x;
43925
+ substructItem.y1 = atom.coord.y;
43926
+ substructItem.z1 = atom.coord.z;
43927
+ }
43928
+ }
43929
+
43930
+ substruct = this.standardizeSubstruct(chnid, substruct, pos2resi);
43931
+
43932
+ // m_domains1: {"data": [ {"ss": [[1,20,30,x,y,z,x,y,z], [2,50,60,x,y,z,x,y,z]], "domain": [[1,43,x,y,z],[2,58,x,y,z], ...]}, {"ss": [[1,20,30,x,y,z,x,y,z], [2,50,60,x,y,z,x,y,z]],"domain": [[1,43,x,y,z],[2,58,x,y,z], ...]} ] }
43933
+ let jsonStr = '{"data": [';
43934
+ //merge all subdomains into one domain
43935
+ jsonStr += '{"ss": ['; //secondary structure
43936
+
43937
+ let ssCnt = 0;
43938
+ for(let k = 0, kl = substruct.length; k < kl; ++k) {
43939
+ //ss: sstype ss_start ss_end x1 y1 z1 x2 y2 z2
43940
+ //sstype: 1 (helix), 2 (sheet)
43941
+ let sstype = (substruct[k].Sheet) ? 2 : 1;
43942
+
43943
+ // 1-based residue numbers
43944
+ let fromPos = substruct[k].From;
43945
+ let toPos = substruct[k].To;
43946
+
43947
+ let residFrom = ic.ncbi2resid[chnid + "_" + fromPos];
43948
+ let atomFrom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[residFrom]);
43949
+ if(!atomFrom || !ic.hAtoms.hasOwnProperty(atomFrom.serial)) continue;
43950
+
43951
+ let residTo = ic.ncbi2resid[chnid + "_" + toPos];
43952
+ let atomTo = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[residTo]);
43953
+ if(!atomTo || !ic.hAtoms.hasOwnProperty(atomTo.serial)) continue;
43954
+
43955
+ // if(fromPos >= start && toPos <= end) {
43956
+ if(ssCnt > 0) jsonStr += ', ';
43957
+ jsonStr += '[' + sstype + ',' + fromPos + ',' + toPos + ',' + substruct[k].x1.toFixed(2) + ',' + substruct[k].y1.toFixed(2) + ','
43958
+ + substruct[k].z1.toFixed(2) + ',' + substruct[k].x2.toFixed(2) + ',' + substruct[k].y2.toFixed(2) + ',' + substruct[k].z2.toFixed(2) + ']';
43959
+ ++ssCnt;
43960
+ // }
43961
+ }
43962
+
43963
+ jsonStr += ']';
43801
43964
 
43802
- //let resid = chnid + "_" + resi;
43803
- let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[resid]);
43804
-
43805
- if(!atom) continue;
43806
- if(!ic.hAtoms.hasOwnProperty(atom.serial)) continue;
43807
-
43808
- //domain: resi, restype, x, y, z
43809
- let restype = me.parasCls.resn2restype[atom.resn];
43810
- if(restype !== undefined && pos >= start && pos <= end) {
43811
- if(domainCnt > 0) jsonStr += ', ';
43812
- jsonStr += '[' + pos + ',' + restype + ',' + atom.coord.x.toFixed(2) + ','
43813
- + atom.coord.y.toFixed(2) + ',' + atom.coord.z.toFixed(2) + ']';
43814
- ++domainCnt;
43815
- }
43816
- }
43965
+ // domain
43966
+ jsonStr += ', "domain": [';
43967
+ let domainCnt = 0;
43968
+ let fakeCoord = 0; //-100000; // the fake corrd is not read anyway
43969
+
43970
+ // resi should be the continuous number starting from 1. make this correction in the backend
43971
+ for(let j = startAll; j <= endAll; ++j) {
43972
+ let ncbiResid = chnid + '_' + j;
43973
+ let resid = ic.ncbi2resid[ncbiResid];
43974
+
43975
+ let pos = j;
43976
+
43977
+ if(domainCnt > 0) jsonStr += ', ';
43978
+
43979
+ if(!residueHash.hasOwnProperty(resid)) {
43980
+ jsonStr += '[' + pos + ',' + 0 + ',' + fakeCoord + ',' + fakeCoord + ',' + fakeCoord + ']';
43817
43981
  }
43818
- jsonStr += ']}';
43982
+ else {
43983
+ let atom = ic.firstAtomObjCls.getFirstCalphaAtomObj(ic.residues[resid]);
43984
+
43985
+ //domain: resi, restype, x, y, z
43986
+ let restype = (me.parasCls.resn2restype[atom.resn]) ? me.parasCls.resn2restype[atom.resn] : 0;
43987
+
43988
+ jsonStr += '[' + pos + ',' + restype + ',' + atom.coord.x.toFixed(2) + ',' + atom.coord.y.toFixed(2) + ',' + atom.coord.z.toFixed(2) + ']';
43989
+ }
43990
+
43991
+ ++domainCnt;
43819
43992
  }
43820
43993
  jsonStr += ']}';
43821
43994
 
43995
+ jsonStr += ']}';
43996
+
43822
43997
  return jsonStr;
43823
43998
  }
43999
+
43824
44000
  }
43825
44001
 
43826
44002
  /**
@@ -45926,7 +46102,6 @@ class Annotation {
45926
46102
  if($("#" + ic.pre + "anno_transmem").length) $("#" + ic.pre + "anno_transmem")[0].checked = false;
45927
46103
  }
45928
46104
  async setAnnoTabIg(bSelection, template) { let ic = this.icn3d; ic.icn3dui;
45929
-
45930
46105
  await this.updateIg(bSelection, template);
45931
46106
 
45932
46107
  $("[id^=" + ic.pre + "ig]").show();
@@ -46267,7 +46442,7 @@ class Annotation {
46267
46442
 
46268
46443
  async updateIg(bSelection, template) { let ic = this.icn3d, me = ic.icn3dui;
46269
46444
  ic.opts['color'] = 'ig strand';
46270
-
46445
+
46271
46446
  // if(!bSelection && !template) {
46272
46447
  if(!bSelection) {
46273
46448
  // select all protein chains
@@ -46286,11 +46461,13 @@ class Annotation {
46286
46461
  }
46287
46462
 
46288
46463
  ic.bRunRefnumAgain = true;
46289
- for(let chainid in ic.protein_chainid) {
46464
+ let chainidHash = (!bSelection) ? ic.protein_chainid : ic.firstAtomObjCls.getChainsFromAtoms(ic.hAtoms);
46465
+ for(let chainid in chainidHash) {
46466
+ // showIgRefNum() in showIg() runs for all chains
46290
46467
  await ic.annoIgCls.showIg(chainid, template);
46291
46468
  ic.bRunRefnumAgain = false; // run it once for all chains
46292
46469
  }
46293
-
46470
+
46294
46471
  if(ic.bShowRefnum) {
46295
46472
  ic.hlUpdateCls.updateHlAll();
46296
46473
  ic.drawCls.draw();
@@ -48037,8 +48214,9 @@ class HlSeq {
48037
48214
  residueid = ic.ncbi2resid[residNCBI];
48038
48215
  }
48039
48216
  else if($(that).attr('3ddomain') !== undefined) {
48040
- // the position of residues with coordinates
48041
- residueid = ic.posid2resid[chainid + '_' + (j+1).toString()];
48217
+ // NCBI residue numbers
48218
+ // residueid = ic.posid2resid[chainid + '_' + (j+1).toString()];
48219
+ residueid = ic.ncbi2resid[chainid + '_' + j];
48042
48220
  }
48043
48221
  else {
48044
48222
  residueid = chainid + '_' + (j+1).toString();
@@ -48722,7 +48900,7 @@ class LineGraph {
48722
48900
  // Node for common interaction: {id : "Q24.A.2AJF|Q24", r : "1_1_2AJF_A_24", s: "a", ...}
48723
48901
  let nodeArray1SplitCommon = [], nodeArray2SplitCommon = [], linkArraySplitCommon = [], nameHashSplitCommon = [];
48724
48902
  let nodeArray1SplitDiff = [], nodeArray2SplitDiff = [], linkArraySplitDiff = [], nameHashSplitDiff = [];
48725
- let linkedNodeCnt = {}, linkedNodeInterDiff = {};
48903
+ let linkedNodeCnt = {}, linkedNodeInterDiff = {}, linkedNodeInterDiffBool = {};
48726
48904
 
48727
48905
  for(let i = 0, il = structureArray.length; i < il; ++i) {
48728
48906
  nodeArray1Split[i] = [];
@@ -48781,13 +48959,15 @@ class LineGraph {
48781
48959
  linkedNodeInterDiff[mappingid] = link.n;
48782
48960
  }
48783
48961
  else {
48784
- ++linkedNodeCnt[mappingid];
48785
- linkedNodeInterDiff[mappingid] -= link.n; // show difference
48962
+ ++linkedNodeCnt[mappingid];
48963
+ linkedNodeInterDiff[mappingid] += link.n;
48964
+
48965
+ linkedNodeInterDiffBool[mappingid] = (linkedNodeInterDiff[mappingid] / link.n == linkedNodeCnt[mappingid]) ? 0 : 1;
48786
48966
  }
48787
48967
  }
48788
48968
  }
48789
48969
  }
48790
-
48970
+
48791
48971
  // do not combine with the above section since linkedNodeCnt was pre-populated above
48792
48972
  // set linkArraySplitCommon and nameHashSplitCommon
48793
48973
  // set linkArraySplitDiff and nameHashSplitDiff
@@ -48833,7 +49013,7 @@ class LineGraph {
48833
49013
  linkDiff.source += separatorDiff + ic.chainsMapping[chainid1][resid1];
48834
49014
  linkDiff.target += separatorDiff + ic.chainsMapping[chainid2][resid2];
48835
49015
 
48836
- if(linkedNodeCnt[mappingid] == structureArray.length && linkedNodeInterDiff[mappingid] == 0) {
49016
+ if(linkedNodeCnt[mappingid] == structureArray.length && linkedNodeInterDiffBool[mappingid] == 0) {
48837
49017
  linkArraySplitCommon[index].push(linkCommon);
48838
49018
  }
48839
49019
  else {
@@ -49530,18 +49710,20 @@ class GetGraph {
49530
49710
  return lineGraphStr;
49531
49711
  }
49532
49712
 
49533
- updateGraphColor() { let ic = this.icn3d, me = ic.icn3dui;
49713
+ updateGraphColor() { let ic = this.icn3d; ic.icn3dui;
49534
49714
  // change graph color
49535
49715
 
49716
+ // do not update the graph for now
49717
+ /*
49536
49718
  if(ic.graphStr !== undefined) {
49537
49719
  let graphJson = JSON.parse(ic.graphStr);
49538
- let resid2color = {};
49720
+ let resid2color = {}
49539
49721
  for(let resid in ic.residues) {
49540
49722
  let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
49541
49723
  resid2color[resid] = atom.color.getHexString().toUpperCase();
49542
49724
  }
49543
49725
 
49544
- let target2resid = {};
49726
+ let target2resid = {}
49545
49727
  for(let i = 0, il = graphJson.nodes.length; i < il; ++i) {
49546
49728
  let node = graphJson.nodes[i];
49547
49729
  //node.r: 1_1_1KQ2_A_1
@@ -49570,6 +49752,7 @@ class GetGraph {
49570
49752
  if(ic.bGraph) ic.drawGraphCls.drawGraph(ic.graphStr, ic.pre + 'dl_graph');
49571
49753
  if(ic.bLinegraph) ic.lineGraphCls.drawLineGraph(ic.graphStr);
49572
49754
  if(ic.bScatterplot) ic.lineGraphCls.drawLineGraph(ic.graphStr, true);
49755
+ */
49573
49756
  }
49574
49757
 
49575
49758
  handleForce() { let ic = this.icn3d, me = ic.icn3dui;
@@ -51733,7 +51916,7 @@ class ContactMap {
51733
51916
 
51734
51917
  let graphStr = '{\n';
51735
51918
 
51736
- let struc1 = (ic.structures.length > 0) ? ic.structures[0] : ic.defaultPdbId;
51919
+ let struc1 = (Object.keys(ic.structures).length > 0) ? ic.structures[0] : ic.defaultPdbId;
51737
51920
  let len1 = nodeArray1.length,
51738
51921
  len2 = nodeArray2.length;
51739
51922
  let factor = 1;
@@ -52267,6 +52450,7 @@ class ChainalignParser {
52267
52450
  let allPromise = Promise.allSettled(ajaxArray);
52268
52451
  // try {
52269
52452
  let dataArray = await allPromise;
52453
+
52270
52454
  await thisClass.downloadChainalignmentPart2b(chainresiCalphaHash2, chainidArray, hAtoms, dataArray, indexArray, mmdbid_t, struArray);
52271
52455
  // }
52272
52456
  // catch(err) {
@@ -52870,13 +53054,13 @@ class ChainalignParser {
52870
53054
  if(queryData !== undefined && JSON.stringify(queryData).indexOf('Oops there was a problem') === -1
52871
53055
  && align !== undefined && JSON.stringify(align).indexOf('Oops there was a problem') === -1
52872
53056
  ) {
52873
- if((align === undefined || align.length == 0) && bEqualMmdbid && bEqualChain) {
53057
+ if((align === "error" || align === undefined || align.length == 0) && bEqualMmdbid && bEqualChain) {
52874
53058
  ic.t_trans_add[index] = {"x":0, "y":0, "z":0};
52875
53059
  ic.q_trans_sub[index] = {"x":0, "y":0, "z":0};
52876
53060
  ic.q_rotation[index] = {"x1":1, "y1":0, "z1":0, "x2":0, "y2":1, "z2":0, "x3":0, "y3":0, "z3":1};
52877
53061
  ic.qt_start_end[index] = undefined;
52878
53062
  }
52879
- else if(align === undefined || align.length == 0) {
53063
+ else if(align === "error" || align === undefined || align.length == 0) {
52880
53064
  if(!me.cfg.command && !bNoAlert) var aaa = 1; //alert('These two chains can not align to each other. ' + 'Please select sequences from these two chains in the "Sequences & Annotations" window, ' + 'and click "Realign Selection" in the "File" menu to align your selection.');
52881
53065
 
52882
53066
  ic.t_trans_add[index] = {"x":0, "y":0, "z":0};
@@ -52907,14 +53091,16 @@ class ChainalignParser {
52907
53091
  ic.qt_start_end[index] = align[0].segs;
52908
53092
 
52909
53093
  let rmsd = align[0].super_rmsd;
53094
+ let rmsdStr = (rmsd) ? rmsd.toPrecision(4) : rmsd;
53095
+ let scoreStr = (align[0].score) ? align[0].score.toPrecision(4) : align[0].score;
52910
53096
 
52911
- let logStr = "alignment RMSD: " + rmsd.toPrecision(4);
52912
- if(me.cfg.aligntool == 'tmalign') logStr += "; TM-score: " + align[0].score.toPrecision(4);
53097
+ let logStr = "alignment RMSD: " + rmsdStr;
53098
+ if(me.cfg.aligntool == 'tmalign') logStr += "; TM-score: " + scoreStr;
52913
53099
  me.htmlCls.clickMenuCls.setLogCmd(logStr, false);
52914
- let html = "<br><b>Alignment RMSD</b>: " + rmsd.toPrecision(4) + " &#8491;<br>";
53100
+ let html = "<br><b>Alignment RMSD</b>: " + rmsdStr + " &#8491;<br>";
52915
53101
  if(me.cfg.aligntool == 'tmalign') {
52916
- html += "<b>TM-score</b>: " + align[0].score.toPrecision(4) + "<br><br>";
52917
- ic.tmscore = align[0].score.toPrecision(4);
53102
+ html += "<b>TM-score</b>: " + scoreStr + "<br><br>";
53103
+ ic.tmscore = scoreStr;
52918
53104
  }
52919
53105
 
52920
53106
  $("#" + ic.pre + "dl_rmsd_html").html(html);
@@ -53061,6 +53247,7 @@ class ChainalignParser {
53061
53247
  let allPromise = Promise.allSettled(ajaxArray);
53062
53248
  // try {
53063
53249
  let dataArray = await allPromise;
53250
+
53064
53251
  await thisClass.parseMMdbAfData(dataArray, structArray, bQuery, vastplusAtype);
53065
53252
  if(vastplusAtype === undefined) ic.ParserUtilsCls.hideLoading();
53066
53253
  // }
@@ -53093,13 +53280,9 @@ class ChainalignParser {
53093
53280
 
53094
53281
  //if(!ic.bCommandLoad && !bQuery) ic.init(); // remove all previously loaded data
53095
53282
 
53096
- let hAtoms = {}, hAtomsTmp = {};
53283
+ let hAtoms = {};
53097
53284
  let bLastQuery = false;
53098
53285
 
53099
- let opts = {};
53100
-
53101
- opts['color'] = (structArray.length > 1) ? 'structure' : ((structArray[0].length > 5) ? 'confidence' : 'chain');
53102
-
53103
53286
  for(let i = 0, il = structArray.length; i < il; ++i) {
53104
53287
  if(i == structArray.length - 1) bLastQuery = true;
53105
53288
 
@@ -53114,24 +53297,30 @@ class ChainalignParser {
53114
53297
  targetOrQuery = 'query';
53115
53298
  bAppend = true;
53116
53299
  }
53117
-
53300
+
53118
53301
  //if(structArray[i].length > 4) {
53119
53302
  if(isNaN(structArray[i]) && structArray[i].length > 5) { // PDB ID plus postfix could be 5
53120
53303
  //let bNoDssp = true;
53121
53304
  let bNoDssp = false; // get secondary structure info
53122
- hAtomsTmp = await ic.pdbParserCls.loadPdbData(queryDataArray[i], structArray[i], false, bAppend, targetOrQuery, bLastQuery, bNoDssp);
53305
+ await ic.pdbParserCls.loadPdbData(queryDataArray[i], structArray[i], false, bAppend, targetOrQuery, bLastQuery, bNoDssp);
53123
53306
  }
53124
53307
  else {
53125
53308
  let bNoSeqalign = true;
53126
53309
  let pdbid = structArray[i];
53127
- hAtomsTmp = await ic.mmdbParserCls.parseMmdbData(queryDataArray[i], targetOrQuery, undefined, undefined, bLastQuery, bNoSeqalign, pdbid);
53310
+
53311
+ //hAtomsTmp contains all atoms
53312
+ await ic.mmdbParserCls.parseMmdbData(queryDataArray[i], targetOrQuery, undefined, undefined, bLastQuery, bNoSeqalign, pdbid);
53128
53313
  }
53129
53314
 
53130
- hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
53315
+ // hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
53131
53316
  }
53132
53317
 
53133
- // add color only for the newly loaded structures
53134
- ic.setColorCls.setColorByOptions(opts, hAtoms);
53318
+ let structArrayAll = Object.keys(ic.structures);
53319
+
53320
+ ic.opts['color'] = (structArrayAll.length > 1) ? 'structure' : ((structArrayAll[0].length > 5) ? 'confidence' : 'chain');
53321
+
53322
+ // add color for all structures
53323
+ ic.setColorCls.setColorByOptions(ic.opts, hAtoms);
53135
53324
 
53136
53325
  await ic.ParserUtilsCls.renderStructure();
53137
53326
 
@@ -53161,15 +53350,6 @@ class ChainalignParser {
53161
53350
  if(vastplusAtype == 2) me.cfg.aligntool = 'tmalign';
53162
53351
  await ic.vastplusCls.vastplusAlign(structArray, vastplusAtype);
53163
53352
  }
53164
-
53165
- // /// if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
53166
-
53167
- // if(Object.keys(ic.structures).length == 1 && me.cfg.mmdbafid.length > 5) {
53168
- // ic.ParserUtilsCls.checkMemProtein(me.cfg.mmdbafid);
53169
- // }
53170
- // else {
53171
- // /// if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
53172
- // }
53173
53353
  }
53174
53354
  }
53175
53355
 
@@ -54637,24 +54817,32 @@ class MmcifParser {
54637
54817
  if(data.emd !== undefined) ic.emd = data.emd;
54638
54818
  if(data.organism !== undefined) ic.organism = data.organism;
54639
54819
 
54640
- if(ic.emd !== undefined) {
54641
- $("#" + ic.pre + "mapWrapper1").hide();
54642
- $("#" + ic.pre + "mapWrapper2").hide();
54643
- $("#" + ic.pre + "mapWrapper3").hide();
54644
- }
54645
- else {
54646
- $("#" + ic.pre + "emmapWrapper1").hide();
54647
- $("#" + ic.pre + "emmapWrapper2").hide();
54648
- $("#" + ic.pre + "emmapWrapper3").hide();
54649
- }
54650
-
54651
54820
  await ic.opmParserCls.loadOpmData(data, mmcifid, undefined, 'mmcif');
54821
+
54822
+ ic.opmParserCls.modifyUIMapAssembly();
54652
54823
  }
54653
54824
  else {
54654
- //var aaa = 1; //alert('invalid atoms data.');
54655
54825
  return false;
54656
54826
  }
54657
54827
  }
54828
+
54829
+ async loadMultipleMmcifData(data, mmcifid, bAppend) { let ic = this.icn3d; ic.icn3dui;
54830
+ let bText = true;
54831
+ ic.loadCIFCls.loadCIF(data, mmcifid, bText, bAppend);
54832
+
54833
+ if(Object.keys(ic.structures).length > 1) {
54834
+ ic.opts['color'] = 'structure';
54835
+ }
54836
+
54837
+ ic.opmParserCls.modifyUIMapAssembly();
54838
+
54839
+ ic.pdbParserCls.addSecondary(bAppend);
54840
+
54841
+ // ic.setStyleCls.setAtomStyleByOptions(ic.opts);
54842
+ // ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
54843
+
54844
+ // await ic.ParserUtilsCls.renderStructure();
54845
+ }
54658
54846
  }
54659
54847
 
54660
54848
  /**
@@ -55497,26 +55685,26 @@ class BcifParser {
55497
55685
  let molecueType;
55498
55686
  if(atom_hetatm == "ATOM") {
55499
55687
  if(resn.length == 3) {
55500
- molecueType = "p"; // protein
55688
+ molecueType = "protein"; //"p"; // protein
55501
55689
  }
55502
55690
  else {
55503
- molecueType = "n"; // nucleotide
55691
+ molecueType = "nucleotide"; //"n"; // nucleotide
55504
55692
  }
55505
55693
  }
55506
55694
  else {
55507
55695
  if(resn == "WAT" || resn == "HOH") {
55508
- molecueType = "s"; // solvent
55696
+ molecueType = "solvent"; //"s"; // solvent
55509
55697
  chain = 'Misc';
55510
55698
  }
55511
55699
  else {
55512
- molecueType = "l"; // ligands or ions
55700
+ molecueType = "ligand"; //"l"; // ligands or ions
55513
55701
  chain = resn;
55514
55702
  }
55515
55703
  }
55516
55704
 
55517
55705
  // C-alpha only for large structure
55518
- if(!bFull && ((molecueType == "p" && !(elem == 'C' && name == 'CA'))
55519
- || (molecueType == "n" && !(name == "P")) ) ) continue;
55706
+ if(!bFull && ((molecueType == "protein" && !(elem == 'C' && name == 'CA'))
55707
+ || (molecueType == "nucleotide" && !(name == "P")) ) ) continue;
55520
55708
  // skip alternative atoms
55521
55709
  if(alt == "B") continue;
55522
55710
 
@@ -55539,7 +55727,7 @@ class BcifParser {
55539
55727
  // }
55540
55728
  }
55541
55729
 
55542
- if(molecueType == 's' || molecueType == "l") {
55730
+ if(molecueType == 'solvent' || molecueType == "ligand") {
55543
55731
  let seq = {};
55544
55732
  if(!ligSeqHash.hasOwnProperty(chain)) {
55545
55733
  ligSeqHash[chain] = [];
@@ -55677,26 +55865,26 @@ class BcifParser {
55677
55865
  let molecueType;
55678
55866
  if(atom_hetatm == "ATOM") {
55679
55867
  if(resn.length == 3) {
55680
- molecueType = "p"; // protein
55868
+ molecueType = "protein"; // protein
55681
55869
  }
55682
55870
  else {
55683
- molecueType = "n"; // nucleotide
55871
+ molecueType = "nucleotide"; // nucleotide
55684
55872
  }
55685
55873
  }
55686
55874
  else {
55687
55875
  if(resn == "WAT" || resn == "HOH") {
55688
- molecueType = "s"; // solvent
55876
+ molecueType = "solvent"; // solvent
55689
55877
  chain = 'Misc';
55690
55878
  }
55691
55879
  else {
55692
- molecueType = "l"; // ligands or ions
55880
+ molecueType = "ligand"; // ligands or ions
55693
55881
  chain = resn;
55694
55882
  }
55695
55883
  }
55696
55884
 
55697
55885
  // C-alpha only for large structure
55698
- if(!bFull && ((molecueType == "p" && !(elem == 'C' && name == 'CA'))
55699
- || (molecueType == "n" && !(name == "P")) ) ) continue;
55886
+ if(!bFull && ((molecueType == "protein" && !(elem == 'C' && name == 'CA'))
55887
+ || (molecueType == "nucleotide" && !(name == "P")) ) ) continue;
55700
55888
  // skip alternative atoms
55701
55889
  if(alt == "B") continue;
55702
55890
 
@@ -56246,6 +56434,43 @@ class OpmParser {
56246
56434
  }
56247
56435
  }
56248
56436
 
56437
+ modifyUIMapAssembly() { let ic = this.icn3d, me = ic.icn3dui;
56438
+ if(!me.bNode) {
56439
+ if(ic.emd !== undefined) {
56440
+ $("#" + ic.pre + "mapWrapper1").hide();
56441
+ $("#" + ic.pre + "mapWrapper2").hide();
56442
+ $("#" + ic.pre + "mapWrapper3").hide();
56443
+ }
56444
+ else {
56445
+ $("#" + ic.pre + "emmapWrapper1").hide();
56446
+ $("#" + ic.pre + "emmapWrapper2").hide();
56447
+ $("#" + ic.pre + "emmapWrapper3").hide();
56448
+ }
56449
+
56450
+ if(Object.keys(ic.structures).length == 1) {
56451
+ $("#" + ic.pre + "alternateWrapper").hide();
56452
+ }
56453
+ /*
56454
+ // load assembly info
56455
+ if(type === 'mmcif') {
56456
+ let assembly =(data.assembly !== undefined) ? data.assembly : [];
56457
+ for(let i = 0, il = assembly.length; i < il; ++i) {
56458
+ if(ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
56459
+
56460
+ for(let j = 0, jl = assembly[i].length; j < jl; ++j) {
56461
+ ic.biomtMatrices[i].elements[j] = assembly[i][j];
56462
+ }
56463
+ }
56464
+ }
56465
+ */
56466
+ if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length > 1) {
56467
+ $("#" + ic.pre + "assemblyWrapper").show();
56468
+
56469
+ ic.asuCnt = ic.biomtMatrices.length;
56470
+ }
56471
+ }
56472
+ }
56473
+
56249
56474
  async parseAtomData(data, pdbid, bFull, type, pdbid2, bText) { let ic = this.icn3d, me = ic.icn3dui;
56250
56475
  /*
56251
56476
  if(type === 'mmtf') {
@@ -56262,38 +56487,7 @@ class OpmParser {
56262
56487
  ic.loadCIFCls.loadCIF(data, pdbid, bText);
56263
56488
  // }
56264
56489
 
56265
- if(ic.emd !== undefined) {
56266
- $("#" + ic.pre + "mapWrapper1").hide();
56267
- $("#" + ic.pre + "mapWrapper2").hide();
56268
- $("#" + ic.pre + "mapWrapper3").hide();
56269
- }
56270
- else {
56271
- $("#" + ic.pre + "emmapWrapper1").hide();
56272
- $("#" + ic.pre + "emmapWrapper2").hide();
56273
- $("#" + ic.pre + "emmapWrapper3").hide();
56274
- }
56275
-
56276
- if(Object.keys(ic.structures).length == 1) {
56277
- $("#" + ic.pre + "alternateWrapper").hide();
56278
- }
56279
- /*
56280
- // load assembly info
56281
- if(type === 'mmcif') {
56282
- let assembly =(data.assembly !== undefined) ? data.assembly : [];
56283
- for(let i = 0, il = assembly.length; i < il; ++i) {
56284
- if(ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
56285
-
56286
- for(let j = 0, jl = assembly[i].length; j < jl; ++j) {
56287
- ic.biomtMatrices[i].elements[j] = assembly[i][j];
56288
- }
56289
- }
56290
- }
56291
- */
56292
- if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length > 1) {
56293
- $("#" + ic.pre + "assemblyWrapper").show();
56294
-
56295
- ic.asuCnt = ic.biomtMatrices.length;
56296
- }
56490
+ this.modifyUIMapAssembly();
56297
56491
 
56298
56492
  ic.setStyleCls.setAtomStyleByOptions(ic.opts);
56299
56493
  ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
@@ -56487,6 +56681,12 @@ class PdbParser {
56487
56681
  }
56488
56682
  }
56489
56683
 
56684
+ await this.addSecondary(bAppend, bNoDssp);
56685
+
56686
+ return hAtoms;
56687
+ }
56688
+
56689
+ async addSecondary(bAppend, bNoDssp) { let ic = this.icn3d, me = ic.icn3dui;
56490
56690
  // calculate secondary structures if not available
56491
56691
  // DSSP only works for structures with all atoms. The Calpha only structures didn't work
56492
56692
  //if(!ic.bSecondaryStructure && !bCalphaOnly) {
@@ -56510,8 +56710,6 @@ class PdbParser {
56510
56710
 
56511
56711
  /// if(ic.deferredOpm !== undefined) ic.deferredOpm.resolve();
56512
56712
  }
56513
-
56514
- return hAtoms;
56515
56713
  }
56516
56714
 
56517
56715
  async applyCommandDssp(bAppend) { let ic = this.icn3d, me = ic.icn3dui;
@@ -57349,23 +57547,27 @@ class RealignParser {
57349
57547
 
57350
57548
  for(let s = 0, sl = structArray.length; s < sl; ++s) {
57351
57549
  let struct1 = structArray[s];
57550
+
57352
57551
  let chainidArray1 = Object.keys(struct2domain[struct1]);
57353
57552
  if(chainidArray1.length == 0) continue;
57354
- for(let t = s+1, tl = structArray.length; t < tl; ++t) {
57355
- let struct2 = structArray[t];
57356
- let chainidArray2 = Object.keys(struct2domain[struct2]);
57357
- if(chainidArray2.length == 0) continue;
57358
-
57359
- for(let i = 0, il = chainidArray1.length; i < il; ++i) {
57360
- let chainid1 = chainidArray1[i];
57361
- let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
57553
+
57554
+ for(let i = 0, il = chainidArray1.length; i < il; ++i) {
57555
+ let chainid1 = chainidArray1[i];
57556
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
57557
+
57558
+ for(let t = s+1, tl = structArray.length; t < tl; ++t) {
57559
+ let struct2 = structArray[t];
57560
+
57561
+ let chainidArray2 = Object.keys(struct2domain[struct2]);
57562
+ if(chainidArray2.length == 0) continue;
57563
+
57362
57564
  for(let j = 0, jl = chainidArray2.length; j < jl; ++j) {
57363
57565
  let chainid2 = chainidArray2[j];
57364
57566
 
57365
57567
  let alignAjax;
57366
57568
  if(me.cfg.aligntool != 'tmalign') {
57367
57569
  let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
57368
-
57570
+
57369
57571
  let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
57370
57572
  alignAjax = me.getAjaxPostPromise(urlalign, dataObj);
57371
57573
  }
@@ -57390,7 +57592,14 @@ class RealignParser {
57390
57592
 
57391
57593
  let allPromise = Promise.allSettled(ajaxArray);
57392
57594
  // try {
57595
+ // let dataArray = await allPromise;
57596
+
57597
+ let startDate = new Date();
57393
57598
  let dataArray = await allPromise;
57599
+ let endDate = new Date();
57600
+ let miliseconds = (endDate.getTime() - startDate.getTime());
57601
+ console.log("vastdyn time: " + miliseconds + " miliseconds");
57602
+
57394
57603
  ic.qt_start_end = []; // reset the alignment
57395
57604
  await ic.chainalignParserCls.downloadChainalignmentPart2bRealign(dataArray, chainidPairArray, bReverse);
57396
57605
  // }
@@ -59614,6 +59823,7 @@ class LoadAtomData {
59614
59823
 
59615
59824
  //This function was used to parse atom "data" to set up parameters for the 3D viewer. "type" is mmcifid or mmdbid.
59616
59825
  //"id" is the MMDB ID or mmCIF ID.
59826
+ // thi sfunction is NOT used for mmCIF loading any more
59617
59827
  loadAtomDataIn(data, id, type, seqalign, alignType, chainidInput, chainIndex, bLastQuery, bNoSeqalign) { let ic = this.icn3d, me = ic.icn3dui;
59618
59828
  //ic.init();
59619
59829
  ic.pmin = new THREE.Vector3( 9999, 9999, 9999);
@@ -59757,13 +59967,6 @@ class LoadAtomData {
59757
59967
  if(ic.pdbid_chain2title === undefined) ic.pdbid_chain2title = {};
59758
59968
  ic.pdbid_chain2title[chainid] = data.moleculeInfor[molid].name;
59759
59969
 
59760
- //if(alignType == 'query' && chain == ic.chain_q) {
59761
- // ic.alignmolid2color[0][molid] = molidCnt.toString();
59762
- //}
59763
- //else if(alignType == 'target' && chain == ic.chain_t) {
59764
- // ic.alignmolid2color[1][molid] = molidCnt.toString();
59765
- //}
59766
-
59767
59970
  if(chain == chainid.substr(chainid.lastIndexOf('_')) ) {
59768
59971
  let tmpHash = {};
59769
59972
  tmpHash[molid] = molidCnt.toString();
@@ -59955,17 +60158,15 @@ class LoadAtomData {
59955
60158
  ic.pmin.min(atm.coord);
59956
60159
  ic.pmax.max(atm.coord);
59957
60160
  ic.psum.add(atm.coord);
59958
-
59959
- let bNonMmcif = (me.cfg.mmcifid === undefined && me.cfg.mmtfid === undefined && me.cfg.bcifid === undefined && ic.InputfileType != 'mmcif');
59960
- let bProtein = (bNonMmcif) ? chainid2kind[chainNum] === 'protein' : atm.mt === 'p';
59961
- let bNucleotide = (bNonMmcif) ? chainid2kind[chainNum] === 'nucleotide' : atm.mt === 'n';
59962
- let bSolvent = (bNonMmcif) ? chainid2kind[chainNum] === 'solvent' : atm.mt === 's';
60161
+ let bProtein = chainid2kind[chainNum] === 'protein' ;
60162
+ let bNucleotide = chainid2kind[chainNum] === 'nucleotide' ;
60163
+ let bSolvent = chainid2kind[chainNum] === 'solvent' ;
59963
60164
  // in vastplus.cgi, ions arenotlisted in alignedStructures...molecules, thus chainid2kind[chainNum] === undefined is used.
59964
60165
  // ions will be separated from chemicals later.
59965
60166
  // here "ligand" is used in the cgi output
59966
60167
  //var bChemicalIons =(me.cfg.mmcifid === undefined) ?(chainid2kind[chainNum] === 'ligand' || chainid2kind[chainNum] === 'otherPolymer' || chainid2kind[chainNum] === undefined) : atm.mt === 'l';
59967
60168
  // kind: other, otherPolymer, etc
59968
- let bChemicalIons = (bNonMmcif) ? (chainid2kind[chainNum] === 'ligand' ||(chainid2kind[chainNum] !== undefined && chainid2kind[chainNum].indexOf('other') !== -1) || chainid2kind[chainNum] === undefined) : atm.mt === 'l';
60169
+ let bChemicalIons = (chainid2kind[chainNum] === 'ligand' ||(chainid2kind[chainNum] !== undefined && chainid2kind[chainNum].indexOf('other') !== -1) || chainid2kind[chainNum] === undefined) ;
59969
60170
 
59970
60171
  if((atm.chain === 'Misc' || chainid2kind[chainNum] === 'other') && biopolymerChainsHash[chainNum] !== 'protein' && biopolymerChainsHash[chainNum] !== 'nucleotide') { // biopolymer, could be protein or nucleotide
59971
60172
  if(atm.name === 'CA' && atm.elem === 'C') {
@@ -60229,18 +60430,17 @@ class LoadAtomData {
60229
60430
 
60230
60431
  // update bonds info
60231
60432
  if(type !== 'mmcifid') {
60232
- //for(let i in ic.atoms) {
60233
- for(let i in atoms) {
60234
- let currSerial = atomid2serial[i];
60433
+ //for(let i in ic.atoms) {
60434
+ for(let i in atoms) {
60435
+ let currSerial = atomid2serial[i];
60235
60436
 
60236
- let bondLength =(ic.atoms[currSerial].bonds === undefined) ? 0 : ic.atoms[currSerial].bonds.length;
60437
+ let bondLength =(ic.atoms[currSerial].bonds === undefined) ? 0 : ic.atoms[currSerial].bonds.length;
60237
60438
 
60238
- for(let j = 0; j < bondLength; ++j) {
60239
- ic.atoms[currSerial].bonds[j] = atomid2serial[ic.atoms[currSerial].bonds[j]];
60439
+ for(let j = 0; j < bondLength; ++j) {
60440
+ ic.atoms[currSerial].bonds[j] = atomid2serial[ic.atoms[currSerial].bonds[j]];
60441
+ }
60240
60442
  }
60241
60443
  }
60242
- }
60243
-
60244
60444
  // remove the reference
60245
60445
  data.atoms = {};
60246
60446
 
@@ -60336,7 +60536,7 @@ class LoadAtomData {
60336
60536
  // display the structure right away. load the mns and sequences later
60337
60537
  // setTimeout(function(){
60338
60538
  let hAtoms = {};
60339
-
60539
+
60340
60540
  if(type === 'align' && seqalign !== undefined && ic.bFullUi) {
60341
60541
  ic.setSeqAlignCls.setSeqAlign(seqalign, data.alignedStructures);
60342
60542
  } // if(align
@@ -60359,7 +60559,7 @@ class LoadAtomData {
60359
60559
  hAtoms = ic.hAtoms;
60360
60560
  }
60361
60561
  }
60362
- else if(type === 'mmdbid' && alignType === 'target') {
60562
+ else { //if(type === 'mmdbid' && alignType === 'target') {
60363
60563
  hAtoms = ic.hAtoms;
60364
60564
  }
60365
60565
 
@@ -60693,13 +60893,19 @@ class SetSeqAlign {
60693
60893
  resi = pos;
60694
60894
  }
60695
60895
  else {
60696
- if(ic.posid2resid) {
60697
- let resid = ic.posid2resid[chainid + '_' + pos];
60698
- resi = resid.substr(resid.lastIndexOf('_') + 1);
60699
- }
60700
- else {
60896
+ // if(ic.posid2resid) {
60897
+ // let resid = ic.posid2resid[chainid + '_' + pos];
60898
+ // resi = resid.substr(resid.lastIndexOf('_') + 1);
60899
+ // }
60900
+ // else {
60901
+ // resi = (ic.chainsSeq[chainid][pos].resi) ? ic.chainsSeq[chainid][pos].resi : pos;
60902
+ if(pos > ic.chainsSeq[chainid].length - 1) {
60903
+ console.log("Error: the position " + pos + " exceeds the max index " + (ic.chainsSeq[chainid].length - 1));
60904
+ pos = ic.chainsSeq[chainid].length - 1;
60905
+ }
60906
+
60701
60907
  resi = ic.chainsSeq[chainid][pos].resi;
60702
- }
60908
+ // }
60703
60909
  }
60704
60910
 
60705
60911
  return resi;
@@ -62784,17 +62990,6 @@ class LoadCIF {
62784
62990
  loadCIF(bcifData, bcifid, bText, bAppend) { let ic = this.icn3d, me = ic.icn3dui;
62785
62991
  let hAtoms = {};
62786
62992
 
62787
- // bcifData could be binary or text
62788
- let parsed = (bText) ? CIFTools.Text.parse(bcifData) : CIFTools.Binary.parse(bcifData);
62789
-
62790
- if (parsed.isError) {
62791
- // report error:
62792
- var aaa = 1; //alert("The Binary CIF data can NOT be parsed: " + parsed.toString());
62793
- return;
62794
- }
62795
-
62796
- let block = parsed.result.dataBlocks[0];
62797
-
62798
62993
  let bNMR = false;
62799
62994
  // let lines = src.split('\n');
62800
62995
 
@@ -62830,92 +63025,152 @@ class LoadCIF {
62830
63025
 
62831
63026
  let bFirstAtom = true;
62832
63027
 
62833
- if(block.getCategory("_entry")) {
62834
- id = block.getCategory("_entry").getColumn("id").getString(0);
63028
+ let cifArray = bcifData.split('ENDMDL\n');
62835
63029
 
62836
- if(id == '') {
62837
- if(bAppend) {
62838
- id = ic.defaultPdbId;
62839
- }
62840
- else {
62841
- //if(!ic.inputid) ic.inputid = ic.defaultPdbId;
62842
- id = (ic.inputid && ic.inputid.indexOf('/') == -1) ? ic.inputid.substr(0, 10) : ic.defaultPdbId; //ic.filename.substr(0, 4);
62843
- }
62844
- }
63030
+ for(let index = 0, indexl = cifArray.length; index < indexl; ++index) {
63031
+ ++moleculeNum;
63032
+ id = ic.defaultPdbId;
62845
63033
 
62846
63034
  structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
62847
63035
 
62848
- ic.molTitle = '';
62849
- ic.molTitleHash = {};
62850
- }
62851
-
62852
- if(block.getCategory("_struct")) {
62853
- let title = block.getCategory("_struct").getColumn("title").getString(0);
62854
- title = title.replace(/"/, "'");
62855
- let name = title.replace(/ALPHAFOLD MONOMER V2.0 PREDICTION FOR /gi, '');
62856
- ic.molTitle += name.trim() + " ";
62857
- // if(bEsmfold && ic.esmTitle) ic.molTitle = ic.esmTitle;
63036
+ // if(!bNMR) {
63037
+ sheetArray = [];
63038
+ sheetStart = [];
63039
+ sheetEnd = [];
63040
+ helixArray = [];
63041
+ helixStart = [];
63042
+ helixEnd = [];
62858
63043
 
62859
- if(!ic.molTitleHash) ic.molTitleHash = {};
62860
- ic.molTitleHash[structure] = ic.molTitle;
62861
63044
 
62862
- }
63045
+ // bcifData could be binary or text
63046
+ let parsed = (bText) ? CIFTools.Text.parse(cifArray[index]) : CIFTools.Binary.parse(cifArray[index]);
62863
63047
 
62864
- if(block.getCategory("_entity_src_gen")) {
62865
- ic.organism = block.getCategory("_entity_src_gen").getColumn("gene_src_common_name").getString(0);
62866
- }
62867
-
62868
- if(block.getCategory("_database_2")) {
62869
- let database_2 = block.getCategory("_database_2");
62870
-
62871
- // Iterate through every row in the table
62872
- let db2Size = database_2.rowCount ;
62873
- for (let i = 0; i < db2Size; ++i) {
62874
- let db_id = database_2.getColumn("database_id").getString(0);
62875
- let db_code = database_2.getColumn("database_code").getString(0);
63048
+ if (parsed.isError) {
63049
+ // report error:
63050
+ var aaa = 1; //alert("The Binary CIF data can NOT be parsed: " + parsed.toString());
63051
+ return;
63052
+ }
63053
+
63054
+ let block = parsed.result.dataBlocks[0];
62876
63055
 
62877
- if(db_id == "EMDB") {
62878
- ic.emd = db_code;
62879
- break;
63056
+ if(block.getCategory("_entry")) {
63057
+ id = block.getCategory("_entry").getColumn("id").getString(0);
63058
+
63059
+ if(id == '') {
63060
+ if(bAppend) {
63061
+ id = ic.defaultPdbId;
63062
+ }
63063
+ else {
63064
+ //if(!ic.inputid) ic.inputid = ic.defaultPdbId;
63065
+ id = (ic.inputid && ic.inputid.indexOf('/') == -1) ? ic.inputid.substr(0, 10) : ic.defaultPdbId; //ic.filename.substr(0, 4);
63066
+ }
62880
63067
  }
63068
+
63069
+ structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
63070
+
63071
+ ic.molTitle = '';
63072
+ ic.molTitleHash = {};
62881
63073
  }
62882
- }
63074
+
63075
+ if(block.getCategory("_struct")) {
63076
+ let title = block.getCategory("_struct").getColumn("title").getString(0);
63077
+ title = title.replace(/"/, "'");
63078
+ let name = title.replace(/ALPHAFOLD MONOMER V2.0 PREDICTION FOR /gi, '');
63079
+ ic.molTitle += name.trim() + " ";
63080
+ // if(bEsmfold && ic.esmTitle) ic.molTitle = ic.esmTitle;
62883
63081
 
62884
- if(block.getCategory("_struct_conf")) {
62885
- ic.bSecondaryStructure = true;
63082
+ if(!ic.molTitleHash) ic.molTitleHash = {};
63083
+ ic.molTitleHash[structure] = ic.molTitle;
62886
63084
 
62887
- // Retrieve the table corresponding to the struct_conf category, which delineates mainly helix
62888
- let struct_conf = block.getCategory("_struct_conf");
62889
-
62890
- let conf_type_idArray = struct_conf.getColumn("conf_type_id");
62891
-
62892
- let chain1Array = struct_conf.getColumn("beg_auth_asym_id");
62893
- // let resi1Array = struct_conf.getColumn("beg_label_seq_id");
62894
- let resi1Array = struct_conf.getColumn("beg_auth_seq_id");
62895
-
62896
- struct_conf.getColumn("end_auth_asym_id");
62897
- // let resi2Array = struct_conf.getColumn("end_label_seq_id");
62898
- let resi2Array = struct_conf.getColumn("end_auth_seq_id");
62899
-
62900
- // Iterate through every row in the struct_conf category table, where each row delineates an interatomic connection
62901
- let confSize = struct_conf.rowCount;
62902
- for (let i = 0; i < confSize; ++i) {
62903
- let conf_type_id = conf_type_idArray.getString(i);
63085
+ }
63086
+
63087
+ if(block.getCategory("_entity_src_gen")) {
63088
+ ic.organism = block.getCategory("_entity_src_gen").getColumn("gene_src_common_name").getString(0);
63089
+ }
62904
63090
 
62905
- let startChain = chain1Array.getString(i);
62906
- let startResi = parseInt(resi1Array.getString(i));
62907
- let endResi = parseInt(resi2Array.getString(i));
63091
+ if(block.getCategory("_database_2")) {
63092
+ let database_2 = block.getCategory("_database_2");
62908
63093
 
62909
- if(conf_type_id.substr(0, 4) == "HELX") {
62910
- for(let j = parseInt(startResi); j <= parseInt(endResi); ++j) {
62911
- let resid = structure + "_" + startChain + "_" + j;
62912
- helixArray.push(resid);
62913
-
62914
- if(j == startResi) helixStart.push(resid);
62915
- if(j == endResi) helixEnd.push(resid);
62916
- }
63094
+ // Iterate through every row in the table
63095
+ let db2Size = database_2.rowCount ;
63096
+ for (let i = 0; i < db2Size; ++i) {
63097
+ let db_id = database_2.getColumn("database_id").getString(0);
63098
+ let db_code = database_2.getColumn("database_code").getString(0);
63099
+
63100
+ if(db_id == "EMDB") {
63101
+ ic.emd = db_code;
63102
+ break;
63103
+ }
62917
63104
  }
62918
- else if(conf_type_id.substr(0, 4) == "STRN") {
63105
+ }
63106
+
63107
+ if(block.getCategory("_struct_conf")) {
63108
+ ic.bSecondaryStructure = true;
63109
+
63110
+ // Retrieve the table corresponding to the struct_conf category, which delineates mainly helix
63111
+ let struct_conf = block.getCategory("_struct_conf");
63112
+
63113
+ let conf_type_idArray = struct_conf.getColumn("conf_type_id");
63114
+
63115
+ let chain1Array = struct_conf.getColumn("beg_auth_asym_id");
63116
+ // let resi1Array = struct_conf.getColumn("beg_label_seq_id");
63117
+ let resi1Array = struct_conf.getColumn("beg_auth_seq_id");
63118
+
63119
+ struct_conf.getColumn("end_auth_asym_id");
63120
+ // let resi2Array = struct_conf.getColumn("end_label_seq_id");
63121
+ let resi2Array = struct_conf.getColumn("end_auth_seq_id");
63122
+
63123
+ // Iterate through every row in the struct_conf category table, where each row delineates an interatomic connection
63124
+ let confSize = struct_conf.rowCount;
63125
+ for (let i = 0; i < confSize; ++i) {
63126
+ let conf_type_id = conf_type_idArray.getString(i);
63127
+
63128
+ let startChain = chain1Array.getString(i);
63129
+ let startResi = parseInt(resi1Array.getString(i));
63130
+ let endResi = parseInt(resi2Array.getString(i));
63131
+
63132
+ if(conf_type_id.substr(0, 4) == "HELX") {
63133
+ for(let j = parseInt(startResi); j <= parseInt(endResi); ++j) {
63134
+ let resid = structure + "_" + startChain + "_" + j;
63135
+ helixArray.push(resid);
63136
+
63137
+ if(j == startResi) helixStart.push(resid);
63138
+ if(j == endResi) helixEnd.push(resid);
63139
+ }
63140
+ }
63141
+ else if(conf_type_id.substr(0, 4) == "STRN") {
63142
+ for(let j = startResi; j <= endResi; ++j) {
63143
+ let resid = structure + "_" + startChain + "_" + j;
63144
+ sheetArray.push(resid);
63145
+
63146
+ if(j == startResi) sheetStart.push(resid);
63147
+ if(j == endResi) sheetEnd.push(resid);
63148
+ }
63149
+ }
63150
+ }
63151
+
63152
+ conf_type_idArray = chain1Array = resi1Array = resi2Array = [];
63153
+ }
63154
+
63155
+ if(block.getCategory("_struct_sheet_range")) {
63156
+ // Retrieve the table corresponding to the struct_sheet_range category, which delineates mainly beta sheet
63157
+ let struct_sheet_range = block.getCategory("_struct_sheet_range");
63158
+
63159
+ let chain1Array = struct_sheet_range.getColumn("beg_auth_asym_id");
63160
+ // let resi1Array = struct_sheet_range.getColumn("beg_label_seq_id");
63161
+ let resi1Array = struct_sheet_range.getColumn("beg_auth_seq_id");
63162
+
63163
+ struct_sheet_range.getColumn("end_auth_asym_id");
63164
+ // let resi2Array = struct_sheet_range.getColumn("end_label_seq_id");
63165
+ let resi2Array = struct_sheet_range.getColumn("end_auth_seq_id");
63166
+
63167
+ // Iterate through every row in the struct_sheet_range category table, where each row delineates an interatomic connection
63168
+ let sheetSize = struct_sheet_range.rowCount;
63169
+ for (let i = 0; i < sheetSize; ++i) {
63170
+ let startChain = chain1Array.getString(i);
63171
+ let startResi = parseInt(resi1Array.getString(i));
63172
+ let endResi = parseInt(resi2Array.getString(i));
63173
+
62919
63174
  for(let j = startResi; j <= endResi; ++j) {
62920
63175
  let resid = structure + "_" + startChain + "_" + j;
62921
63176
  sheetArray.push(resid);
@@ -62924,500 +63179,469 @@ class LoadCIF {
62924
63179
  if(j == endResi) sheetEnd.push(resid);
62925
63180
  }
62926
63181
  }
63182
+
63183
+ chain1Array = resi1Array = resi2Array = [];
62927
63184
  }
62928
-
62929
- conf_type_idArray = chain1Array = resi1Array = resi2Array = [];
62930
- }
62931
-
62932
- if(block.getCategory("_struct_sheet_range")) {
62933
- // Retrieve the table corresponding to the struct_sheet_range category, which delineates mainly beta sheet
62934
- let struct_sheet_range = block.getCategory("_struct_sheet_range");
62935
-
62936
- let chain1Array = struct_sheet_range.getColumn("beg_auth_asym_id");
62937
- // let resi1Array = struct_sheet_range.getColumn("beg_label_seq_id");
62938
- let resi1Array = struct_sheet_range.getColumn("beg_auth_seq_id");
62939
-
62940
- struct_sheet_range.getColumn("end_auth_asym_id");
62941
- // let resi2Array = struct_sheet_range.getColumn("end_label_seq_id");
62942
- let resi2Array = struct_sheet_range.getColumn("end_auth_seq_id");
62943
-
62944
- // Iterate through every row in the struct_sheet_range category table, where each row delineates an interatomic connection
62945
- let sheetSize = struct_sheet_range.rowCount;
62946
- for (let i = 0; i < sheetSize; ++i) {
62947
- let startChain = chain1Array.getString(i);
62948
- let startResi = parseInt(resi1Array.getString(i));
62949
- let endResi = parseInt(resi2Array.getString(i));
62950
-
62951
- for(let j = startResi; j <= endResi; ++j) {
62952
- let resid = structure + "_" + startChain + "_" + j;
62953
- sheetArray.push(resid);
62954
-
62955
- if(j == startResi) sheetStart.push(resid);
62956
- if(j == endResi) sheetEnd.push(resid);
62957
- }
62958
- }
62959
-
62960
- chain1Array = resi1Array = resi2Array = [];
62961
- }
62962
63185
 
62963
- if(block.getCategory("_struct_conn")) {
62964
- ic.bSsbondProvided = true;
63186
+ if(block.getCategory("_struct_conn")) {
63187
+ ic.bSsbondProvided = true;
62965
63188
 
62966
- // Retrieve the table corresponding to the struct_conn category, which delineates connections1
62967
- let struct_conn = block.getCategory("_struct_conn");
62968
-
62969
- let conn_type_idArray = struct_conn.getColumn("conn_type_id");
62970
-
62971
- let chain1Array = struct_conn.getColumn("ptnr1_auth_asym_id");
62972
- let name1Array = struct_conn.getColumn("ptnr1_label_atom_id");
62973
- let resi1Array = struct_conn.getColumn("ptnr1_label_seq_id");
62974
-
62975
- let chain2Array = struct_conn.getColumn("ptnr2_auth_asym_id");
62976
- let name2Array = struct_conn.getColumn("ptnr2_label_atom_id");
62977
- let resi2Array = struct_conn.getColumn("ptnr2_label_seq_id");
62978
-
62979
- let connSize = struct_conn.rowCount;
62980
- for (let i = 0; i < connSize; ++i) {
62981
- let conn_type_id = conn_type_idArray.getString(i);
63189
+ // Retrieve the table corresponding to the struct_conn category, which delineates connections1
63190
+ let struct_conn = block.getCategory("_struct_conn");
62982
63191
 
62983
- let chain1 = chain1Array.getString(i);
62984
- name1Array.getString(i);
62985
- let resi1 = resi1Array.getString(i);
62986
- let id1 = structure + '_' + chain1 + "_" + resi1;
63192
+ let conn_type_idArray = struct_conn.getColumn("conn_type_id");
62987
63193
 
62988
- let chain2 = chain2Array.getString(i);
62989
- name2Array.getString(i);
62990
- let resi2 = resi2Array.getString(i);
62991
- let id2 = structure + '_' + chain2 + "_" + resi2;
63194
+ let chain1Array = struct_conn.getColumn("ptnr1_auth_asym_id");
63195
+ let name1Array = struct_conn.getColumn("ptnr1_label_atom_id");
63196
+ let resi1Array = struct_conn.getColumn("ptnr1_label_seq_id");
62992
63197
 
62993
- // Verify that the linkage is covalent, as indicated by the conn_type_id attribute2
63198
+ let chain2Array = struct_conn.getColumn("ptnr2_auth_asym_id");
63199
+ let name2Array = struct_conn.getColumn("ptnr2_label_atom_id");
63200
+ let resi2Array = struct_conn.getColumn("ptnr2_label_seq_id");
62994
63201
 
62995
- // if (conn_type_id == "covale") {
62996
- // vBonds.push(id1);
62997
- // vBonds.push(id2);
62998
- // }
63202
+ let connSize = struct_conn.rowCount;
63203
+ for (let i = 0; i < connSize; ++i) {
63204
+ let conn_type_id = conn_type_idArray.getString(i);
62999
63205
 
63000
- if(conn_type_id == "disulf") {
63001
- if(ic.ssbondpnts[structure] === undefined) ic.ssbondpnts[structure] = [];
63206
+ let chain1 = chain1Array.getString(i);
63207
+ name1Array.getString(i);
63208
+ let resi1 = resi1Array.getString(i);
63209
+ let id1 = structure + '_' + chain1 + "_" + resi1;
63210
+
63211
+ let chain2 = chain2Array.getString(i);
63212
+ name2Array.getString(i);
63213
+ let resi2 = resi2Array.getString(i);
63214
+ let id2 = structure + '_' + chain2 + "_" + resi2;
63215
+
63216
+ // Verify that the linkage is covalent, as indicated by the conn_type_id attribute2
63217
+
63218
+ // if (conn_type_id == "covale") {
63219
+ // vBonds.push(id1);
63220
+ // vBonds.push(id2);
63221
+ // }
63222
+
63223
+ if(conn_type_id == "disulf") {
63224
+ if(ic.ssbondpnts[structure] === undefined) ic.ssbondpnts[structure] = [];
63002
63225
 
63003
- ic.ssbondpnts[structure].push(id1);
63004
- ic.ssbondpnts[structure].push(id2);
63226
+ ic.ssbondpnts[structure].push(id1);
63227
+ ic.ssbondpnts[structure].push(id2);
63228
+ }
63005
63229
  }
63230
+
63231
+ conn_type_idArray = chain1Array = name1Array = resi1Array = chain2Array = name2Array = resi2Array = [];
63006
63232
  }
63007
-
63008
- conn_type_idArray = chain1Array = name1Array = resi1Array = chain2Array = name2Array = resi2Array = [];
63009
- }
63010
63233
 
63011
- if(block.getCategory("_exptl")) {
63012
- let method = block.getCategory("_exptl").getColumn("method").getString(0);
63013
- if(method.indexOf('NMR') != -1) {
63014
- bNMR = true;
63234
+ if(block.getCategory("_exptl")) {
63235
+ let method = block.getCategory("_exptl").getColumn("method").getString(0);
63236
+ if(method.indexOf('NMR') != -1) {
63237
+ bNMR = true;
63238
+ }
63015
63239
  }
63016
- }
63017
63240
 
63018
- if(block.getCategory("_pdbx_struct_oper_list")) {
63019
- // Retrieve the table corresponding to the struct_oper_list category, which delineates assembly
63020
- let struct_oper_list = block.getCategory("_pdbx_struct_oper_list");
63021
-
63022
- let struct_oper_idArray = struct_oper_list.getColumn("id");
63023
- let m11Array = struct_oper_list.getColumn("matrix[1][1]");
63024
- let m12Array = struct_oper_list.getColumn("matrix[1][2]");
63025
- let m13Array = struct_oper_list.getColumn("matrix[1][3]");
63026
- let m14Array = struct_oper_list.getColumn("vector[1]");
63027
-
63028
- let m21Array = struct_oper_list.getColumn("matrix[2][1]");
63029
- let m22Array = struct_oper_list.getColumn("matrix[2][2]");
63030
- let m23Array = struct_oper_list.getColumn("matrix[2][3]");
63031
- let m24Array = struct_oper_list.getColumn("vector[2]");
63032
-
63033
- let m31Array = struct_oper_list.getColumn("matrix[3][1]");
63034
- let m32Array = struct_oper_list.getColumn("matrix[3][2]");
63035
- let m33Array = struct_oper_list.getColumn("matrix[3][3]");
63036
- let m34Array = struct_oper_list.getColumn("vector[3]");
63037
-
63038
- let assemblySize = struct_oper_list.rowCount;
63039
- for (let i = 0; i < assemblySize; ++i) {
63040
- let struct_oper_id = struct_oper_idArray.getString(i);
63041
- if(struct_oper_id == "X0") continue;
63241
+ if(block.getCategory("_pdbx_struct_oper_list")) {
63242
+ // Retrieve the table corresponding to the struct_oper_list category, which delineates assembly
63243
+ let struct_oper_list = block.getCategory("_pdbx_struct_oper_list");
63244
+
63245
+ let struct_oper_idArray = struct_oper_list.getColumn("id");
63246
+ let m11Array = struct_oper_list.getColumn("matrix[1][1]");
63247
+ let m12Array = struct_oper_list.getColumn("matrix[1][2]");
63248
+ let m13Array = struct_oper_list.getColumn("matrix[1][3]");
63249
+ let m14Array = struct_oper_list.getColumn("vector[1]");
63250
+
63251
+ let m21Array = struct_oper_list.getColumn("matrix[2][1]");
63252
+ let m22Array = struct_oper_list.getColumn("matrix[2][2]");
63253
+ let m23Array = struct_oper_list.getColumn("matrix[2][3]");
63254
+ let m24Array = struct_oper_list.getColumn("vector[2]");
63255
+
63256
+ let m31Array = struct_oper_list.getColumn("matrix[3][1]");
63257
+ let m32Array = struct_oper_list.getColumn("matrix[3][2]");
63258
+ let m33Array = struct_oper_list.getColumn("matrix[3][3]");
63259
+ let m34Array = struct_oper_list.getColumn("vector[3]");
63260
+
63261
+ let assemblySize = struct_oper_list.rowCount;
63262
+ for (let i = 0; i < assemblySize; ++i) {
63263
+ let struct_oper_id = struct_oper_idArray.getString(i);
63264
+ if(struct_oper_id == "X0") continue;
63042
63265
 
63043
- if (ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
63044
- ic.biomtMatrices[i].set(m11Array.getString(i), m12Array.getString(i), m13Array.getString(i), m14Array.getString(i),
63045
- m21Array.getString(i), m22Array.getString(i), m23Array.getString(i), m24Array.getString(i),
63046
- m31Array.getString(i), m32Array.getString(i), m33Array.getString(i), m34Array.getString(i),
63047
- 0, 0, 0, 1);
63266
+ if (ic.biomtMatrices[i] == undefined) ic.biomtMatrices[i] = new THREE.Matrix4().identity();
63267
+ ic.biomtMatrices[i].set(m11Array.getString(i), m12Array.getString(i), m13Array.getString(i), m14Array.getString(i),
63268
+ m21Array.getString(i), m22Array.getString(i), m23Array.getString(i), m24Array.getString(i),
63269
+ m31Array.getString(i), m32Array.getString(i), m33Array.getString(i), m34Array.getString(i),
63270
+ 0, 0, 0, 1);
63271
+ }
63272
+
63273
+ struct_oper_idArray = m11Array = m12Array = m13Array = m14Array = m21Array = m22Array = m23Array
63274
+ = m24Array = m31Array = m32Array = m33Array = m34Array = [];
63048
63275
  }
63049
-
63050
- struct_oper_idArray = m11Array = m12Array = m13Array = m14Array = m21Array = m22Array = m23Array
63051
- = m24Array = m31Array = m32Array = m33Array = m34Array = [];
63052
- }
63053
63276
 
63054
- // if (record === 'ENDMDL') {
63055
- // ++moleculeNum;
63056
- // id = ic.defaultPdbId;
63277
+ // if (record === 'ENDMDL') {
63278
+ // ++moleculeNum;
63279
+ // id = ic.defaultPdbId;
63057
63280
 
63058
- // structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
63281
+ // structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
63059
63282
 
63060
- // //helices = [];
63061
- // //sheets = [];
63062
- // if(!bNMR) {
63063
- // sheetArray = [];
63064
- // sheetStart = [];
63065
- // sheetEnd = [];
63066
- // helixArray = [];
63067
- // helixStart = [];
63068
- // helixEnd = [];
63069
- // }
63283
+ // //helices = [];
63284
+ // //sheets = [];
63285
+ // if(!bNMR) {
63286
+ // sheetArray = [];
63287
+ // sheetStart = [];
63288
+ // sheetEnd = [];
63289
+ // helixArray = [];
63290
+ // helixStart = [];
63291
+ // helixEnd = [];
63292
+ // }
63070
63293
 
63071
- // bHeader = false; // reinitialize to read structure name from the header
63072
- // }
63294
+ // bHeader = false; // reinitialize to read structure name from the header
63295
+ // }
63073
63296
 
63074
- if(block.getCategory("_citation")) {
63075
- ic.pmid = block.getCategory("_citation").getColumn("pdbx_database_id_PubMed").getString(0);
63076
- }
63297
+ if(block.getCategory("_citation")) {
63298
+ ic.pmid = block.getCategory("_citation").getColumn("pdbx_database_id_PubMed").getString(0);
63299
+ }
63077
63300
 
63078
- // Retrieve the table corresponding to the atom_site category, which delineates atomic constituents
63079
- let atom_site = block.getCategory("_atom_site");
63080
- let atomSize = atom_site.rowCount;
63081
- // let bFull = (atomSize * 10 > ic.maxatomcnt) ? false : true;
63082
- let bFull = (atomSize > ic.maxatomcnt) ? false : true;
63301
+ // Retrieve the table corresponding to the atom_site category, which delineates atomic constituents
63302
+ let atom_site = block.getCategory("_atom_site");
63303
+ let atomSize = atom_site.rowCount;
63304
+ // let bFull = (atomSize * 10 > ic.maxatomcnt) ? false : true;
63305
+ let bFull = (atomSize > ic.maxatomcnt) ? false : true;
63083
63306
 
63084
- if(!bFull) {
63085
- ic.opts['proteins'] = 'c alpha trace'; //ribbon, strand, cylinder and plate, schematic, c alpha trace, b factor tube, lines, stick, ball and stick, sphere, nothing
63086
- ic.opts['nucleotides'] = 'o3 trace'; //nucleotide cartoon, o3 trace, schematic, lines, stick,
63087
- }
63307
+ if(!bFull) {
63308
+ ic.opts['proteins'] = 'c alpha trace'; //ribbon, strand, cylinder and plate, schematic, c alpha trace, b factor tube, lines, stick, ball and stick, sphere, nothing
63309
+ ic.opts['nucleotides'] = 'o3 trace'; //nucleotide cartoon, o3 trace, schematic, lines, stick,
63310
+ }
63088
63311
 
63089
- let atom_hetatmArray = atom_site.getColumn("group_PDB");
63090
- let resnArray = atom_site.getColumn("label_comp_id");
63091
- let elemArray = atom_site.getColumn("type_symbol");
63092
- let nameArray = atom_site.getColumn("label_atom_id");
63312
+ let atom_hetatmArray = atom_site.getColumn("group_PDB");
63313
+ let resnArray = atom_site.getColumn("label_comp_id");
63314
+ let elemArray = atom_site.getColumn("type_symbol");
63315
+ let nameArray = atom_site.getColumn("label_atom_id");
63093
63316
 
63094
- let chainArray = atom_site.getColumn("auth_asym_id");
63317
+ let chainArray = atom_site.getColumn("auth_asym_id");
63095
63318
 
63096
- let resiArray = atom_site.getColumn("label_seq_id");
63097
- let resiOriArray = atom_site.getColumn("auth_seq_id");
63098
- let altArray = atom_site.getColumn("label_alt_id");
63319
+ let resiArray = atom_site.getColumn("label_seq_id");
63320
+ let resiOriArray = atom_site.getColumn("auth_seq_id");
63321
+ let altArray = atom_site.getColumn("label_alt_id");
63099
63322
 
63100
- let bArray = atom_site.getColumn("B_iso_or_equiv");
63323
+ let bArray = atom_site.getColumn("B_iso_or_equiv");
63101
63324
 
63102
- let xArray = atom_site.getColumn("Cartn_x");
63103
- let yArray = atom_site.getColumn("Cartn_y");
63104
- let zArray = atom_site.getColumn("Cartn_z");
63325
+ let xArray = atom_site.getColumn("Cartn_x");
63326
+ let yArray = atom_site.getColumn("Cartn_y");
63327
+ let zArray = atom_site.getColumn("Cartn_z");
63105
63328
 
63106
- let autochainArray = atom_site.getColumn("label_asym_id");
63329
+ let autochainArray = atom_site.getColumn("label_asym_id");
63107
63330
 
63108
- // get the bond info
63109
- let ligSeqHash = {}, prevAutochain = '';
63110
- let prevResn;
63111
- let sChain = {};
63112
- for (let i = 0; i < atomSize; ++i) {
63113
- let atom_hetatm = atom_hetatmArray.getString(i);
63114
- let resn = resnArray.getString(i);
63115
- let elem = elemArray.getString(i);
63116
- let atom = nameArray.getString(i);
63117
- let chain = chainArray.getString(i);
63118
- let resi = resiArray.getString(i);
63119
- let oriResi = resiOriArray.getString(i);
63120
- let alt = altArray.getString(i);
63121
- let bFactor = bArray.getString(i);
63331
+ // get the bond info
63332
+ let ligSeqHash = {}, prevAutochain = '';
63333
+ let prevResn;
63334
+ let sChain = {};
63335
+ for (let i = 0; i < atomSize; ++i) {
63336
+ let atom_hetatm = atom_hetatmArray.getString(i);
63337
+ let resn = resnArray.getString(i);
63338
+ let elem = elemArray.getString(i);
63339
+ let atom = nameArray.getString(i);
63340
+ let chain = chainArray.getString(i);
63341
+ let resi = resiArray.getString(i);
63342
+ let oriResi = resiOriArray.getString(i);
63343
+ let alt = altArray.getString(i);
63344
+ let bFactor = bArray.getString(i);
63122
63345
 
63123
- let autochain = autochainArray.getString(i);
63346
+ let autochain = autochainArray.getString(i);
63124
63347
 
63125
63348
 
63126
- resi = oriResi;
63349
+ resi = oriResi;
63127
63350
 
63128
- let molecueType;
63129
- if(atom_hetatm == "ATOM") {
63130
- if(resn.length == 3) {
63131
- molecueType = "p"; // protein
63132
- }
63133
- else {
63134
- molecueType = "n"; // nucleotide
63135
- }
63136
- }
63137
- else {
63138
- if(resn == "WAT" || resn == "HOH") {
63139
- molecueType = "s"; // solvent
63140
- chain = 'Misc';
63351
+ let molecueType;
63352
+ if(atom_hetatm == "ATOM") {
63353
+ if(resn.length == 3) {
63354
+ molecueType = "protein"; // protein
63355
+ }
63356
+ else {
63357
+ molecueType = "nucleotide"; // nucleotide
63358
+ }
63141
63359
  }
63142
63360
  else {
63143
- molecueType = "l"; // ligands or ions
63144
- chain = resn;
63361
+ if(resn == "WAT" || resn == "HOH") {
63362
+ molecueType = "solvent"; // solvent
63363
+ chain = 'Misc';
63364
+ }
63365
+ else {
63366
+ molecueType = "ligand"; // ligands or ions
63367
+ chain = resn;
63368
+ }
63145
63369
  }
63146
- }
63147
- if(chain === '') chain = 'A';
63148
-
63149
- // C-alpha only for large structure
63150
- if(!bFull && ((molecueType == "p" && !(elem == 'C' && atom == 'CA')) || (molecueType == "n" && !(atom == "P")) ) ) continue;
63151
-
63152
- // skip alternative atoms
63153
- if(alt == "B") continue;
63154
-
63155
- sChain[chain] = 1;
63370
+ if(chain === '') chain = 'A';
63156
63371
 
63157
- if(bFirstAtom) {
63158
- structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
63372
+ // C-alpha only for large structure
63373
+ if(!bFull && ((molecueType == "protein" && !(elem == 'C' && atom == 'CA')) || (molecueType == "nucleotide" && !(atom == "P")) ) ) continue;
63374
+
63375
+ // skip alternative atoms
63376
+ if(alt == "B") continue;
63159
63377
 
63160
- bFirstAtom = false;
63161
- }
63378
+ sChain[chain] = 1;
63162
63379
 
63163
- // "CA" has to appear before "O". Otherwise the cartoon of secondary structure will have breaks
63164
- // Concatenation of two pdbs will have several atoms for the same serial
63165
- ++serial;
63380
+ if(bFirstAtom) {
63381
+ structure = ic.loadPDBCls.getStructureId(id, moleculeNum);
63166
63382
 
63167
- // if(oriResi != resi || bModifyResi) { // e.g., 99A and 99
63168
- // bModifyResi = true;
63169
- // }
63383
+ bFirstAtom = false;
63384
+ }
63170
63385
 
63171
- if(resi == "?" || resi == "." || resi == "0") {
63172
- resi = oriResi;
63386
+ // "CA" has to appear before "O". Otherwise the cartoon of secondary structure will have breaks
63387
+ // Concatenation of two pdbs will have several atoms for the same serial
63388
+ ++serial;
63173
63389
 
63174
- // if(resn.length != 3 || resn == "HOH" || resn == "WAT") {
63175
- // if(resn.length != 3 || (elem == 'O' && (resn == "HOH" || resn == "WAT"))) {
63176
- // resi = (++tmpResi).toString();
63177
- // }
63178
- // }
63179
- // else {
63180
- // if(chain + "_" + resn != prevResn || prevAutochain != autochain) {
63181
- // resi = (++tmpResi).toString();
63182
- // }
63183
- // else {
63184
- // resi = (tmpResi).toString();
63185
- // }
63390
+ // if(oriResi != resi || bModifyResi) { // e.g., 99A and 99
63391
+ // bModifyResi = true;
63186
63392
  // }
63187
- }
63188
63393
 
63189
- if(molecueType == 's' || molecueType == "l") {
63190
- let seq = {};
63191
- if(!ligSeqHash.hasOwnProperty(chain)) {
63192
- ligSeqHash[chain] = [];
63394
+ if(resi == "?" || resi == "." || resi == "0") {
63395
+ resi = oriResi;
63396
+
63397
+ // if(resn.length != 3 || resn == "HOH" || resn == "WAT") {
63398
+ // if(resn.length != 3 || (elem == 'O' && (resn == "HOH" || resn == "WAT"))) {
63399
+ // resi = (++tmpResi).toString();
63400
+ // }
63401
+ // }
63402
+ // else {
63403
+ // if(chain + "_" + resn != prevResn || prevAutochain != autochain) {
63404
+ // resi = (++tmpResi).toString();
63405
+ // }
63406
+ // else {
63407
+ // resi = (tmpResi).toString();
63408
+ // }
63409
+ // }
63193
63410
  }
63194
63411
 
63195
- if(resn.length != 3 || resn == "HOH" || resn == "WAT") {
63196
- if(resn.length != 3 || (elem == 'O' && (resn == "HOH" || resn == "WAT"))) {
63197
- seq.resi = resi;
63198
- seq.name = me.utilsCls.residueName2Abbr(resn);
63199
- ligSeqHash[chain].push(seq);
63412
+ if(molecueType == 'solvent' || molecueType == "ligand") {
63413
+ let seq = {};
63414
+ if(!ligSeqHash.hasOwnProperty(chain)) {
63415
+ ligSeqHash[chain] = [];
63200
63416
  }
63201
- }
63202
- else {
63203
- if(chain + "_" + resn != prevResn || prevAutochain != autochain) {
63204
- seq.resi = resi;
63205
- seq.name = me.utilsCls.residueName2Abbr(resn);
63206
- ligSeqHash[chain].push(seq);
63417
+
63418
+ if(resn.length != 3 || resn == "HOH" || resn == "WAT") {
63419
+ if(resn.length != 3 || (elem == 'O' && (resn == "HOH" || resn == "WAT"))) {
63420
+ seq.resi = resi;
63421
+ seq.name = me.utilsCls.residueName2Abbr(resn);
63422
+ ligSeqHash[chain].push(seq);
63423
+ }
63424
+ }
63425
+ else {
63426
+ if(chain + "_" + resn != prevResn || prevAutochain != autochain) {
63427
+ seq.resi = resi;
63428
+ seq.name = me.utilsCls.residueName2Abbr(resn);
63429
+ ligSeqHash[chain].push(seq);
63430
+ }
63207
63431
  }
63208
63432
  }
63209
- }
63210
63433
 
63211
- // if(bOpm && resn === 'DUM') {
63212
- // elem = atom;
63213
- // chain = 'MEM';
63214
- // resi = 1;
63215
- // oriResi = 1;
63216
- // }
63434
+ // if(bOpm && resn === 'DUM') {
63435
+ // elem = atom;
63436
+ // chain = 'MEM';
63437
+ // resi = 1;
63438
+ // oriResi = 1;
63439
+ // }
63217
63440
 
63218
- // if(bVector && resn === 'DUM') break; // just need to get the vector of the largest chain
63441
+ // if(bVector && resn === 'DUM') break; // just need to get the vector of the largest chain
63219
63442
 
63220
- chainNum = structure + "_" + chain;
63221
- oriResidueNum = chainNum + "_" + oriResi;
63443
+ chainNum = structure + "_" + chain;
63444
+ oriResidueNum = chainNum + "_" + oriResi;
63222
63445
 
63223
- residueNum = chainNum + "_" + resi;
63446
+ residueNum = chainNum + "_" + resi;
63224
63447
 
63225
- //let chain_resi = chain + "_" + resi;
63448
+ //let chain_resi = chain + "_" + resi;
63226
63449
 
63227
- let x = xArray.getFloat(i);
63228
- let y = yArray.getFloat(i);
63229
- let z = zArray.getFloat(i);
63230
- let coord = new THREE.Vector3(x, y, z);
63450
+ let x = xArray.getFloat(i);
63451
+ let y = yArray.getFloat(i);
63452
+ let z = zArray.getFloat(i);
63453
+ let coord = new THREE.Vector3(x, y, z);
63231
63454
 
63232
- let atomDetails = {
63233
- het: (atom_hetatm == "HETATM"), // optional, used to determine chemicals, water, ions, etc
63234
- serial: serial, // required, unique atom id
63235
- name: atom, // required, atom name
63236
- alt: alt, // optional, some alternative coordinates
63237
- resn: resn, // optional, used to determine protein or nucleotide
63238
- structure: structure, // optional, used to identify structure
63239
- chain: chain, // optional, used to identify chain
63240
- resi: resi, // optional, used to identify residue ID
63241
- //insc: line.substr(26, 1),
63242
- coord: coord, // required, used to draw 3D shape
63243
- b: bFactor, // optional, used to draw B-factor tube
63244
- elem: elem, // optional, used to determine hydrogen bond
63245
- bonds: [], // required, used to connect atoms
63246
- ss: 'coil', // optional, used to show secondary structures
63247
- ssbegin: false, // optional, used to show the beginning of secondary structures
63248
- ssend: false // optional, used to show the end of secondary structures
63249
- };
63455
+ let atomDetails = {
63456
+ het: (atom_hetatm == "HETATM"), // optional, used to determine chemicals, water, ions, etc
63457
+ serial: serial, // required, unique atom id
63458
+ name: atom, // required, atom name
63459
+ alt: alt, // optional, some alternative coordinates
63460
+ resn: resn, // optional, used to determine protein or nucleotide
63461
+ structure: structure, // optional, used to identify structure
63462
+ chain: chain, // optional, used to identify chain
63463
+ resi: resi, // optional, used to identify residue ID
63464
+ //insc: line.substr(26, 1),
63465
+ coord: coord, // required, used to draw 3D shape
63466
+ b: bFactor, // optional, used to draw B-factor tube
63467
+ elem: elem, // optional, used to determine hydrogen bond
63468
+ bonds: [], // required, used to connect atoms
63469
+ ss: 'coil', // optional, used to show secondary structures
63470
+ ssbegin: false, // optional, used to show the beginning of secondary structures
63471
+ ssend: false // optional, used to show the end of secondary structures
63472
+ };
63250
63473
 
63251
- if(!atomDetails.het && atomDetails.name === 'C') ;
63252
- if(!atomDetails.het && atomDetails.name === 'O') ;
63474
+ if(!atomDetails.het && atomDetails.name === 'C') ;
63475
+ if(!atomDetails.het && atomDetails.name === 'O') ;
63253
63476
 
63254
- // from DSSP C++ code
63255
- // if(!atomDetails.het && atomDetails.name === 'N' && prevCSerial !== undefined && prevOSerial !== undefined) {
63256
- // let dist = ic.atoms[prevCSerial].coord.distanceTo(ic.atoms[prevOSerial].coord);
63477
+ // from DSSP C++ code
63478
+ // if(!atomDetails.het && atomDetails.name === 'N' && prevCSerial !== undefined && prevOSerial !== undefined) {
63479
+ // let dist = ic.atoms[prevCSerial].coord.distanceTo(ic.atoms[prevOSerial].coord);
63257
63480
 
63258
- // let x2 = atomDetails.coord.x + (ic.atoms[prevCSerial].coord.x - ic.atoms[prevOSerial].coord.x) / dist;
63259
- // let y2 = atomDetails.coord.y + (ic.atoms[prevCSerial].coord.y - ic.atoms[prevOSerial].coord.y) / dist;
63260
- // let z2 = atomDetails.coord.z + (ic.atoms[prevCSerial].coord.z - ic.atoms[prevOSerial].coord.z) / dist;
63481
+ // let x2 = atomDetails.coord.x + (ic.atoms[prevCSerial].coord.x - ic.atoms[prevOSerial].coord.x) / dist;
63482
+ // let y2 = atomDetails.coord.y + (ic.atoms[prevCSerial].coord.y - ic.atoms[prevOSerial].coord.y) / dist;
63483
+ // let z2 = atomDetails.coord.z + (ic.atoms[prevCSerial].coord.z - ic.atoms[prevOSerial].coord.z) / dist;
63261
63484
 
63262
- // atomDetails.hcoord = new THREE.Vector3(x2, y2, z2);
63263
- // }
63485
+ // atomDetails.hcoord = new THREE.Vector3(x2, y2, z2);
63486
+ // }
63264
63487
 
63265
- ic.atoms[serial] = atomDetails;
63488
+ ic.atoms[serial] = atomDetails;
63266
63489
 
63267
- ic.dAtoms[serial] = 1;
63268
- ic.hAtoms[serial] = 1;
63269
- hAtoms[serial] = 1;
63490
+ ic.dAtoms[serial] = 1;
63491
+ ic.hAtoms[serial] = 1;
63492
+ hAtoms[serial] = 1;
63270
63493
 
63271
- // Assign secondary structures from the input
63272
- // if a residue is assigned both sheet and helix, it is assigned as sheet
63273
- if(ic.loadPDBCls.isSecondary(residueNum, sheetArray, bNMR, !bFull)) {
63274
- ic.atoms[serial].ss = 'sheet';
63275
- if(ic.loadPDBCls.isSecondary(residueNum, sheetStart, bNMR, !bFull)) {
63276
- ic.atoms[serial].ssbegin = true;
63277
- }
63494
+ // Assign secondary structures from the input
63495
+ // if a residue is assigned both sheet and helix, it is assigned as sheet
63496
+ if(ic.loadPDBCls.isSecondary(residueNum, sheetArray, bNMR, !bFull)) {
63497
+ ic.atoms[serial].ss = 'sheet';
63498
+ if(ic.loadPDBCls.isSecondary(residueNum, sheetStart, bNMR, !bFull)) {
63499
+ ic.atoms[serial].ssbegin = true;
63500
+ }
63278
63501
 
63279
- // do not use else if. Some residues are both start and end of secondary structure
63280
- if(ic.loadPDBCls.isSecondary(residueNum, sheetEnd, bNMR, !bFull)) {
63281
- ic.atoms[serial].ssend = true;
63502
+ // do not use else if. Some residues are both start and end of secondary structure
63503
+ if(ic.loadPDBCls.isSecondary(residueNum, sheetEnd, bNMR, !bFull)) {
63504
+ ic.atoms[serial].ssend = true;
63505
+ }
63282
63506
  }
63283
- }
63284
- else if(ic.loadPDBCls.isSecondary(residueNum, helixArray, bNMR, !bFull)) {
63285
- ic.atoms[serial].ss = 'helix';
63507
+ else if(ic.loadPDBCls.isSecondary(residueNum, helixArray, bNMR, !bFull)) {
63508
+ ic.atoms[serial].ss = 'helix';
63509
+
63510
+ if(ic.loadPDBCls.isSecondary(residueNum, helixStart, bNMR, !bFull)) {
63511
+ ic.atoms[serial].ssbegin = true;
63512
+ }
63286
63513
 
63287
- if(ic.loadPDBCls.isSecondary(residueNum, helixStart, bNMR, !bFull)) {
63288
- ic.atoms[serial].ssbegin = true;
63514
+ // do not use else if. Some residues are both start and end of secondary structure
63515
+ if(ic.loadPDBCls.isSecondary(residueNum, helixEnd, bNMR, !bFull)) {
63516
+ ic.atoms[serial].ssend = true;
63517
+ }
63289
63518
  }
63290
63519
 
63291
- // do not use else if. Some residues are both start and end of secondary structure
63292
- if(ic.loadPDBCls.isSecondary(residueNum, helixEnd, bNMR, !bFull)) {
63293
- ic.atoms[serial].ssend = true;
63520
+ let secondaries = '-';
63521
+ if(ic.atoms[serial].ss === 'helix') {
63522
+ secondaries = 'H';
63523
+ }
63524
+ else if(ic.atoms[serial].ss === 'sheet') {
63525
+ secondaries = 'E';
63526
+ }
63527
+ //else if(ic.atoms[serial].ss === 'coil') {
63528
+ // secondaries = 'c';
63529
+ //}
63530
+ else if(!ic.atoms[serial].het && me.parasCls.residueColors.hasOwnProperty(ic.atoms[serial].resn.toUpperCase()) ) {
63531
+ secondaries = 'c';
63532
+ }
63533
+ else {
63534
+ secondaries = 'o';
63294
63535
  }
63295
- }
63296
63536
 
63297
- let secondaries = '-';
63298
- if(ic.atoms[serial].ss === 'helix') {
63299
- secondaries = 'H';
63300
- }
63301
- else if(ic.atoms[serial].ss === 'sheet') {
63302
- secondaries = 'E';
63303
- }
63304
- //else if(ic.atoms[serial].ss === 'coil') {
63305
- // secondaries = 'c';
63306
- //}
63307
- else if(!ic.atoms[serial].het && me.parasCls.residueColors.hasOwnProperty(ic.atoms[serial].resn.toUpperCase()) ) {
63308
- secondaries = 'c';
63309
- }
63310
- else {
63311
- secondaries = 'o';
63312
- }
63537
+ ic.secondaries[residueNum] = secondaries;
63313
63538
 
63314
- ic.secondaries[residueNum] = secondaries;
63539
+ // different residue
63540
+ //if(residueNum !== prevResidueNum) {
63541
+
63542
+ // if(oriResidueNum !== prevOriResidueNum) {
63543
+ if(oriResidueNum !== prevOriResidueNum || chain + "_" + resn != prevResn || prevAutochain != autochain) {
63544
+ let residue = me.utilsCls.residueName2Abbr(resn);
63545
+
63546
+ ic.residueId2Name[residueNum] = residue;
63315
63547
 
63316
- // different residue
63317
- //if(residueNum !== prevResidueNum) {
63318
-
63319
- // if(oriResidueNum !== prevOriResidueNum) {
63320
- if(oriResidueNum !== prevOriResidueNum || chain + "_" + resn != prevResn || prevAutochain != autochain) {
63321
- let residue = me.utilsCls.residueName2Abbr(resn);
63322
-
63323
- ic.residueId2Name[residueNum] = residue;
63548
+ if(serial !== 1 && prevResidueNum !== '') {
63549
+ ic.residues[prevResidueNum] = residuesTmp;
63550
+ }
63324
63551
 
63325
- if(serial !== 1 && prevResidueNum !== '') {
63326
- ic.residues[prevResidueNum] = residuesTmp;
63327
- }
63552
+ if(residueNum !== prevResidueNum) {
63553
+ residuesTmp = {};
63554
+ }
63328
63555
 
63329
- if(residueNum !== prevResidueNum) {
63330
- residuesTmp = {};
63331
- }
63556
+ // different chain
63557
+ if(chainNum !== prevChainNum) {
63332
63558
 
63333
- // different chain
63334
- if(chainNum !== prevChainNum) {
63559
+ // a chain could be separated in two sections
63560
+ if(serial !== 1 && prevChainNum !== '') {
63561
+ if(ic.chains[prevChainNum] === undefined) ic.chains[prevChainNum] = {};
63562
+ ic.chains[prevChainNum] = me.hashUtilsCls.unionHash(ic.chains[prevChainNum], chainsTmp);
63563
+ }
63335
63564
 
63336
- // a chain could be separated in two sections
63337
- if(serial !== 1 && prevChainNum !== '') {
63338
- if(ic.chains[prevChainNum] === undefined) ic.chains[prevChainNum] = {};
63339
- ic.chains[prevChainNum] = me.hashUtilsCls.unionHash(ic.chains[prevChainNum], chainsTmp);
63340
- }
63565
+ chainsTmp = {};
63566
+
63567
+ if(ic.structures[structure.toString()] === undefined) ic.structures[structure.toString()] = [];
63568
+ if(!ic.structures[structure.toString()].includes(chainNum)) ic.structures[structure.toString()].push(chainNum);
63341
63569
 
63342
- chainsTmp = {};
63570
+ if(ic.chainsSeq[chainNum] === undefined) ic.chainsSeq[chainNum] = [];
63343
63571
 
63344
- if(ic.structures[structure.toString()] === undefined) ic.structures[structure.toString()] = [];
63345
- if(!ic.structures[structure.toString()].includes(chainNum)) ic.structures[structure.toString()].push(chainNum);
63572
+ let resObject = {};
63573
+ resObject.resi = resi;
63574
+ resObject.name = residue;
63346
63575
 
63347
- if(ic.chainsSeq[chainNum] === undefined) ic.chainsSeq[chainNum] = [];
63576
+ ic.chainsSeq[chainNum].push(resObject);
63577
+ }
63578
+ else {
63348
63579
 
63349
- let resObject = {};
63350
- resObject.resi = resi;
63351
- resObject.name = residue;
63580
+ let resObject = {};
63581
+ resObject.resi = resi;
63582
+ resObject.name = residue;
63352
63583
 
63353
- ic.chainsSeq[chainNum].push(resObject);
63584
+ ic.chainsSeq[chainNum].push(resObject);
63585
+ }
63354
63586
  }
63355
- else {
63356
63587
 
63357
- let resObject = {};
63358
- resObject.resi = resi;
63359
- resObject.name = residue;
63588
+ chainsTmp[serial] = 1;
63589
+ residuesTmp[serial] = 1;
63360
63590
 
63361
- ic.chainsSeq[chainNum].push(resObject);
63362
- }
63363
- }
63591
+ prevChainNum = chainNum;
63592
+ prevResidueNum = residueNum;
63593
+ prevOriResidueNum = oriResidueNum;
63364
63594
 
63365
- chainsTmp[serial] = 1;
63366
- residuesTmp[serial] = 1;
63595
+ prevResn = chain + "_" + resn;
63596
+ prevAutochain = autochain;
63597
+ }
63367
63598
 
63368
- prevChainNum = chainNum;
63369
- prevResidueNum = residueNum;
63370
- prevOriResidueNum = oriResidueNum;
63599
+ // add the last residue set
63600
+ ic.residues[residueNum] = residuesTmp;
63601
+ if(ic.chains[chainNum] === undefined) ic.chains[chainNum] = {};
63602
+ ic.chains[chainNum] = me.hashUtilsCls.unionHash2Atoms(ic.chains[chainNum], chainsTmp, ic.atoms);
63371
63603
 
63372
- prevResn = chain + "_" + resn;
63373
- prevAutochain = autochain;
63374
- }
63604
+ // clear memory
63605
+ atom_hetatmArray = resnArray = elemArray = nameArray = chainArray = resiArray = resiOriArray
63606
+ = altArray = bArray = xArray = yArray = zArray = autochainArray = [];
63375
63607
 
63376
- // add the last residue set
63377
- ic.residues[residueNum] = residuesTmp;
63378
- if(ic.chains[chainNum] === undefined) ic.chains[chainNum] = {};
63379
- ic.chains[chainNum] = me.hashUtilsCls.unionHash2Atoms(ic.chains[chainNum], chainsTmp, ic.atoms);
63608
+ let mChainSeq = {};
63609
+ if(block.getCategory("_pdbx_poly_seq_scheme")) {
63610
+ let poly_seq_scheme = block.getCategory("_pdbx_poly_seq_scheme");
63380
63611
 
63381
- // clear memory
63382
- atom_hetatmArray = resnArray = elemArray = nameArray = chainArray = resiArray = resiOriArray
63383
- = altArray = bArray = xArray = yArray = zArray = autochainArray = [];
63612
+ let resiArray = poly_seq_scheme.getColumn("seq_id");
63613
+ let oriResiArray = poly_seq_scheme.getColumn("pdb_seq_num");
63614
+ let resnArray = poly_seq_scheme.getColumn("mon_id");
63615
+ let chainArray = poly_seq_scheme.getColumn("pdb_strand_id");
63384
63616
 
63385
- let mChainSeq = {};
63386
- if(block.getCategory("_pdbx_poly_seq_scheme")) {
63387
- let poly_seq_scheme = block.getCategory("_pdbx_poly_seq_scheme");
63617
+ let seqSize = poly_seq_scheme.rowCount;
63618
+ let prevChain = "";
63619
+ let seqArray = [];
63620
+ for (let i = 0; i < seqSize; ++i) {
63621
+ resiArray.getString(i);
63622
+ let oriResi = oriResiArray.getString(i);
63623
+ let resn = resnArray.getString(i);
63624
+ let chain = chainArray.getString(i);
63388
63625
 
63389
- let resiArray = poly_seq_scheme.getColumn("seq_id");
63390
- let oriResiArray = poly_seq_scheme.getColumn("pdb_seq_num");
63391
- let resnArray = poly_seq_scheme.getColumn("mon_id");
63392
- let chainArray = poly_seq_scheme.getColumn("pdb_strand_id");
63626
+ if(chain != prevChain && i > 0) {
63627
+ mChainSeq[prevChain] = seqArray;
63393
63628
 
63394
- let seqSize = poly_seq_scheme.rowCount;
63395
- let prevChain = "";
63396
- let seqArray = [];
63397
- for (let i = 0; i < seqSize; ++i) {
63398
- resiArray.getString(i);
63399
- let oriResi = oriResiArray.getString(i);
63400
- let resn = resnArray.getString(i);
63401
- let chain = chainArray.getString(i);
63629
+ seqArray = [];
63630
+ }
63402
63631
 
63403
- if(chain != prevChain && i > 0) {
63404
- mChainSeq[prevChain] = seqArray;
63632
+ // seqArray.push({"resi": resi, "name": me.utilsCls.residueName2Abbr(resn)});
63633
+ seqArray.push({"resi": oriResi, "name": me.utilsCls.residueName2Abbr(resn)});
63405
63634
 
63406
- seqArray = [];
63635
+ prevChain = chain;
63407
63636
  }
63408
63637
 
63409
- // seqArray.push({"resi": resi, "name": me.utilsCls.residueName2Abbr(resn)});
63410
- seqArray.push({"resi": oriResi, "name": me.utilsCls.residueName2Abbr(resn)});
63638
+ mChainSeq[prevChain] = seqArray;
63411
63639
 
63412
- prevChain = chain;
63640
+ resiArray = oriResiArray = resnArray = chainArray = [];
63413
63641
  }
63414
-
63415
- mChainSeq[prevChain] = seqArray;
63416
-
63417
- resiArray = oriResiArray = resnArray = chainArray = [];
63642
+
63643
+ this.setSeq(structure, sChain, mChainSeq, ligSeqHash);
63418
63644
  }
63419
-
63420
- this.setSeq(structure, sChain, mChainSeq, ligSeqHash);
63421
63645
 
63422
63646
  // copy disulfide bonds
63423
63647
  let structureArray = Object.keys(ic.structures);
@@ -69324,6 +69548,34 @@ class Resid2spec {
69324
69548
  return spec;
69325
69549
  }
69326
69550
 
69551
+ resi2range(resiArray) {var ic = this.icn3d; ic.icn3dui;
69552
+ let range = [];
69553
+
69554
+ let resiArraySorted = resiArray.sort(function(a, b) {
69555
+ return parseInt(a) - parseInt(b);
69556
+ });
69557
+
69558
+ let startResi = resiArraySorted[0];
69559
+ let prevResi, resi;
69560
+ for(let j = 0, jl = resiArraySorted.length; j < jl; ++j) {
69561
+ resi = resiArraySorted[j];
69562
+
69563
+ if(j != 0 && resi != prevResi + 1) {
69564
+ range.push(startResi);
69565
+ range.push(prevResi);
69566
+ startResi = resi;
69567
+ }
69568
+
69569
+ prevResi = resi;
69570
+ }
69571
+
69572
+ // last residue
69573
+ range.push(startResi);
69574
+ range.push(prevResi);
69575
+
69576
+ return range;
69577
+ }
69578
+
69327
69579
  atoms2spec(atomHash) {var ic = this.icn3d; ic.icn3dui;
69328
69580
  let spec = "";
69329
69581
  let i = 0;
@@ -70786,8 +71038,6 @@ class Dssp {
70786
71038
  bNoMoreIg = false;
70787
71039
 
70788
71040
  let pdb_target = ic.saveFileCls.getAtomPDB(domainAtomsArray[k], undefined, undefined, undefined, undefined, struct);
70789
- //let bForceOneDomain = true;
70790
- //let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(domainAtomsArray[k], bForceOneDomain);
70791
71041
 
70792
71042
  // ig strand for any subset will have the same k, use the number of residue to separate them
70793
71043
  let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtomsArray[k]);
@@ -70947,20 +71197,24 @@ class Dssp {
70947
71197
  // assign ref numbers to selected residues
70948
71198
  let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms, undefined);
70949
71199
  let subdomains = result.subdomains;
70950
- let pos2resi = result.pos2resi;
71200
+ // let pos2resi = result.pos2resi;
70951
71201
 
70952
71202
  if(subdomains.length >= 1) {
70953
71203
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
70954
71204
  let domainAtoms = {};
70955
71205
  let segArray = subdomains[k];
70956
71206
 
70957
- let resCnt = 0;
71207
+ let resCnt = 0; // minResi = 999, maxResi = -999;
70958
71208
  for(let m = 0, ml = segArray.length; m < ml; m += 2) {
70959
71209
  let startResi = parseInt(segArray[m]);
70960
71210
  let endResi = parseInt(segArray[m+1]);
70961
71211
 
71212
+ // if(startResi < minResi) minResi = startResi;
71213
+ // if(endResi > maxResi) maxResi = endResi;
71214
+
70962
71215
  for(let n = startResi; n <= endResi; ++n) {
70963
- let resid = chainid + '_' + pos2resi[n - 1];
71216
+ // let resid = chainid + '_' + pos2resi[n - 1];
71217
+ let resid = ic.ncbi2resid[chainid + '_' + n];
70964
71218
  ++resCnt;
70965
71219
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
70966
71220
 
@@ -70976,6 +71230,9 @@ class Dssp {
70976
71230
  domainAtomsArray.push(domainAtoms);
70977
71231
  }
70978
71232
  }
71233
+ // else { // no domain
71234
+ // domainAtomsArray = [currAtoms];
71235
+ // }
70979
71236
 
70980
71237
  return domainAtomsArray;
70981
71238
  }
@@ -71099,8 +71356,6 @@ class Dssp {
71099
71356
  if(bBstrand && bCstrand && bEstrand && bFstrand) break;
71100
71357
  }
71101
71358
 
71102
- console.log("### " + bBstrand + bCstrand + bEstrand + bFstrand);
71103
-
71104
71359
  // if(refpdbname != 'CD19_6al5A_human-n1') { // relax for CD19
71105
71360
  if(!(bBstrand && bCstrand && bEstrand && bFstrand) || !(bBSheet && bCSheet && bESheet && bFSheet)) {
71106
71361
  // if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
@@ -80533,7 +80788,7 @@ class iCn3DUI {
80533
80788
  //even when multiple iCn3D viewers are shown together.
80534
80789
  this.pre = this.cfg.divid + "_";
80535
80790
 
80536
- this.REVISION = '3.31.4';
80791
+ this.REVISION = '3.32.0';
80537
80792
 
80538
80793
  // In nodejs, iCn3D defines "window = {navigator: {}}"
80539
80794
  this.bNode = (Object.keys(window).length < 2) ? true : false;