icn3d 3.29.2 → 3.29.4

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.
package/icn3d.module.js CHANGED
@@ -8873,7 +8873,7 @@ class ClickMenu {
8873
8873
  }
8874
8874
  }
8875
8875
  }
8876
- if(ic.bAddLogs && me.cfg.showcommand) {
8876
+ if((ic.bAddLogs || bAddLogs) && me.cfg.showcommand) {
8877
8877
  let finalStr = (bSetCommand) ? str : '[comment] ' + str;
8878
8878
  ic.logs.push(finalStr);
8879
8879
  // move cursor to the end, and scroll to the end
@@ -15469,6 +15469,14 @@ class Events {
15469
15469
  thisClass.setLogCmd('define coil sets | chain ' + chainid, true);
15470
15470
  });
15471
15471
 
15472
+ $(document).on("click", ".icn3d-iganchorsets", function(e) { let ic = me.icn3d;
15473
+ e.stopImmediatePropagation();
15474
+ //e.preventDefault();
15475
+ let chainid = $(this).attr('chainid');
15476
+ ic.addTrackCls.defineIgstrand(chainid, 'iganchor');
15477
+ thisClass.setLogCmd('define iganchor sets | chain ' + chainid, true);
15478
+ });
15479
+
15472
15480
  $(document).on("click", ".icn3d-igstrandsets", function(e) { let ic = me.icn3d;
15473
15481
  e.stopImmediatePropagation();
15474
15482
  //e.preventDefault();
@@ -16906,6 +16914,9 @@ class Html {
16906
16914
  //this.baseUrl = "https://structure.ncbi.nlm.nih.gov/";
16907
16915
  this.baseUrl = (window && window.location && window.location.hostname == 'structure.ncbi.nlm.nih.gov')
16908
16916
  ? "https://structure.ncbi.nlm.nih.gov/Structure/" : "https://www.ncbi.nlm.nih.gov/Structure/";
16917
+
16918
+ this.tmalignUrl = this.baseUrl + "tmalign/tmalign.cgi";
16919
+
16909
16920
  this.divStr = "<div id='" + this.icn3dui.pre;
16910
16921
  this.divNowrapStr = "<div style='white-space:nowrap'>";
16911
16922
  this.spanNowrapStr = "<span style='white-space:nowrap'>";
@@ -38538,7 +38549,7 @@ class AnnoDomain {
38538
38549
  for(let j = from; j <= to; ++j) {
38539
38550
  // 0-based
38540
38551
  let obj = {};
38541
- let resi = ic.ParserUtilsCls.getResi(chnid, j+1);
38552
+ let resi = ic.ParserUtilsCls.getResi(chnid, j);
38542
38553
  obj[chnid + '_' + resi] = domainName;
38543
38554
  ic.resid2domain[chnid].push(obj);
38544
38555
  }
@@ -41521,64 +41532,78 @@ class AddTrack {
41521
41532
 
41522
41533
  if(!ic.residues.hasOwnProperty(resid) ) continue;
41523
41534
 
41524
- let refnumLabel, refnumStr;
41535
+ let refnumLabel, refnumStr, refnum;
41525
41536
  refnumLabel = ic.resid2refnum[resid];
41526
41537
  if(!refnumLabel) continue;
41527
41538
 
41528
41539
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
41529
41540
  currStrand = refnumLabel.replace(refnumStr, '');
41541
+ refnum = parseInt(refnumStr);
41530
41542
 
41531
- if(ic.residIgLoop.hasOwnProperty(resid)) {
41532
- currType = 'igloop';
41533
- }
41543
+ if(type == 'iganchor') {
41544
+ if(refnum > 1000 && refnumStr.substr(refnumStr.length - 2, 2) == '50') {
41545
+ selectedResidues[resid] = 1;
41546
+ }
41547
+ }
41534
41548
  else {
41535
- currType = 'igstrand';
41536
- }
41549
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
41550
+ currType = 'igloop';
41551
+ }
41552
+ else {
41553
+ currType = 'igstrand';
41554
+ }
41537
41555
 
41538
- if(bStart && currType != prevType && Object.keys(selectedResidues).length > 0) {
41539
- if(prevType == 'igstrand') {
41540
- ++strandCnt;
41541
- setName = 'Strand-' + prevStrand + '-' + chainid + '-' + strandCnt.toString().padStart(3, '0');
41542
- setName = setName.replace(/'/g, '`');
41543
- if(type == 'igstrand') {
41544
- ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41545
- if(!bUnion) bUnion = true;
41556
+ if(bStart && currType != prevType && Object.keys(selectedResidues).length > 0) {
41557
+ if(prevType == 'igstrand') {
41558
+ ++strandCnt;
41559
+ setName = 'Strand-' + prevStrand + '-' + chainid + '-' + strandCnt.toString().padStart(3, '0');
41560
+ setName = setName.replace(/'/g, '`');
41561
+ if(type == 'igstrand') {
41562
+ ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41563
+ if(!bUnion) bUnion = true;
41564
+ }
41565
+ prevStrandReal = prevStrand;
41546
41566
  }
41547
- prevStrandReal = prevStrand;
41548
- }
41549
- else if(prevType == 'igloop') {
41550
- ++loopCnt;
41551
- setName = 'Loop-' + prevStrandReal + '_' + currStrand + '-' + chainid + '-' + loopCnt.toString().padStart(3, '0');
41552
- setName = setName.replace(/'/g, '`');
41553
- if(type == 'igloop') {
41554
- ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41555
- if(!bUnion) bUnion = true;
41567
+ else if(prevType == 'igloop') {
41568
+ ++loopCnt;
41569
+ setName = 'Loop-' + prevStrandReal + '_' + currStrand + '-' + chainid + '-' + loopCnt.toString().padStart(3, '0');
41570
+ setName = setName.replace(/'/g, '`');
41571
+ if(type == 'igloop') {
41572
+ ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41573
+ if(!bUnion) bUnion = true;
41574
+ }
41556
41575
  }
41557
- }
41558
41576
 
41559
- selectedResidues = {};
41560
- }
41577
+ selectedResidues = {};
41578
+ }
41561
41579
 
41562
- selectedResidues[resid] = 1;
41580
+ selectedResidues[resid] = 1;
41563
41581
 
41564
- prevStrand = currStrand;
41565
- prevType = currType;
41582
+ prevStrand = currStrand;
41583
+ prevType = currType;
41566
41584
 
41567
- bStart = true;
41585
+ bStart = true;
41586
+ }
41568
41587
  } // for loop
41569
41588
 
41570
- if(prevType == 'igstrand') {
41571
- ++strandCnt;
41572
- setName = 'Strand-' + prevStrand + '-' + chainid + '-' + strandCnt.toString().padStart(3, '0');
41573
- setName = setName.replace(/'/g, '`');
41574
- if(type == 'igstrand') ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41589
+ if(type == 'iganchor') {
41590
+ setName = 'Anchor-' + chainid;
41591
+ ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41575
41592
  }
41576
- else if(prevType == 'igloop') {
41577
- ++loopCnt;
41578
- currStrand = 'CT';
41579
- setName = 'Loop-' + prevStrandReal + '_' + currStrand + '-' + chainid + '-' + loopCnt.toString().padStart(3, '0');
41580
- setName = setName.replace(/'/g, '`');
41581
- if(type == 'igloop') ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41593
+ else {
41594
+ if(prevType == 'igstrand') {
41595
+ ++strandCnt;
41596
+ setName = 'Strand-' + prevStrand + '-' + chainid + '-' + strandCnt.toString().padStart(3, '0');
41597
+ setName = setName.replace(/'/g, '`');
41598
+ if(type == 'igstrand') ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41599
+ }
41600
+ else if(prevType == 'igloop') {
41601
+ ++loopCnt;
41602
+ currStrand = 'CT';
41603
+ setName = 'Loop-' + prevStrandReal + '_' + currStrand + '-' + chainid + '-' + loopCnt.toString().padStart(3, '0');
41604
+ setName = setName.replace(/'/g, '`');
41605
+ if(type == 'igloop') ic.selectionCls.selectResidueList(selectedResidues, setName, setName, bUnion, bUpdateHighlight);
41606
+ }
41582
41607
  }
41583
41608
  }
41584
41609
 
@@ -43364,7 +43389,7 @@ class ShowAnno {
43364
43389
  + this.addButton(chnid, "icn3d-coilsets", "Coil Sets", "Define sets for each coil in this chain and add them to the menu of \"Defined Sets\"", 60, buttonStyle);
43365
43390
 
43366
43391
  if(ic.bShowRefnum && ic.chainid2refpdbname.hasOwnProperty(chnid) && ic.chainid2refpdbname[chnid].length > 0) {
43367
- chainHtml += "&nbsp;" + this.addButton(chnid, "icn3d-igstrandsets", "Ig Strand Sets", "Define sets for each Ig strand in this chain and add them to the menu of \"Defined Sets\"", 80, buttonStyle) + "&nbsp;"
43392
+ chainHtml += "&nbsp;&nbsp;&nbsp;" + this.addButton(chnid, "icn3d-iganchorsets", "Ig Anchor Set", "Define the set for all Ig anchors in this chain and add them to the menu of \"Defined Sets\"", 80, buttonStyle) + "&nbsp;" + this.addButton(chnid, "icn3d-igstrandsets", "Ig Strand Sets", "Define sets for each Ig strand in this chain and add them to the menu of \"Defined Sets\"", 80, buttonStyle) + "&nbsp;"
43368
43393
  + this.addButton(chnid, "icn3d-igloopsets", "Ig Loop Sets", "Define sets for each Ig loop in this chain and add them to the menu of \"Defined Sets\"", 80, buttonStyle);
43369
43394
  }
43370
43395
  $("#" + ic.pre + "dl_annotations").append(chainHtml);
@@ -45069,6 +45094,9 @@ class HlSeq {
45069
45094
  }
45070
45095
  });
45071
45096
 
45097
+ ic.selectionCls.saveSelectionPrep(true);
45098
+ ic.selectionCls.saveSelection(undefined, undefined, true);
45099
+
45072
45100
  //ic.residueLabelsCls.addResidueLabels(ic.hAtoms, false, 0.5);
45073
45101
  ic.hlObjectsCls.addHlObjects(); // render() is called
45074
45102
 
@@ -45152,7 +45180,10 @@ class HlSeq {
45152
45180
 
45153
45181
  if(id !== undefined) {
45154
45182
  thisClass.selectResidues(id, this);
45155
- }
45183
+
45184
+ ic.selectionCls.saveSelectionPrep(true);
45185
+ ic.selectionCls.saveSelection(undefined, undefined, true);
45186
+ }
45156
45187
  //});
45157
45188
 
45158
45189
  //ic.residueLabelsCls.addResidueLabels(ic.hAtoms, false, 0.5);
@@ -46639,9 +46670,7 @@ class LineGraph {
46639
46670
  ic.hlUpdateCls.updateHlAll();
46640
46671
  }
46641
46672
 
46642
- async showIgRefNum(template) { let ic = this.icn3d, me = ic.icn3dui;
46643
- let thisClass = this;
46644
-
46673
+ setRefPdbs() { let ic = this.icn3d; ic.icn3dui;
46645
46674
  // round 1, 16 templates
46646
46675
  ic.refpdbArray = ['1InsulinR_8guyE_human_FN3-n1', '1Endo-1,4-BetaXylanase10A_1i8aA_bacteria_n4', '1CoAtomerGamma1_1r4xA_human', '1C3_2qkiD_human_n1', '1CuZnSuperoxideDismutase_1hl5C_human', '1ASF1A_2iijA_human', '1FAB-LIGHT_5esv_C1-n2', '1CD2_1hnfA_human_C2-n2', '1NaCaExchanger_2fwuA_dog_n2', '1NaKATPaseTransporterBeta_2zxeB_spurdogshark', '1FAB-HEAVY_5esv_V-n1', '1PDL1_4z18B_human_V-n1', '1BTLA_2aw2A_human_Iset', '1LaminAC_1ifrA_human', '1CD3g_6jxrg_human_Iset', '1CD28_1yjdC_human_V', '1CD19_6al5A_human_C2orV-n1'];
46647
46676
 
@@ -46714,7 +46743,9 @@ class LineGraph {
46714
46743
  ic.refpdbHash['6JXR_d'] = ['CD3d_6jxrd_human_Iset'];
46715
46744
  ic.refpdbHash['6JXR_f'] = ['CD3e_6jxrf_human_Iset'];
46716
46745
  ic.refpdbHash['6JXR_g'] = ['CD3g_6jxrg_human_Iset'];
46746
+ }
46717
46747
 
46748
+ getPdbAjaxArray() { let ic = this.icn3d, me = ic.icn3dui;
46718
46749
  let pdbAjaxArray = [];
46719
46750
  for(let k = 0, kl = ic.refpdbArray.length; k < kl; ++k) {
46720
46751
  let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + ic.refpdbArray[k];
@@ -46725,6 +46756,16 @@ class LineGraph {
46725
46756
  pdbAjaxArray.push(pdbAjax);
46726
46757
  }
46727
46758
 
46759
+ return pdbAjaxArray;
46760
+ }
46761
+
46762
+ async showIgRefNum(template) { let ic = this.icn3d; ic.icn3dui;
46763
+ let thisClass = this;
46764
+
46765
+ this.setRefPdbs();
46766
+
46767
+ let pdbAjaxArray = this.getPdbAjaxArray();
46768
+
46728
46769
  // try {
46729
46770
  if(!template) {
46730
46771
  //let allPromise = Promise.allSettled(pdbAjaxArray);
@@ -46752,15 +46793,13 @@ class LineGraph {
46752
46793
  let ajaxArray = [];
46753
46794
  let domainidpairArray = [];
46754
46795
 
46755
- let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
46756
- me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
46796
+ let urltmalign = me.htmlCls.tmalignUrl;
46797
+ // let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
46757
46798
 
46758
46799
  if(!ic.resid2domainid) ic.resid2domainid = {};
46759
46800
  //ic.resid2domainid = {};
46760
46801
  ic.domainid2pdb = {};
46761
46802
 
46762
- let minResidues = 20;
46763
-
46764
46803
  for(let i = 0, il = struArray.length; i < il; ++i) {
46765
46804
  let struct = struArray[i];
46766
46805
  let chainidArray = ic.structures[struct];
@@ -46768,79 +46807,8 @@ class LineGraph {
46768
46807
  for(let j = 0, jl = chainidArray.length; j < jl; ++j) {
46769
46808
  let chainid = chainidArray[j];
46770
46809
 
46771
- if(!ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]).serial)
46772
- && !ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getMiddleAtomObj(ic.chains[chainid]).serial)) continue;
46773
- if(ic.chainsSeq[chainid].length < minResidues) continue; // peptide
46774
-
46775
- let currAtoms = me.hashUtilsCls.intHash(ic.chains[chainid], ic.hAtoms);
46776
- if(Object.keys(currAtoms).length == 0) continue;
46777
-
46778
- // align each 3D domain with reference structure
46779
- //let result = ic.domain3dCls.c2b_NewSplitChain(ic.chains[chainid]);
46780
- // assign ref numbers to selected residues
46781
- let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms);
46782
- let subdomains = result.subdomains;
46783
- let pos2resi = result.pos2resi;
46784
-
46785
- let domainAtomsArray = [];
46786
- if(subdomains.length <= 1) {
46787
- //domainAtomsArray.push(ic.chains[chainid]);
46788
- domainAtomsArray.push(currAtoms);
46789
-
46790
- let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
46791
-
46792
- let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(currAtoms);
46793
- let atomLast = ic.firstAtomObjCls.getLastAtomObj(currAtoms);
46794
- let resiSum = atomFirst.resi + ':' + atomLast.resi;
46795
-
46796
- for(let n = 0, nl = residueArray.length; n < nl; ++n) {
46797
- let resid = residueArray[n];
46798
- ic.resid2domainid[resid] = chainid + '-0' + '_' + resiSum;
46799
-
46800
- // clear previous refnum assignment if any
46801
- if(ic.resid2refnum && ic.resid2refnum[resid]) {
46802
- delete ic.resid2refnum[resid];
46803
- }
46804
- }
46805
- }
46806
- else {
46807
- for(let k = 0, kl = subdomains.length; k < kl; ++k) {
46808
- let domainAtoms = {};
46809
- let segArray = subdomains[k];
46810
-
46811
- for(let m = 0, ml = segArray.length; m < ml; m += 2) {
46812
- let startResi = segArray[m];
46813
- let endResi = segArray[m+1];
46814
- for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
46815
- let resid = chainid + '_' + pos2resi[n];
46816
- domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
46817
- //ic.resid2domainid[resid] = chainid + '-' + k;
46818
-
46819
- // clear previous refnum assignment if any
46820
- if(ic.resid2refnum && ic.resid2refnum[resid]) {
46821
- delete ic.resid2refnum[resid];
46822
- }
46823
- }
46824
- }
46825
-
46826
- domainAtomsArray.push(domainAtoms);
46827
-
46828
- let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtoms);
46829
- let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtoms);
46830
- let resiSum = atomFirst.resi + ':' + atomLast.resi;
46831
-
46832
- for(let m = 0, ml = segArray.length; m < ml; m += 2) {
46833
- let startResi = segArray[m];
46834
- let endResi = segArray[m+1];
46835
- for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
46836
- let resid = chainid + '_' + pos2resi[n];
46837
- //domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
46838
- ic.resid2domainid[resid] = chainid + '-' + k + '_' + resiSum;
46839
- }
46840
- }
46841
- }
46842
- }
46843
-
46810
+ let domainAtomsArray = this.getDomainAtomsArray(chainid);
46811
+
46844
46812
  if(!ic.domainid2refpdbname) ic.domainid2refpdbname = {};
46845
46813
  if(!ic.domainid2score) ic.domainid2score = {};
46846
46814
 
@@ -46904,7 +46872,7 @@ class LineGraph {
46904
46872
  // start round2
46905
46873
  let ajaxArray = [];
46906
46874
  let domainidpairArray3 = [];
46907
- let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
46875
+ let urltmalign = me.htmlCls.tmalignUrl;
46908
46876
 
46909
46877
  let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + template;
46910
46878
  let pdbAjax = me.getAjaxPromise(urlpdb, 'text');
@@ -46961,6 +46929,86 @@ class LineGraph {
46961
46929
  */
46962
46930
  }
46963
46931
 
46932
+ getDomainAtomsArray(chainid) { let ic = this.icn3d, me = ic.icn3dui;
46933
+ let domainAtomsArray = [];
46934
+
46935
+ let minResidues = 20;
46936
+
46937
+ if(!ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]).serial)
46938
+ && !ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getMiddleAtomObj(ic.chains[chainid]).serial)) return domainAtomsArray;
46939
+ if(ic.chainsSeq[chainid].length < minResidues) return domainAtomsArray; // peptide
46940
+
46941
+ let currAtoms = me.hashUtilsCls.intHash(ic.chains[chainid], ic.hAtoms);
46942
+ if(Object.keys(currAtoms).length == 0) return domainAtomsArray;
46943
+
46944
+ // align each 3D domain with reference structure
46945
+ //let result = ic.domain3dCls.c2b_NewSplitChain(ic.chains[chainid]);
46946
+ // assign ref numbers to selected residues
46947
+ let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms);
46948
+ let subdomains = result.subdomains;
46949
+ let pos2resi = result.pos2resi;
46950
+
46951
+ if(subdomains.length <= 1) {
46952
+ //domainAtomsArray.push(ic.chains[chainid]);
46953
+ domainAtomsArray.push(currAtoms);
46954
+
46955
+ let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
46956
+
46957
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(currAtoms);
46958
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(currAtoms);
46959
+ let resiSum = atomFirst.resi + ':' + atomLast.resi;
46960
+
46961
+ for(let n = 0, nl = residueArray.length; n < nl; ++n) {
46962
+ let resid = residueArray[n];
46963
+ ic.resid2domainid[resid] = chainid + '-0' + '_' + resiSum;
46964
+
46965
+ // clear previous refnum assignment if any
46966
+ if(ic.resid2refnum && ic.resid2refnum[resid]) {
46967
+ delete ic.resid2refnum[resid];
46968
+ }
46969
+ }
46970
+ }
46971
+ else {
46972
+ for(let k = 0, kl = subdomains.length; k < kl; ++k) {
46973
+ let domainAtoms = {};
46974
+ let segArray = subdomains[k];
46975
+
46976
+ for(let m = 0, ml = segArray.length; m < ml; m += 2) {
46977
+ let startResi = segArray[m];
46978
+ let endResi = segArray[m+1];
46979
+ for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
46980
+ let resid = chainid + '_' + pos2resi[n];
46981
+ domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
46982
+ //ic.resid2domainid[resid] = chainid + '-' + k;
46983
+
46984
+ // clear previous refnum assignment if any
46985
+ if(ic.resid2refnum && ic.resid2refnum[resid]) {
46986
+ delete ic.resid2refnum[resid];
46987
+ }
46988
+ }
46989
+ }
46990
+
46991
+ domainAtomsArray.push(domainAtoms);
46992
+
46993
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtoms);
46994
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtoms);
46995
+ let resiSum = atomFirst.resi + ':' + atomLast.resi;
46996
+
46997
+ for(let m = 0, ml = segArray.length; m < ml; m += 2) {
46998
+ let startResi = segArray[m];
46999
+ let endResi = segArray[m+1];
47000
+ for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
47001
+ let resid = chainid + '_' + pos2resi[n];
47002
+ //domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
47003
+ ic.resid2domainid[resid] = chainid + '-' + k + '_' + resiSum;
47004
+ }
47005
+ }
47006
+ }
47007
+ }
47008
+
47009
+ return domainAtomsArray;
47010
+ }
47011
+
46964
47012
  getTemplateList(chainid) { let ic = this.icn3d; ic.icn3dui;
46965
47013
  let domainid2refpdbname = {}, domainid2score = {};
46966
47014
 
@@ -47005,13 +47053,13 @@ class LineGraph {
47005
47053
  return {'refpdbnameList': refpdbnameList, 'scoreList': scoreList, 'seqidList': seqidList, 'nresAlignList': nresAlignList};
47006
47054
  }
47007
47055
 
47008
- async parseAlignData(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
47009
- let thisClass = this;
47010
-
47056
+ parseAlignData_part1(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
47057
+ // async parseAlignData(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
47011
47058
  let tmscoreThreshold = 0.4; // 0.4; //0.5;
47059
+ //let rmsdThreshold = 10;
47012
47060
 
47013
47061
  // find the best alignment for each chain
47014
- let domainid2segs = {}, chainid2segs = {};
47062
+ let domainid2segs = {};
47015
47063
 
47016
47064
  if(!ic.chainid2refpdbname) ic.chainid2refpdbname = {};
47017
47065
  if(!ic.chainid2score) ic.chainid2score = {};
@@ -47096,12 +47144,11 @@ class LineGraph {
47096
47144
  }
47097
47145
 
47098
47146
  if(!bRound1) {
47099
- console.log("domainid: " + domainid);
47147
+ if(!me.bNode) console.log("domainid: " + domainid);
47100
47148
  }
47101
47149
 
47102
47150
  if(!domainid2segs.hasOwnProperty(domainid) || queryData[0].score >= ic.domainid2score[domainid].split('_')[0]) {
47103
47151
  ic.domainid2score[domainid] = queryData[0].score + '_' + queryData[0].frac_identical + '_' + queryData[0].num_res ;
47104
-
47105
47152
  ic.domainid2refpdbname[domainid] = refpdbname;
47106
47153
  domainid2segs[domainid] = queryData[0].segs;
47107
47154
  ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
@@ -47109,13 +47156,19 @@ class LineGraph {
47109
47156
  }
47110
47157
  }
47111
47158
 
47159
+ return domainid2segs;
47160
+ }
47161
+
47162
+ async parseAlignData(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
47163
+ let domainid2segs = this.parseAlignData_part1(dataArray, domainidpairArray, bRound1);
47164
+
47112
47165
  if(bRound1) {
47113
47166
  if(!me.bNode) console.log("Start round 2 alignment with the reference culsters " + JSON.stringify(ic.domainid2refpdbname));
47114
47167
 
47115
47168
  // start round2
47116
47169
  let ajaxArray = [];
47117
47170
  let domainidpairArray3 = [];
47118
- let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
47171
+ let urltmalign = me.htmlCls.tmalignUrl;
47119
47172
  for(let domainid in ic.domainid2refpdbname) {
47120
47173
  let pdbAjaxArray = [];
47121
47174
  let refpdbname = ic.domainid2refpdbname[domainid];
@@ -47171,12 +47224,18 @@ class LineGraph {
47171
47224
 
47172
47225
  dataArray3 = await this.promiseWithFixedJobs(ajaxArray);
47173
47226
 
47174
- await thisClass.parseAlignData(dataArray3, domainidpairArray3, false);
47227
+ await this.parseAlignData(dataArray3, domainidpairArray3, false);
47175
47228
 
47176
47229
  // end of round 2
47177
47230
  return;
47178
47231
  }
47179
47232
 
47233
+ await this.parseAlignData_part3(domainid2segs);
47234
+ }
47235
+
47236
+ async parseAlignData_part3(domainid2segs) { let ic = this.icn3d, me = ic.icn3dui;
47237
+ let chainid2segs = {};
47238
+
47180
47239
  // combine domainid into chainid
47181
47240
  let processedChainid = {};
47182
47241
 
@@ -47231,7 +47290,7 @@ class LineGraph {
47231
47290
  let message = "The reference PDB(s) for chain " + chainid + " is(are) " + refpdbnameList + ". The TM-score(s) is(are) " + scoreList + ". The sequence identitie(s) is(are) " + seqidList + ". The number of aligned residue(s) is(are) " + nresAlignList + ".";
47232
47291
  if(!me.bNode) {
47233
47292
  console.log(message);
47234
- me.htmlCls.clickMenuCls.setLogCmd(message, true);
47293
+ me.htmlCls.clickMenuCls.setLogCmd(message, false, true);
47235
47294
  }
47236
47295
  ic.refPdbList.push(message);
47237
47296
 
@@ -47255,7 +47314,7 @@ class LineGraph {
47255
47314
  //let refnum = qStart + postfix;
47256
47315
  let refnum = qStart;
47257
47316
 
47258
- let refnumLabel = thisClass.getLabelFromRefnum(refnum, prevStrand, bCd19);
47317
+ let refnumLabel = this.getLabelFromRefnum(refnum, prevStrand, bCd19);
47259
47318
  prevStrand = (refnumLabel) ? refnumLabel.replace(new RegExp(refnum,'g'), '') : undefined;
47260
47319
 
47261
47320
  ic.resid2refnum[resid] = refnumLabel;
@@ -47420,7 +47479,7 @@ class LineGraph {
47420
47479
  return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
47421
47480
  }
47422
47481
 
47423
- exportRefnum(type) { let ic = this.icn3d, me = ic.icn3dui;
47482
+ exportRefnum(type, bCalcRef) { let ic = this.icn3d, me = ic.icn3dui;
47424
47483
  let refData = '';
47425
47484
 
47426
47485
  // 1. show IgStrand ref numbers
@@ -47464,19 +47523,32 @@ class LineGraph {
47464
47523
  }
47465
47524
  }
47466
47525
 
47467
- refData += '{"ref PDB" : ' + JSON.stringify(ic.refPdbList) + ",\n";
47526
+ let bIgDomain = (ic.refPdbList.length > 0) ? 1 : 0;
47527
+
47528
+ refData += '{"Ig domain" : ' + bIgDomain + ', "ref PDB" : ' + JSON.stringify(ic.refPdbList) + ",\n";
47468
47529
 
47469
- refData += '"data": {\n';
47470
- for(let chnid in ic.chains) {
47471
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
47472
- if(ic.proteins.hasOwnProperty(atom.serial)) {
47473
- for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
47474
- const resid = chnid + '_' + ic.chainsSeq[chnid][i].resi + '_' + ic.chainsSeq[chnid][i].name;
47475
- refData += '"' + resid + '": "' + resid2refnum[resid] + '",\n';
47530
+ if(bIgDomain) {
47531
+ refData += '"data": {\n';
47532
+ for(let chnid in ic.chains) {
47533
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
47534
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
47535
+ let bIgChain = false;
47536
+ let chainRefData = '"' + chnid + '": [\n';
47537
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
47538
+ const resid = chnid + '_' + ic.chainsSeq[chnid][i].resi + '_' + ic.chainsSeq[chnid][i].name;
47539
+ chainRefData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
47540
+ if(resid2refnum[resid]) bIgChain = true;
47541
+ }
47542
+ chainRefData += '],\n';
47543
+
47544
+ if(bIgChain) {
47545
+ refData += chainRefData;
47546
+ }
47547
+ }
47476
47548
  }
47549
+ refData += '}\n';
47477
47550
  }
47478
- }
47479
- refData += '}\n';
47551
+
47480
47552
  refData += '}\n';
47481
47553
  }
47482
47554
  // 2. show Kabat ref numbers
@@ -52746,7 +52818,6 @@ class MmcifParser {
52746
52818
 
52747
52819
  async downloadMmcifSymmetry(mmcifid, type) { let ic = this.icn3d, me = ic.icn3dui;
52748
52820
  // https://files.rcsb.org/header/ is not accessible in Node.js and Mac
52749
- //let url = (me.bNode) ? "https://files.rcsb.org/view/" + mmcifid + ".cif" : "https://files.rcsb.org/header/" + mmcifid + ".cif";
52750
52821
  let url = (me.bNode || me.utilsCls.isMac()) ? "https://files.rcsb.org/view/" + mmcifid + ".cif" : "https://files.rcsb.org/header/" + mmcifid + ".cif";
52751
52822
 
52752
52823
  //ic.bCid = undefined;
@@ -52754,6 +52825,7 @@ class MmcifParser {
52754
52825
 
52755
52826
  url = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi";
52756
52827
  let dataObj = {'mmcifheader': data1};
52828
+
52757
52829
  let data = await me.getAjaxPostPromise(url, dataObj, false, "The mmCIF data of " + mmcifid + " can not be parsed...");
52758
52830
 
52759
52831
  if(data.emd !== undefined) ic.emd = data.emd;
@@ -54670,7 +54742,7 @@ class RealignParser {
54670
54742
  realign() { let ic = this.icn3d, me = ic.icn3dui;
54671
54743
  ic.selectionCls.saveSelectionPrep();
54672
54744
 
54673
- let index = Object.keys(ic.defNames2Atoms).length;
54745
+ let index = Object.keys(ic.defNames2Atoms).length + Object.keys(ic.defNames2Residues).length + 1;
54674
54746
  let name = 'alseq_' + index;
54675
54747
 
54676
54748
  ic.selectionCls.saveSelection(name, name);
@@ -61772,6 +61844,12 @@ class ApplyCommand {
61772
61844
 
61773
61845
  ic.addTrackCls.defineSecondary(chainid, 'coil');
61774
61846
  }
61847
+ else if(commandOri.indexOf('define iganchor sets') == 0) {
61848
+ let chainStr = commandOri.split(' | ')[1];
61849
+ let chainid = chainStr.split(' ')[1];
61850
+
61851
+ ic.addTrackCls.defineIgstrand(chainid, 'iganchor');
61852
+ }
61775
61853
  else if(commandOri.indexOf('define igstrand sets') == 0) {
61776
61854
  let chainStr = commandOri.split(' | ')[1];
61777
61855
  let chainid = chainStr.split(' ')[1];
@@ -65477,28 +65555,46 @@ class Selection {
65477
65555
  ic.annotationCls.showAnnoSelectedChains();
65478
65556
  }
65479
65557
 
65480
- saveSelection(name, description) { let ic = this.icn3d, me = ic.icn3dui;
65481
- ic.selectedResidues = {};
65558
+ saveSelection(name, description, bDragSeq) { let ic = this.icn3d, me = ic.icn3dui;
65559
+ if(!bDragSeq) {
65560
+ ic.selectedResidues = {};
65482
65561
 
65483
- ic.selectedResidues = ic.firstAtomObjCls.getResiduesFromCalphaAtoms(ic.hAtoms);
65562
+ ic.selectedResidues = ic.firstAtomObjCls.getResiduesFromCalphaAtoms(ic.hAtoms);
65563
+ }
65564
+
65565
+ if(!name) {
65566
+ let index = Object.keys(ic.defNames2Atoms).length + Object.keys(ic.defNames2Residues).length + 1;
65567
+ name = 'seq_' + index;
65568
+ description = name;
65569
+ }
65484
65570
 
65485
65571
  if(Object.keys(ic.selectedResidues).length > 0) {
65486
65572
  if(ic.pk == 1) {
65487
65573
  let bAtom = true;
65488
- this.selectResidueList(ic.hAtoms, name, description,undefined, undefined, bAtom);
65574
+ this.selectResidueList(ic.hAtoms, name, description, undefined, undefined, bAtom);
65489
65575
  //ic.hlUpdateCls.updateHlAll();
65490
65576
 
65491
65577
  this.updateSelectionNameDesc();
65492
65578
 
65493
- me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.atoms2spec(ic.hAtoms) + ' | name ' + name, true);
65579
+ if(!bDragSeq) {
65580
+ me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.atoms2spec(ic.hAtoms) + ' | name ' + name, true);
65581
+ }
65582
+ else { // no names for temp selections
65583
+ me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.atoms2spec(ic.hAtoms), true);
65584
+ }
65494
65585
  }
65495
65586
  else {
65496
- this.selectResidueList(ic.selectedResidues, name, description);
65587
+ this.selectResidueList(ic.selectedResidues, name, description, undefined, undefined, undefined);
65497
65588
  //ic.hlUpdateCls.updateHlAll();
65498
65589
 
65499
65590
  this.updateSelectionNameDesc();
65500
65591
 
65501
- me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.residueids2spec(Object.keys(ic.selectedResidues)) + ' | name ' + name, true);
65592
+ if(!bDragSeq) {
65593
+ me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.residueids2spec(Object.keys(ic.selectedResidues)) + ' | name ' + name, true);
65594
+ }
65595
+ else { // no names for temp selections
65596
+ me.htmlCls.clickMenuCls.setLogCmd('select ' + ic.resid2specCls.residueids2spec(Object.keys(ic.selectedResidues)), true);
65597
+ }
65502
65598
  }
65503
65599
  }
65504
65600
  }
@@ -65636,7 +65732,7 @@ class Selection {
65636
65732
  }
65637
65733
  }
65638
65734
 
65639
- saveSelectionPrep() {var ic = this.icn3d, me = ic.icn3dui;
65735
+ saveSelectionPrep(bDragSeq) {var ic = this.icn3d, me = ic.icn3dui;
65640
65736
  if(!me.cfg.notebook) {
65641
65737
  if(!$('#' + ic.pre + 'dl_definedsets').hasClass('ui-dialog-content') || !$('#' + ic.pre + 'dl_definedsets').dialog( 'isOpen' )) {
65642
65738
  me.htmlCls.dialogCls.openDlg('dl_definedsets', 'Select sets');
@@ -65647,8 +65743,11 @@ class Selection {
65647
65743
  $('#' + ic.pre + 'dl_definedsets').show();
65648
65744
  $("#" + ic.pre + "atomsCustom").resizable();
65649
65745
  }
65650
- ic.bSelectResidue = false;
65651
- ic.bSelectAlignResidue = false;
65746
+
65747
+ if(!bDragSeq) {
65748
+ ic.bSelectResidue = false;
65749
+ ic.bSelectAlignResidue = false;
65750
+ }
65652
65751
  }
65653
65752
  selectOneResid(idStr, bUnchecked) {var ic = this.icn3d; ic.icn3dui;
65654
65753
  //var idStr = idArray[i]; // TYR $1KQ2.B:56@OH, $1KQ2.B:40 ASP
@@ -72285,11 +72384,17 @@ class ShareLink {
72285
72384
  //statefile += ic.commands[i] + "\n";
72286
72385
 
72287
72386
  // only output the most recent 'select saved atoms...' without " | name ..."
72288
- if(((prevCommandStr.indexOf('select saved atoms') !== -1 || prevCommandStr.indexOf('select sets') !== -1)
72289
- &&(commandStr.indexOf('select') === 0 || commandStr.indexOf('select') === 0)
72290
- && prevCommandStr.indexOf(' name ') === -1)
72291
- ||(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1)
72292
- ) ;
72387
+ // or those select without names
72388
+ // if(((prevCommandStr.indexOf('select saved atoms') !== -1 || prevCommandStr.indexOf('select sets') !== -1)
72389
+ // &&(commandStr.indexOf('select') === 0 || commandStr.indexOf('select') === 0)
72390
+ // && prevCommandStr.indexOf(' name ') === -1)
72391
+ // ||(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1)
72392
+ // ) {
72393
+
72394
+ if(prevCommandStr.indexOf('select') == 0 && prevCommandStr.indexOf('select prop') === -1
72395
+ && commandStr.indexOf('select') === 0 && commandStr.indexOf('select prop') === -1
72396
+ && prevCommandStr.indexOf(' name ') === -1) ;
72397
+ else if(prevCommandStr.indexOf('pickatom') !== -1 && commandStr.indexOf('pickatom') !== -1) ;
72293
72398
  // remove all "show selection" except the last one
72294
72399
  else if(prevCommandStr == 'show selection' && ic.commands.slice(i).toString().indexOf('show selection') != -1) ;
72295
72400
  else if(prevCommandStr.indexOf(toggleStr) !== -1) {
@@ -75212,7 +75317,7 @@ class iCn3DUI {
75212
75317
  //even when multiple iCn3D viewers are shown together.
75213
75318
  this.pre = this.cfg.divid + "_";
75214
75319
 
75215
- this.REVISION = '3.29.1';
75320
+ this.REVISION = '3.29.2';
75216
75321
 
75217
75322
  // In nodejs, iCn3D defines "window = {navigator: {}}"
75218
75323
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -75831,10 +75936,13 @@ iCn3DUI.prototype.getAjaxPostPromise = async function(url, data, beforeSend, ale
75831
75936
  resolve(data);
75832
75937
  },
75833
75938
  error : function() {
75834
- if(alertMess) alert(alertMess);
75939
+ //if(alertMess) alert(alertMess);
75940
+ if(alertMess) console.log(alertMess);
75835
75941
  if(logMess) console.log(logMess);
75836
75942
 
75837
- reject('error');
75943
+ // reject('error');
75944
+ // keep running the program
75945
+ resolve('error');
75838
75946
  }
75839
75947
  });
75840
75948
  });