icn3d 3.54.7 → 3.54.8

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 +157 -158
  2. package/icn3d.min.js +5 -11
  3. package/icn3d.module.js +157 -158
  4. package/package.json +1 -1
package/icn3d.js CHANGED
@@ -60702,7 +60702,7 @@ class SetMenu {
60702
60702
  //html += this.getMenuText('mn1_fold', 'AlphaFold/ESM', undefined, undefined, 1);
60703
60703
  html += this.getMenuText('mn1_fold', 'Predict by Seq.', undefined, undefined, 1);
60704
60704
  html += "<ul>";
60705
- html += this.getLink('mn1_esmfold', 'ESMFold', undefined, 2);
60705
+ //html += this.getLink('mn1_esmfold', 'ESMFold', undefined, 2);
60706
60706
  //html += this.getMenuUrl('mn1_esmfold_link', "https://colab.research.google.com/github/sokrypton/ColabFold/blob/main/ESMFold.ipynb", "ESMFold via ColabFold" + me.htmlCls.wifiStr, undefined, 2);
60707
60707
  html += this.getLink('mn1_alphafold', 'AlphaFold2 via ColabFold' + me.htmlCls.wifiStr, undefined, 2);
60708
60708
  html += "</ul>";
@@ -62307,7 +62307,6 @@ class Dialog {
62307
62307
  if(status.bSetsInit2) thisClass.openDlg2Ddgm(me.pre + 'dl_definedsets');
62308
62308
  }
62309
62309
  else {
62310
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH, me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT, true);
62311
62310
  ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
62312
62311
  }
62313
62312
  }
@@ -62396,7 +62395,6 @@ class Dialog {
62396
62395
  let status = thisClass.getDialogStatus().status;
62397
62396
 
62398
62397
  if((!status.bSelectannotationsInit2) &&(!status.bGraph2) &&(!status.bLineGraph2) &&(!status.bScatterplot2) &&(!status.bHbondplot2) &&(!status.bLigplot2) &&(!status.bTable2) &&(!status.bAlignmentInit2) ) {
62399
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH, me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT, true);
62400
62398
  ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
62401
62399
  }
62402
62400
  },
@@ -62441,8 +62439,7 @@ class Dialog {
62441
62439
  }
62442
62440
  }
62443
62441
  else {
62444
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH,(me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT) * 0.5, true);
62445
- ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH,(me.htmlCls.HEIGHT) * 0.5, true);
62442
+ //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH,(me.htmlCls.HEIGHT) * 0.5, true);
62446
62443
 
62447
62444
  //height =(me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT) * 0.5;
62448
62445
  height =(me.htmlCls.HEIGHT) * 0.5;
@@ -62482,7 +62479,6 @@ class Dialog {
62482
62479
  if(status.bSetsInit2) thisClass.openDlg2Ddgm(me.pre + 'dl_definedsets');
62483
62480
  }
62484
62481
  else {
62485
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH, me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT, true);
62486
62482
  ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
62487
62483
  }
62488
62484
  }
@@ -64615,7 +64611,20 @@ class Events {
64615
64611
  let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
64616
64612
 
64617
64613
  if(nameArray.length == 0) {
64618
- nameArray = $("#" + me.pre + "atomsCustom").val();
64614
+ // nameArray = $("#" + me.pre + "atomsCustom").val();
64615
+
64616
+ // choose the first chain for each structure
64617
+ nameArray = [];
64618
+ let structureHash = {};
64619
+ let chains = ic.resid2specCls.atoms2chains(ic.hAtoms);
64620
+
64621
+ for(let chainid in chains) {
64622
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]);
64623
+ if(!structureHash.hasOwnProperty(atom.structure) && (ic.proteins.hasOwnProperty(atom.serial) || ic.nucleotides.hasOwnProperty(atom.serial))) {
64624
+ nameArray.push(chainid);
64625
+ structureHash[atom.structure] = 1;
64626
+ }
64627
+ }
64619
64628
  }
64620
64629
 
64621
64630
  if(nameArray.length > 0) {
@@ -64635,20 +64644,6 @@ class Events {
64635
64644
  }
64636
64645
 
64637
64646
  if(bMsa) {
64638
- // choose the first chain for each structure
64639
- if(nameArray.length == 0) {
64640
- nameArray = [];
64641
- let structureHash = {};
64642
-
64643
- for(let chainid in ic.chains) {
64644
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]);
64645
- if(!structureHash.hasOwnProperty(atom.structure) && (ic.proteins.hasOwnProperty(atom.serial) || ic.nucleotides.hasOwnProperty(atom.serial))) {
64646
- nameArray.push(chainid);
64647
- structureHash[atom.structure] = 1;
64648
- }
64649
- }
64650
- }
64651
-
64652
64647
  await ic.realignParserCls.realignOnStructAlignMsa(nameArray);
64653
64648
  }
64654
64649
  else {
@@ -125139,8 +125134,8 @@ class MmdbParser {
125139
125134
 
125140
125135
  if(type === undefined || type === 'target') {
125141
125136
  // if a command contains "load...", the commands should not be cleared with init()
125142
- let bKeepCmd = (ic.bCommandLoad) ? true : false;
125143
- if(!ic.bStatefile) ic.init(bKeepCmd);
125137
+ let bClearCmd = (ic.bCommandLoad) ? false : true;
125138
+ if(!ic.bStatefile) ic.init(bClearCmd);
125144
125139
 
125145
125140
  ic.chainsColor = {};
125146
125141
  ic.chainsGene = {};
@@ -126608,8 +126603,8 @@ class PdbParser {
126608
126603
  async loadPdbData(data, pdbid, bOpm, bAppend, type, bLastQuery, bNoDssp, bEsmfold) { let ic = this.icn3d, me = ic.icn3dui;
126609
126604
  if(!bAppend && (type === undefined || type === 'target')) {
126610
126605
  // if a command contains "load...", the commands should not be cleared with init()
126611
- let bKeepCmd = (ic.bCommandLoad) ? true : false;
126612
- if(!ic.bStatefile) ic.init(bKeepCmd);
126606
+ let bClearCmd = (ic.bCommandLoad) ? false : true;
126607
+ if(!ic.bStatefile) ic.init(bClearCmd);
126613
126608
  }
126614
126609
 
126615
126610
  let hAtoms = await ic.loadPDBCls.loadPDB(data, pdbid, bOpm, undefined, undefined, bAppend, type, bEsmfold); // defined in the core library
@@ -129097,6 +129092,7 @@ let resRangeArray = (me.cfg.resrange) ? decodeURIComponent(me.cfg.resrange).spli
129097
129092
  let predefinedResArray, predefinedResPair;
129098
129093
 
129099
129094
  if(bPredefined) {
129095
+ me.cfg.resdef = decodeURIComponent(me.cfg.resdef).trim();
129100
129096
  let tmpStr = me.cfg.resdef.replace(/; /gi, ': ');
129101
129097
  // predefinedResArray = decodeURIComponent(tmpStr).trim().replace(/\+/gi, ' ').split(': ');
129102
129098
  predefinedResArray = tmpStr.replace(/\+/gi, ' ').split(': ');
@@ -132037,45 +132033,6 @@ class SetSeqAlign {
132037
132033
  ic.nconsHash2 = {};
132038
132034
  ic.nalignHash2 = {};
132039
132035
 
132040
- // let msaSameColor = [];
132041
- // // assume all aligned seq are the same. If any aligned res is different,set it to false (0)
132042
- // for(let i = 0, il = seqalign[0].length; i < il; ++i) {
132043
- // msaSameColor.push(1);
132044
- // }
132045
-
132046
- for(let i = 0, il = seqalign.length; i < il; ++i) {
132047
- // first sequence
132048
- let alignData = seqalign[i][0];
132049
- let molid1 = alignData.moleculeId;
132050
-
132051
- let chain1 = ic.pdbid_molid2chain[mmdbid1 + '_' + molid1];
132052
- chainid1 = mmdbid1 + '_' + chain1;
132053
- alignData.sequence.length;
132054
- for(let j = 0, jl = alignData.sequence.length; j < jl; ++j) {
132055
- // 0: internal resi id, 1: pdb resi id, 2: resn, 3: aligned or not
132056
- (ic.bUsePdbNum) ? ic.ParserUtilsCls.getResi(chainid1, alignData.sequence[j][0] - 1) : alignData.sequence[j][0];
132057
- (alignData.sequence[j][2] === '~') ? '-' : alignData.sequence[j][2];
132058
-
132059
- (alignData.sequence[j][3]) ? 1 : 0;
132060
- }
132061
-
132062
- // second sequence
132063
- alignData = seqalign[i][1];
132064
-
132065
- // for(let j = start; j <= end; ++j) {
132066
- // // 0: internal resi id, 1: pdb resi id, 2: resn, 3: aligned or not
132067
- // let alignedTmp =(alignData.sequence[j][3]) ? 1 : 0;
132068
-
132069
- // let aligned = id2aligninfo[j].aligned + alignedTmp; // 0 or 2
132070
-
132071
- // if(aligned === 2) { // aligned
132072
- // if(id2aligninfo[j].resn != resn) {
132073
- // msaSameColor[j] = 0;
132074
- // }
132075
- // }
132076
- // }
132077
- }
132078
-
132079
132036
  for(let i = 0, il = seqalign.length; i < il; ++i) {
132080
132037
  // first sequence
132081
132038
  let alignData = seqalign[i][0];
@@ -132172,8 +132129,6 @@ class SetSeqAlign {
132172
132129
  ic.nconsHash2[chainid2 + '_' + resi] = 1;
132173
132130
  }
132174
132131
 
132175
- // color = (msaSameColor[j] == 0) ? '#0000FF' : '#FF0000';
132176
-
132177
132132
  // mapping, use the firstsequence as the reference structure
132178
132133
  ic.chainsMapping[chainid1][chainid1 + '_' + id2aligninfo[j].resi] = id2aligninfo[j].resn + id2aligninfo[j].resi;
132179
132134
  ic.chainsMapping[chainid2][chainid2 + '_' + resi] = id2aligninfo[j].resn + id2aligninfo[j].resi;
@@ -132190,8 +132145,6 @@ class SetSeqAlign {
132190
132145
 
132191
132146
  ic.nalignHash1[chainid1 + '_' + id2aligninfo[j].resi] = 1;
132192
132147
  ic.nalignHash2[chainid2 + '_' + resi] = 1;
132193
-
132194
- // msaSameColor[j] = 2; // not aligned
132195
132148
  }
132196
132149
 
132197
132150
  // chain1
@@ -132316,7 +132269,8 @@ class SetSeqAlign {
132316
132269
  return pos;
132317
132270
  }
132318
132271
 
132319
- getResnFromResi(chainid, resi) { let ic = this.icn3d, me = ic.icn3dui;
132272
+ getResnFromResi(chainid, resi) { let ic = this.icn3d; ic.icn3dui;
132273
+ /*
132320
132274
  let pos = this.getPosFromResi(chainid, resi);
132321
132275
  if(!pos) return '?';
132322
132276
 
@@ -132331,8 +132285,8 @@ class SetSeqAlign {
132331
132285
  }
132332
132286
 
132333
132287
  return resn;
132288
+ */
132334
132289
 
132335
- /*
132336
132290
  let resid = chainid + '_' + resi;
132337
132291
  let resn = ic.residueId2Name[resid];
132338
132292
  if(!resn) {
@@ -132340,7 +132294,6 @@ class SetSeqAlign {
132340
132294
  }
132341
132295
 
132342
132296
  return resn;
132343
- */
132344
132297
  }
132345
132298
 
132346
132299
  getResiAferAlign(chainid, bRealign, pos) { let ic = this.icn3d, me = ic.icn3dui;
@@ -132571,7 +132524,7 @@ class SetSeqAlign {
132571
132524
  }
132572
132525
  }
132573
132526
  }
132574
-
132527
+
132575
132528
  for(let j = 0; j <= end1 - start1; ++j) {
132576
132529
  ///if(ic.chainsSeq[chainid1] === undefined || ic.chainsSeq[chainid2] === undefined) break;
132577
132530
 
@@ -132684,29 +132637,43 @@ class SetSeqAlign {
132684
132637
  for(let i = 0, il = ic.qt_start_end[chainIndex].length; i < il; ++i) {
132685
132638
  let start1, end1;
132686
132639
 
132687
- //ic.qt_start_end is zero-based
132688
- if(!bRealign && me.cfg.aligntool != 'tmalign') { // vast alignment or seqalign
132689
- start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start) - 1;
132690
- end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end) - 1;
132691
- }
132692
- else {
132693
- start1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_start) - 1;
132694
- end1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_end) - 1;
132695
- }
132696
-
132640
+ // if(bRealign) { // real residue numbers are stored
132641
+ // start1 = ic.qt_start_end[chainIndex][i].t_start;
132642
+ // end1 = ic.qt_start_end[chainIndex][i].t_end;
132643
+ // }
132644
+ // else {
132645
+ //ic.qt_start_end is zero-based
132646
+ if(!bRealign && me.cfg.aligntool != 'tmalign') { // vast alignment
132647
+ start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start) - 1;
132648
+ end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end) - 1;
132649
+ }
132650
+ else {
132651
+ start1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_start) - 1;
132652
+ end1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_end) - 1;
132653
+ }
132654
+ // }
132697
132655
  for(let j = start1; j <= end1; ++j) {
132698
132656
  let resi, resid;
132699
132657
 
132700
- // let resiPos;
132701
- // if(me.cfg.aligntool == 'tmalign') {
132702
- // resiPos = j - baseResi;
132658
+ // if(me.cfg.aligntool == 'tmalign') { // tmalign: just one residue in this for loop
132659
+ // resi = ic.qt_start_end[chainIndex][i].t_start;
132703
132660
  // }
132704
132661
  // else {
132705
- // resiPos = j;
132662
+ // let resiPos = (bRealign || me.cfg.aligntool != 'tmalign') ? j : j - baseResi;
132663
+ // let resiPos;
132664
+ // if(me.cfg.aligntool == 'tmalign') {
132665
+ // resiPos = j - baseResi;
132666
+ // }
132667
+ // else {
132668
+ // // resiPos = (bRealign) ? j : j - baseResi;
132669
+ // resiPos = j;
132670
+ // }
132671
+
132672
+ let resiPos = j;
132673
+
132674
+ resi = ic.ParserUtilsCls.getResi(chainidArray[0], resiPos);
132675
+ resid = chainidArray[0] + '_' + resi;
132706
132676
  // }
132707
- let resiPos = j;
132708
- resi = ic.ParserUtilsCls.getResi(chainidArray[0], resiPos);
132709
- resid = chainidArray[0] + '_' + resi;
132710
132677
 
132711
132678
  resid2range_t[resid] = 1;
132712
132679
  if(j < start_t) start_t = j;
@@ -132720,6 +132687,7 @@ class SetSeqAlign {
132720
132687
 
132721
132688
  let resid2rangeArray = Object.keys(resid2range_t);
132722
132689
  resid2rangeArray.sort(function(a, b) {
132690
+ // return parseInt(a.split('_')[2]) - parseInt(b.split('_')[2]);
132723
132691
  let idArray1 = me.utilsCls.getIdArray(a);
132724
132692
  let idArray2 = me.utilsCls.getIdArray(b);
132725
132693
  return parseInt(idArray1[2]) - parseInt(idArray2[2]);
@@ -132731,7 +132699,7 @@ class SetSeqAlign {
132731
132699
  let resid = resid2rangeArray[i];
132732
132700
  let idArray = me.utilsCls.getIdArray(resid);
132733
132701
  let resi = idArray[2];
132734
-
132702
+
132735
132703
  if(i == 0) {
132736
132704
  start = resi;
132737
132705
  }
@@ -132770,9 +132738,7 @@ class SetSeqAlign {
132770
132738
  let resid = chainid1 + '_' + resi;
132771
132739
 
132772
132740
  // let jAdjusted = (me.cfg.aligntool != 'tmalign') ? j : j + baseResi;
132773
- //let jAdjusted = ic.ParserUtilsCls.getResiNCBI(chainid1, resi) - 1;
132774
- //!!!
132775
- let jAdjusted = (me.cfg.aligntool != 'tmalign') ? j : ic.ParserUtilsCls.getResiNCBI(chainid1, resi) - 1;
132741
+ let jAdjusted = (me.cfg.aligntool == 'seqalign') ? j : ic.ParserUtilsCls.getResiNCBI(chainid1, resi) - 1;
132776
132742
 
132777
132743
  //if(j + baseResi < start_t || j + baseResi > end_t) {
132778
132744
  if(jAdjusted < start_t || jAdjusted > end_t) {
@@ -132790,6 +132756,7 @@ class SetSeqAlign {
132790
132756
  resObject.color2 = (resid2range_t[resid]) ? '#FF0000' : me.htmlCls.GREYC; // color by conservation
132791
132757
  // resObject.class = (resid2range_t[resid]) ? 'icn3d-align' : 'icn3d-nalign';
132792
132758
  resObject.class = (resid2range_t[resid]) ? 'icn3d-cons' : 'icn3d-nalign';
132759
+
132793
132760
  ic.alnChainsSeq[chainid1].push(resObject);
132794
132761
 
132795
132762
  if(resid2range_t[resid]) {
@@ -132923,7 +132890,7 @@ class SetSeqAlign {
132923
132890
  if(ic.alnChainsSeq[chainid1]) {
132924
132891
  for(let j = 0, jl = ic.alnChainsSeq[chainid1].length; j < jl; ++j) {
132925
132892
  //add gap before the mapping region
132926
- //if(parseInt(ic.alnChainsSeq[chainid1][j].resi) == parseInt(resi_t)) {
132893
+ // if(parseInt(ic.alnChainsSeq[chainid1][j].resi) == parseInt(resi_t)) {
132927
132894
  if(ic.alnChainsSeq[chainid1][j].resi == resi_t) {
132928
132895
  pos_t = j;
132929
132896
  break;
@@ -132949,7 +132916,6 @@ class SetSeqAlign {
132949
132916
  for(let j = 0, jl = alignedChainIndice.length - 1; j < jl; ++j) {
132950
132917
  let chainidTmp = chainidArray[alignedChainIndice[j]];
132951
132918
  let gapResObject = this.getResObject(chainidTmp, true);
132952
-
132953
132919
  //for(let k = 0, kl = len - nGap; k < kl; ++k) {
132954
132920
  for(let k = 0, kl = len; k < kl; ++k) {
132955
132921
  ic.alnChainsSeq[chainidTmp].splice(pos_t, 0, gapResObject);
@@ -132966,6 +132932,7 @@ class SetSeqAlign {
132966
132932
  // let resn2 = this.getResn(chainid, start + j);
132967
132933
  let resi2 = (bRealign && me.cfg.aligntool == 'tmalign') ? start + j : ic.ParserUtilsCls.getResi(chainid, start + j);
132968
132934
  let resn2 = this.getResnFromResi(chainid, resi2);
132935
+
132969
132936
  let resn1 = '-';
132970
132937
  let bAlign = false;
132971
132938
  let resObject = this.getResObject(chainid, false, bAlign, resi2, resn2, resn1);
@@ -132974,22 +132941,28 @@ class SetSeqAlign {
132974
132941
  }
132975
132942
 
132976
132943
  getTemplatePosFromOriPos(chainid1, start, end, bRealign) { let ic = this.icn3d; ic.icn3dui;
132977
- //!!!
132978
132944
  let startResi = ic.ParserUtilsCls.getResi(chainid1, start);
132979
132945
  let endResi = ic.ParserUtilsCls.getResi(chainid1, end);
132946
+
132947
+ let result1 = this.getResiPosInTemplate(chainid1, startResi);
132948
+ let result2 = this.getResiPosInTemplate(chainid1, endResi);
132949
+
132950
+ return {"pos1": result1.pos, "pos2": result2.pos};
132951
+ }
132980
132952
 
132981
- // if(bRealign && me.cfg.aligntool == 'tmalign') { // vast alignment
132982
- // let startResi = start;
132983
- // let endResi = end;
132953
+ getTemplatePosFromOriResi(chainid1, start, end, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
132954
+ if(bRealign && me.cfg.aligntool == 'tmalign') { // vast alignment
132955
+ let startResi = start;
132956
+ let endResi = end;
132984
132957
 
132985
132958
  let result1 = this.getResiPosInTemplate(chainid1, startResi);
132986
132959
  let result2 = this.getResiPosInTemplate(chainid1, endResi);
132987
132960
 
132988
132961
  return {"pos1": result1.pos, "pos2": result2.pos};
132989
- // }
132990
- // else {
132991
- // return {"pos1": start, "pos2": end};
132992
- // }
132962
+ }
132963
+ else {
132964
+ return {"pos1": start, "pos2": end};
132965
+ }
132993
132966
  }
132994
132967
 
132995
132968
  mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resid2range_t, start_t, end_t, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
@@ -133051,9 +133024,6 @@ class SetSeqAlign {
133051
133024
  if(!ic.chainsMapping[chainid2]) ic.chainsMapping[chainid2] = {};
133052
133025
 
133053
133026
  let result;
133054
-
133055
- let nGapInTemplate = 0; // number of gaps inserted into the template sequence
133056
- let startPosInTemplate = 0; // position in the template sequence to start the mapping
133057
133027
 
133058
133028
  // need to improve when tmalign with residue number with postfix such as 52A in 4ORZ_C,5ESV_H
133059
133029
  // start and end should be positions, not original residue numbers.
@@ -133061,11 +133031,10 @@ class SetSeqAlign {
133061
133031
  start_t = ic.ParserUtilsCls.getResi(chainid1, start_t);
133062
133032
  end_t = ic.ParserUtilsCls.getResi(chainid1, end_t);
133063
133033
  }
133064
- console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign );
133034
+
133065
133035
  for(let i = 0, il = ic.qt_start_end[chainIndex].length; i < il; ++i) {
133066
133036
  let start1, start2, end1, end2, resiStart1, start1Pos, end1Pos;
133067
-
133068
- if(bRealign && (me.cfg.aligntool == 'tmalign')) { // real residue numbers are stored
133037
+ if(bRealign && me.cfg.aligntool == 'tmalign') { // real residue numbers are stored
133069
133038
  start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start);
133070
133039
  start2 = parseInt(ic.qt_start_end[chainIndex][i].q_start);
133071
133040
  end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end);
@@ -133093,28 +133062,46 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133093
133062
  end1Pos = end1;
133094
133063
  }
133095
133064
  //let range = resid2range_t[chainid1 + '_' + resiStart1];
133096
-
133065
+
133097
133066
  // if the mapping does not start from start_t, add gaps to the query seq
133098
133067
  if(i == 0) {
133099
- startPosInTemplate = start1Pos;
133100
133068
 
133101
- //!!!
133102
- // result = this.getTemplatePosFromOriPos(chainid1, start_t, start1, bRealign);
133103
- result = this.getTemplatePosFromOriPos(chainid1, start_t, start1Pos, bRealign);
133104
- pos1 = result.pos1;
133105
- pos2 = result.pos2;
133069
+ if(me.cfg.aligntool == 'seqalign') {
133070
+ result = this.getTemplatePosFromOriPos(chainid1, start_t, start1Pos, bRealign);
133106
133071
 
133107
- //!!!
133108
- // if(start1 > start_t) {
133109
- if(start1Pos > start_t) {
133110
- for(let j = 0, jl = pos2 - pos1; j < jl; ++j) {
133111
- ic.alnChainsSeq[chainid2].push(gapResObject2);
133072
+ pos1 = result.pos1;
133073
+ pos2 = result.pos2;
133074
+
133075
+ //if(start1 > start_t) {
133076
+ if(start1Pos > start_t) {
133077
+ for(let j = 0, jl = pos2 - pos1; j < jl; ++j) {
133078
+ ic.alnChainsSeq[chainid2].push(gapResObject2);
133079
+ }
133080
+ }
133081
+ }
133082
+ else {
133083
+ result = this.getTemplatePosFromOriResi(chainid1, start_t, start1, bRealign);
133084
+
133085
+ pos1 = result.pos1;
133086
+ pos2 = result.pos2;
133087
+
133088
+ if(start1 > start_t) {
133089
+ //if(start1Pos > start_t) {
133090
+ for(let j = 0, jl = pos2 - pos1; j < jl; ++j) {
133091
+ ic.alnChainsSeq[chainid2].push(gapResObject2);
133092
+ }
133112
133093
  }
133113
133094
  }
133114
133095
  }
133115
133096
  else {
133116
133097
  //let notAlnLen1 = start1 - (prevIndex1 + 1);
133117
- result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, start1, bRealign);
133098
+ //!!!
133099
+ if(me.cfg.aligntool == 'seqalign') {
133100
+ result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, start1Pos, bRealign);
133101
+ }
133102
+ else {
133103
+ result = this.getTemplatePosFromOriResi(chainid1, prevIndex1, start1, bRealign);
133104
+ }
133118
133105
  pos1 = result.pos1;
133119
133106
  pos2 = result.pos2;
133120
133107
  let notAlnLen1 = pos2 - (pos1 + 1);
@@ -133125,47 +133112,48 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133125
133112
 
133126
133113
  // insert non-aligned residues in query seq
133127
133114
  this.insertNotAlignRes(chainid2, prevIndex2+1, notAlnLen2, bRealign);
133115
+
133128
133116
  if(notAlnLen1 >= notAlnLen2) {
133129
133117
  // add gaps before the query sequence
133130
133118
  for(let j = 0, jl = notAlnLen1 - notAlnLen2; j < jl; ++j) {
133131
133119
  ic.alnChainsSeq[chainid2].push(gapResObject2);
133132
- }
133120
+ }
133133
133121
  }
133134
133122
  else {
133135
133123
  // check the number of gaps before resiStart1 (n), and insert 'notAlnLen2 - notAlnLen1 - n' gaps
133136
133124
  this.addGapAllAlnChains(chainidArray, alignedChainIndice, chainid1, resiStart1, notAlnLen2 - notAlnLen1);
133137
- nGapInTemplate += (notAlnLen2 - notAlnLen1);
133138
133125
  }
133139
133126
  }
133140
133127
 
133141
133128
  // 2. In the mapped residues
133142
- // result = this.getTemplatePosFromOriPos(chainid1, start1, end1, bRealign);
133143
- result = this.getTemplatePosFromOriPos(chainid1, start1Pos, end1Pos, bRealign);
133129
+ if(me.cfg.aligntool == 'seqalign') {
133130
+ result = this.getTemplatePosFromOriPos(chainid1, start1Pos, end1Pos, bRealign);
133131
+ }
133132
+ else {
133133
+ result = this.getTemplatePosFromOriResi(chainid1, start1, end1, bRealign);
133134
+ }
133144
133135
  pos1 = result.pos1;
133145
133136
  pos2 = result.pos2;
133146
-
133137
+
133147
133138
  let k = 0;
133148
133139
  if(!ic.chainsMapping[chainid1]) ic.chainsMapping[chainid1] = {};
133149
133140
  if(!ic.chainsMapping[chainid2]) ic.chainsMapping[chainid2] = {};
133150
- //!!!!!!
133151
- let resiAdjust = ((bRealign && me.cfg.aligntool == 'tmalign') || me.cfg.aligntool == 'seqalign') ? 0 : - startPosInTemplate + nGapInTemplate;
133152
133141
  for(let j = pos1; j <= pos2; ++j) {
133153
133142
  // inherit the gaps from the template
133154
- if(ic.alnChainsSeq[chainid1][j + resiAdjust].resn == '-') {
133143
+ if(ic.alnChainsSeq[chainid1][j].resn == '-') {
133155
133144
  ic.alnChainsSeq[chainid2].push(gapResObject2);
133156
133145
  }
133157
133146
  else {
133158
133147
  let resi1 = (bRealign && me.cfg.aligntool == 'tmalign') ? start1 + k : ic.ParserUtilsCls.getResi(chainid1, start1 + k);
133159
133148
  let resi2 = (bRealign && me.cfg.aligntool == 'tmalign') ? start2 + k : ic.ParserUtilsCls.getResi(chainid2, start2 + k);
133160
-
133161
133149
  let resn1 = this.getResnFromResi(chainid1, resi1); //this.getResn(chainid1, start1 + k);
133162
133150
  let resn2 = this.getResnFromResi(chainid2, resi2); //this.getResn(chainid2, start2 + k);
133163
-
133151
+
133164
133152
  let bAlign = true;
133165
133153
  let resObject = this.getResObject(chainid2, false, bAlign, resi2, resn2, resn1);
133166
133154
  ic.alnChainsSeq[chainid2].push(resObject);
133167
133155
  // update color in the template
133168
- ic.alnChainsSeq[chainid1][j + resiAdjust].color = resObject.color;
133156
+ ic.alnChainsSeq[chainid1][j].color = resObject.color;
133169
133157
 
133170
133158
  ic.chainsMapping[chainid1][chainid1 + '_' + resi1] = resn1 + resi1;
133171
133159
  ic.chainsMapping[chainid2][chainid2 + '_' + resi2] = resn1 + resi1;
@@ -133183,7 +133171,12 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133183
133171
  }
133184
133172
 
133185
133173
  // add gaps at the end
133186
- result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, end_t, bRealign);
133174
+ if(me.cfg.aligntool == 'seqalign') {
133175
+ result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, end_t, bRealign);
133176
+ }
133177
+ else {
133178
+ result = this.getTemplatePosFromOriResi(chainid1, prevIndex1, end_t, bRealign);
133179
+ }
133187
133180
  pos1 = result.pos1;
133188
133181
  pos2 = result.pos2;
133189
133182
  for(let i = pos1; i < pos2; ++i) {
@@ -133203,7 +133196,7 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133203
133196
 
133204
133197
  for(let i = 0, il = ic.qt_start_end[index].length; i < il; ++i) {
133205
133198
  let start1, start2, end1, end2, resiStart1, start1Pos, end1Pos;
133206
-
133199
+
133207
133200
  start1 = ic.qt_start_end[index][i].t_start;
133208
133201
  start2 = ic.qt_start_end[index][i].q_start;
133209
133202
  end1 = ic.qt_start_end[index][i].t_end;
@@ -133519,10 +133512,10 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133519
133512
  }
133520
133513
  }
133521
133514
 
133522
- setMsaFormat(chainidArray) { let ic = this.icn3d, me = ic.icn3dui;
133515
+ setMsaFormat(chainidArray) { let ic = this.icn3d; ic.icn3dui;
133523
133516
  //set MSA
133524
- let fastaFormat = '', clustalwFormat = 'CLUSTALWW\n\n', resbyresFormat = '';
133525
- let chainArrayClustal = [];
133517
+ let fastaFormat = '', clustalwFormat = 'CLUSTALW\n\n', resbyresFormat = '';
133518
+ let chainArrayClustalw = [];
133526
133519
 
133527
133520
  let consArray = [], resiArrayTemplate = [];
133528
133521
  let chainidTemplate = chainidArray[0];
@@ -133531,9 +133524,7 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133531
133524
  fastaFormat += '>' + chainid + '\n';
133532
133525
 
133533
133526
  let clustalwArray = [];
133534
- let itemArray = me.utilsCls.getIdArray(chainid);
133535
- let chainidStr = 'pdb|' + itemArray[0] + '|' + itemArray[1];
133536
- let clustalwLine = chainidStr.padEnd(20, ' ');
133527
+ let clustalwLine = chainid.padEnd(20, ' ');
133537
133528
  let consLine = ''.padEnd(20, ' ');
133538
133529
 
133539
133530
  let resiArrayTarget = [], resiArrayQuery = [];
@@ -133593,8 +133584,8 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133593
133584
 
133594
133585
  fastaFormat += '\n';
133595
133586
 
133596
- chainArrayClustal.push(clustalwArray);
133597
- if(i == il - 1) chainArrayClustal.push(consArray);
133587
+ chainArrayClustalw.push(clustalwArray);
133588
+ if(i == il - 1) chainArrayClustalw.push(consArray);
133598
133589
 
133599
133590
  // residue by residue
133600
133591
  let resiRangeStr1 = ic.resid2specCls.resi2range(resiArrayTarget, true);
@@ -133603,10 +133594,10 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133603
133594
  if(i > 0) resbyresFormat += resiRangeStr1 + ' | ' + resiRangeStr2 + '\n';
133604
133595
  }
133605
133596
 
133606
- // CLUSTALWW
133607
- for(let j = 0, jl = chainArrayClustal[0].length; j < jl; ++j) {
133608
- for(let i = 0, il = chainArrayClustal.length; i < il; ++i) {
133609
- clustalwFormat += chainArrayClustal[i][j] + '\n';
133597
+ // CLUSTALW
133598
+ for(let j = 0, jl = chainArrayClustalw[0].length; j < jl; ++j) {
133599
+ for(let i = 0, il = chainArrayClustalw.length; i < il; ++i) {
133600
+ clustalwFormat += chainArrayClustalw[i][j] + '\n';
133610
133601
  }
133611
133602
  clustalwFormat += '\n';
133612
133603
  }
@@ -141730,6 +141721,15 @@ class Resid2spec {
141730
141721
  return Object.keys(residueHash);
141731
141722
  }
141732
141723
 
141724
+ atoms2chains(atoms) {var ic = this.icn3d; ic.icn3dui;
141725
+ let chains = {};
141726
+ for(let i in atoms) {
141727
+ let atom = ic.atoms[i];
141728
+ chains[atom.structure + '_' + atom.chain] = 1;
141729
+ }
141730
+ return chains;
141731
+ }
141732
+
141733
141733
  atoms2structureArray(atoms) {var ic = this.icn3d; ic.icn3dui;
141734
141734
  let structures = {};
141735
141735
  for(let i in atoms) {
@@ -149345,11 +149345,10 @@ class ResizeCanvas {
149345
149345
  //me.htmlCls.HEIGHT = $( window ).height();
149346
149346
  me.utilsCls.setViewerWidthHeight(ic.icn3dui);
149347
149347
 
149348
- let width = me.htmlCls.WIDTH; // - me.htmlCls.LESSWIDTH_RESIZE;
149349
- let height = me.htmlCls.HEIGHT; // - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT;
149348
+ me.htmlCls.WIDTH; // - me.htmlCls.LESSWIDTH_RESIZE;
149349
+ me.htmlCls.HEIGHT; // - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT;
149350
149350
 
149351
- // if(ic !== undefined && !ic.bFullscreen) thisClass.resizeCanvas(width, height);
149352
- if(ic !== undefined && !ic.bFullscreen) thisClass.resizeCanvas(width, height, true, true);
149351
+ //if(ic !== undefined && !ic.bFullscreen) thisClass.resizeCanvas(width, height, true, true);
149353
149352
  });
149354
149353
  }
149355
149354
  }
@@ -154099,8 +154098,8 @@ class iCn3D {
154099
154098
  }
154100
154099
  }
154101
154100
  //When users first load a structure, call this function to empty previous settings.
154102
- iCn3D.prototype.init = function (bKeepCmd, bKeepConfig) {
154103
- this.init_base(bKeepCmd, bKeepConfig);
154101
+ iCn3D.prototype.init = function (bClearCmd, bKeepConfig) {
154102
+ this.init_base(bClearCmd, bKeepConfig);
154104
154103
 
154105
154104
  this.molTitle = "";
154106
154105
 
@@ -154120,7 +154119,7 @@ iCn3D.prototype.init = function (bKeepCmd, bKeepConfig) {
154120
154119
  this.axes = [];
154121
154120
  };
154122
154121
 
154123
- iCn3D.prototype.init_base = function (bKeepCmd, bKeepConfig) {
154122
+ iCn3D.prototype.init_base = function (bClearCmd, bKeepConfig) {
154124
154123
  if(!bKeepConfig) this.resetConfig();
154125
154124
 
154126
154125
  this.structures = {}; // structure name -> array of chains
@@ -154215,7 +154214,7 @@ iCn3D.prototype.init_base = function (bKeepCmd, bKeepConfig) {
154215
154214
  this.transformCls.rotateCount = 0;
154216
154215
  this.transformCls.rotateCountMax = 20;
154217
154216
 
154218
- if(bKeepCmd) this.commands = [];
154217
+ if(bClearCmd) this.commands = [];
154219
154218
 
154220
154219
  this.axes = [];
154221
154220
 
@@ -154407,9 +154406,9 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
154407
154406
  resize: function( event, ui ) {
154408
154407
  me.htmlCls.WIDTH = ui.size.width; //$("#" + ic.pre + "canvas").width();
154409
154408
  me.htmlCls.HEIGHT = ui.size.height; //$("#" + ic.pre + "canvas").height();
154410
- if(ic !== undefined && !me.icn3d.bFullscreen) {
154411
- ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
154412
- }
154409
+ // if(ic !== undefined && !me.icn3d.bFullscreen) {
154410
+ // ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
154411
+ // }
154413
154412
  }
154414
154413
  });
154415
154414