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.module.js CHANGED
@@ -61603,7 +61603,7 @@ class SetMenu {
61603
61603
  //html += this.getMenuText('mn1_fold', 'AlphaFold/ESM', undefined, undefined, 1);
61604
61604
  html += this.getMenuText('mn1_fold', 'Predict by Seq.', undefined, undefined, 1);
61605
61605
  html += "<ul>";
61606
- html += this.getLink('mn1_esmfold', 'ESMFold', undefined, 2);
61606
+ //html += this.getLink('mn1_esmfold', 'ESMFold', undefined, 2);
61607
61607
  //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);
61608
61608
  html += this.getLink('mn1_alphafold', 'AlphaFold2 via ColabFold' + me.htmlCls.wifiStr, undefined, 2);
61609
61609
  html += "</ul>";
@@ -63208,7 +63208,6 @@ class Dialog {
63208
63208
  if(status.bSetsInit2) thisClass.openDlg2Ddgm(me.pre + 'dl_definedsets');
63209
63209
  }
63210
63210
  else {
63211
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH, me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT, true);
63212
63211
  ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
63213
63212
  }
63214
63213
  }
@@ -63297,7 +63296,6 @@ class Dialog {
63297
63296
  let status = thisClass.getDialogStatus().status;
63298
63297
 
63299
63298
  if((!status.bSelectannotationsInit2) &&(!status.bGraph2) &&(!status.bLineGraph2) &&(!status.bScatterplot2) &&(!status.bHbondplot2) &&(!status.bLigplot2) &&(!status.bTable2) &&(!status.bAlignmentInit2) ) {
63300
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH, me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT, true);
63301
63299
  ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
63302
63300
  }
63303
63301
  },
@@ -63342,8 +63340,7 @@ class Dialog {
63342
63340
  }
63343
63341
  }
63344
63342
  else {
63345
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH,(me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT) * 0.5, true);
63346
- ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH,(me.htmlCls.HEIGHT) * 0.5, true);
63343
+ //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH,(me.htmlCls.HEIGHT) * 0.5, true);
63347
63344
 
63348
63345
  //height =(me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT) * 0.5;
63349
63346
  height =(me.htmlCls.HEIGHT) * 0.5;
@@ -63383,7 +63380,6 @@ class Dialog {
63383
63380
  if(status.bSetsInit2) thisClass.openDlg2Ddgm(me.pre + 'dl_definedsets');
63384
63381
  }
63385
63382
  else {
63386
- //ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH - me.htmlCls.LESSWIDTH, me.htmlCls.HEIGHT - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT, true);
63387
63383
  ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
63388
63384
  }
63389
63385
  }
@@ -65516,7 +65512,20 @@ class Events {
65516
65512
  let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
65517
65513
 
65518
65514
  if(nameArray.length == 0) {
65519
- nameArray = $("#" + me.pre + "atomsCustom").val();
65515
+ // nameArray = $("#" + me.pre + "atomsCustom").val();
65516
+
65517
+ // choose the first chain for each structure
65518
+ nameArray = [];
65519
+ let structureHash = {};
65520
+ let chains = ic.resid2specCls.atoms2chains(ic.hAtoms);
65521
+
65522
+ for(let chainid in chains) {
65523
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]);
65524
+ if(!structureHash.hasOwnProperty(atom.structure) && (ic.proteins.hasOwnProperty(atom.serial) || ic.nucleotides.hasOwnProperty(atom.serial))) {
65525
+ nameArray.push(chainid);
65526
+ structureHash[atom.structure] = 1;
65527
+ }
65528
+ }
65520
65529
  }
65521
65530
 
65522
65531
  if(nameArray.length > 0) {
@@ -65536,20 +65545,6 @@ class Events {
65536
65545
  }
65537
65546
 
65538
65547
  if(bMsa) {
65539
- // choose the first chain for each structure
65540
- if(nameArray.length == 0) {
65541
- nameArray = [];
65542
- let structureHash = {};
65543
-
65544
- for(let chainid in ic.chains) {
65545
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chainid]);
65546
- if(!structureHash.hasOwnProperty(atom.structure) && (ic.proteins.hasOwnProperty(atom.serial) || ic.nucleotides.hasOwnProperty(atom.serial))) {
65547
- nameArray.push(chainid);
65548
- structureHash[atom.structure] = 1;
65549
- }
65550
- }
65551
- }
65552
-
65553
65548
  await ic.realignParserCls.realignOnStructAlignMsa(nameArray);
65554
65549
  }
65555
65550
  else {
@@ -126040,8 +126035,8 @@ class MmdbParser {
126040
126035
 
126041
126036
  if(type === undefined || type === 'target') {
126042
126037
  // if a command contains "load...", the commands should not be cleared with init()
126043
- let bKeepCmd = (ic.bCommandLoad) ? true : false;
126044
- if(!ic.bStatefile) ic.init(bKeepCmd);
126038
+ let bClearCmd = (ic.bCommandLoad) ? false : true;
126039
+ if(!ic.bStatefile) ic.init(bClearCmd);
126045
126040
 
126046
126041
  ic.chainsColor = {};
126047
126042
  ic.chainsGene = {};
@@ -127509,8 +127504,8 @@ class PdbParser {
127509
127504
  async loadPdbData(data, pdbid, bOpm, bAppend, type, bLastQuery, bNoDssp, bEsmfold) { let ic = this.icn3d, me = ic.icn3dui;
127510
127505
  if(!bAppend && (type === undefined || type === 'target')) {
127511
127506
  // if a command contains "load...", the commands should not be cleared with init()
127512
- let bKeepCmd = (ic.bCommandLoad) ? true : false;
127513
- if(!ic.bStatefile) ic.init(bKeepCmd);
127507
+ let bClearCmd = (ic.bCommandLoad) ? false : true;
127508
+ if(!ic.bStatefile) ic.init(bClearCmd);
127514
127509
  }
127515
127510
 
127516
127511
  let hAtoms = await ic.loadPDBCls.loadPDB(data, pdbid, bOpm, undefined, undefined, bAppend, type, bEsmfold); // defined in the core library
@@ -129998,6 +129993,7 @@ let resRangeArray = (me.cfg.resrange) ? decodeURIComponent(me.cfg.resrange).spli
129998
129993
  let predefinedResArray, predefinedResPair;
129999
129994
 
130000
129995
  if(bPredefined) {
129996
+ me.cfg.resdef = decodeURIComponent(me.cfg.resdef).trim();
130001
129997
  let tmpStr = me.cfg.resdef.replace(/; /gi, ': ');
130002
129998
  // predefinedResArray = decodeURIComponent(tmpStr).trim().replace(/\+/gi, ' ').split(': ');
130003
129999
  predefinedResArray = tmpStr.replace(/\+/gi, ' ').split(': ');
@@ -132938,45 +132934,6 @@ class SetSeqAlign {
132938
132934
  ic.nconsHash2 = {};
132939
132935
  ic.nalignHash2 = {};
132940
132936
 
132941
- // let msaSameColor = [];
132942
- // // assume all aligned seq are the same. If any aligned res is different,set it to false (0)
132943
- // for(let i = 0, il = seqalign[0].length; i < il; ++i) {
132944
- // msaSameColor.push(1);
132945
- // }
132946
-
132947
- for(let i = 0, il = seqalign.length; i < il; ++i) {
132948
- // first sequence
132949
- let alignData = seqalign[i][0];
132950
- let molid1 = alignData.moleculeId;
132951
-
132952
- let chain1 = ic.pdbid_molid2chain[mmdbid1 + '_' + molid1];
132953
- chainid1 = mmdbid1 + '_' + chain1;
132954
- alignData.sequence.length;
132955
- for(let j = 0, jl = alignData.sequence.length; j < jl; ++j) {
132956
- // 0: internal resi id, 1: pdb resi id, 2: resn, 3: aligned or not
132957
- (ic.bUsePdbNum) ? ic.ParserUtilsCls.getResi(chainid1, alignData.sequence[j][0] - 1) : alignData.sequence[j][0];
132958
- (alignData.sequence[j][2] === '~') ? '-' : alignData.sequence[j][2];
132959
-
132960
- (alignData.sequence[j][3]) ? 1 : 0;
132961
- }
132962
-
132963
- // second sequence
132964
- alignData = seqalign[i][1];
132965
-
132966
- // for(let j = start; j <= end; ++j) {
132967
- // // 0: internal resi id, 1: pdb resi id, 2: resn, 3: aligned or not
132968
- // let alignedTmp =(alignData.sequence[j][3]) ? 1 : 0;
132969
-
132970
- // let aligned = id2aligninfo[j].aligned + alignedTmp; // 0 or 2
132971
-
132972
- // if(aligned === 2) { // aligned
132973
- // if(id2aligninfo[j].resn != resn) {
132974
- // msaSameColor[j] = 0;
132975
- // }
132976
- // }
132977
- // }
132978
- }
132979
-
132980
132937
  for(let i = 0, il = seqalign.length; i < il; ++i) {
132981
132938
  // first sequence
132982
132939
  let alignData = seqalign[i][0];
@@ -133073,8 +133030,6 @@ class SetSeqAlign {
133073
133030
  ic.nconsHash2[chainid2 + '_' + resi] = 1;
133074
133031
  }
133075
133032
 
133076
- // color = (msaSameColor[j] == 0) ? '#0000FF' : '#FF0000';
133077
-
133078
133033
  // mapping, use the firstsequence as the reference structure
133079
133034
  ic.chainsMapping[chainid1][chainid1 + '_' + id2aligninfo[j].resi] = id2aligninfo[j].resn + id2aligninfo[j].resi;
133080
133035
  ic.chainsMapping[chainid2][chainid2 + '_' + resi] = id2aligninfo[j].resn + id2aligninfo[j].resi;
@@ -133091,8 +133046,6 @@ class SetSeqAlign {
133091
133046
 
133092
133047
  ic.nalignHash1[chainid1 + '_' + id2aligninfo[j].resi] = 1;
133093
133048
  ic.nalignHash2[chainid2 + '_' + resi] = 1;
133094
-
133095
- // msaSameColor[j] = 2; // not aligned
133096
133049
  }
133097
133050
 
133098
133051
  // chain1
@@ -133217,7 +133170,8 @@ class SetSeqAlign {
133217
133170
  return pos;
133218
133171
  }
133219
133172
 
133220
- getResnFromResi(chainid, resi) { let ic = this.icn3d, me = ic.icn3dui;
133173
+ getResnFromResi(chainid, resi) { let ic = this.icn3d; ic.icn3dui;
133174
+ /*
133221
133175
  let pos = this.getPosFromResi(chainid, resi);
133222
133176
  if(!pos) return '?';
133223
133177
 
@@ -133232,8 +133186,8 @@ class SetSeqAlign {
133232
133186
  }
133233
133187
 
133234
133188
  return resn;
133189
+ */
133235
133190
 
133236
- /*
133237
133191
  let resid = chainid + '_' + resi;
133238
133192
  let resn = ic.residueId2Name[resid];
133239
133193
  if(!resn) {
@@ -133241,7 +133195,6 @@ class SetSeqAlign {
133241
133195
  }
133242
133196
 
133243
133197
  return resn;
133244
- */
133245
133198
  }
133246
133199
 
133247
133200
  getResiAferAlign(chainid, bRealign, pos) { let ic = this.icn3d, me = ic.icn3dui;
@@ -133472,7 +133425,7 @@ class SetSeqAlign {
133472
133425
  }
133473
133426
  }
133474
133427
  }
133475
-
133428
+
133476
133429
  for(let j = 0; j <= end1 - start1; ++j) {
133477
133430
  ///if(ic.chainsSeq[chainid1] === undefined || ic.chainsSeq[chainid2] === undefined) break;
133478
133431
 
@@ -133585,29 +133538,43 @@ class SetSeqAlign {
133585
133538
  for(let i = 0, il = ic.qt_start_end[chainIndex].length; i < il; ++i) {
133586
133539
  let start1, end1;
133587
133540
 
133588
- //ic.qt_start_end is zero-based
133589
- if(!bRealign && me.cfg.aligntool != 'tmalign') { // vast alignment or seqalign
133590
- start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start) - 1;
133591
- end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end) - 1;
133592
- }
133593
- else {
133594
- start1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_start) - 1;
133595
- end1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_end) - 1;
133596
- }
133597
-
133541
+ // if(bRealign) { // real residue numbers are stored
133542
+ // start1 = ic.qt_start_end[chainIndex][i].t_start;
133543
+ // end1 = ic.qt_start_end[chainIndex][i].t_end;
133544
+ // }
133545
+ // else {
133546
+ //ic.qt_start_end is zero-based
133547
+ if(!bRealign && me.cfg.aligntool != 'tmalign') { // vast alignment
133548
+ start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start) - 1;
133549
+ end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end) - 1;
133550
+ }
133551
+ else {
133552
+ start1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_start) - 1;
133553
+ end1 = ic.ParserUtilsCls.getResiNCBI(chainid1, ic.qt_start_end[chainIndex][i].t_end) - 1;
133554
+ }
133555
+ // }
133598
133556
  for(let j = start1; j <= end1; ++j) {
133599
133557
  let resi, resid;
133600
133558
 
133601
- // let resiPos;
133602
- // if(me.cfg.aligntool == 'tmalign') {
133603
- // resiPos = j - baseResi;
133559
+ // if(me.cfg.aligntool == 'tmalign') { // tmalign: just one residue in this for loop
133560
+ // resi = ic.qt_start_end[chainIndex][i].t_start;
133604
133561
  // }
133605
133562
  // else {
133606
- // resiPos = j;
133563
+ // let resiPos = (bRealign || me.cfg.aligntool != 'tmalign') ? j : j - baseResi;
133564
+ // let resiPos;
133565
+ // if(me.cfg.aligntool == 'tmalign') {
133566
+ // resiPos = j - baseResi;
133567
+ // }
133568
+ // else {
133569
+ // // resiPos = (bRealign) ? j : j - baseResi;
133570
+ // resiPos = j;
133571
+ // }
133572
+
133573
+ let resiPos = j;
133574
+
133575
+ resi = ic.ParserUtilsCls.getResi(chainidArray[0], resiPos);
133576
+ resid = chainidArray[0] + '_' + resi;
133607
133577
  // }
133608
- let resiPos = j;
133609
- resi = ic.ParserUtilsCls.getResi(chainidArray[0], resiPos);
133610
- resid = chainidArray[0] + '_' + resi;
133611
133578
 
133612
133579
  resid2range_t[resid] = 1;
133613
133580
  if(j < start_t) start_t = j;
@@ -133621,6 +133588,7 @@ class SetSeqAlign {
133621
133588
 
133622
133589
  let resid2rangeArray = Object.keys(resid2range_t);
133623
133590
  resid2rangeArray.sort(function(a, b) {
133591
+ // return parseInt(a.split('_')[2]) - parseInt(b.split('_')[2]);
133624
133592
  let idArray1 = me.utilsCls.getIdArray(a);
133625
133593
  let idArray2 = me.utilsCls.getIdArray(b);
133626
133594
  return parseInt(idArray1[2]) - parseInt(idArray2[2]);
@@ -133632,7 +133600,7 @@ class SetSeqAlign {
133632
133600
  let resid = resid2rangeArray[i];
133633
133601
  let idArray = me.utilsCls.getIdArray(resid);
133634
133602
  let resi = idArray[2];
133635
-
133603
+
133636
133604
  if(i == 0) {
133637
133605
  start = resi;
133638
133606
  }
@@ -133671,9 +133639,7 @@ class SetSeqAlign {
133671
133639
  let resid = chainid1 + '_' + resi;
133672
133640
 
133673
133641
  // let jAdjusted = (me.cfg.aligntool != 'tmalign') ? j : j + baseResi;
133674
- //let jAdjusted = ic.ParserUtilsCls.getResiNCBI(chainid1, resi) - 1;
133675
- //!!!
133676
- let jAdjusted = (me.cfg.aligntool != 'tmalign') ? j : ic.ParserUtilsCls.getResiNCBI(chainid1, resi) - 1;
133642
+ let jAdjusted = (me.cfg.aligntool == 'seqalign') ? j : ic.ParserUtilsCls.getResiNCBI(chainid1, resi) - 1;
133677
133643
 
133678
133644
  //if(j + baseResi < start_t || j + baseResi > end_t) {
133679
133645
  if(jAdjusted < start_t || jAdjusted > end_t) {
@@ -133691,6 +133657,7 @@ class SetSeqAlign {
133691
133657
  resObject.color2 = (resid2range_t[resid]) ? '#FF0000' : me.htmlCls.GREYC; // color by conservation
133692
133658
  // resObject.class = (resid2range_t[resid]) ? 'icn3d-align' : 'icn3d-nalign';
133693
133659
  resObject.class = (resid2range_t[resid]) ? 'icn3d-cons' : 'icn3d-nalign';
133660
+
133694
133661
  ic.alnChainsSeq[chainid1].push(resObject);
133695
133662
 
133696
133663
  if(resid2range_t[resid]) {
@@ -133824,7 +133791,7 @@ class SetSeqAlign {
133824
133791
  if(ic.alnChainsSeq[chainid1]) {
133825
133792
  for(let j = 0, jl = ic.alnChainsSeq[chainid1].length; j < jl; ++j) {
133826
133793
  //add gap before the mapping region
133827
- //if(parseInt(ic.alnChainsSeq[chainid1][j].resi) == parseInt(resi_t)) {
133794
+ // if(parseInt(ic.alnChainsSeq[chainid1][j].resi) == parseInt(resi_t)) {
133828
133795
  if(ic.alnChainsSeq[chainid1][j].resi == resi_t) {
133829
133796
  pos_t = j;
133830
133797
  break;
@@ -133850,7 +133817,6 @@ class SetSeqAlign {
133850
133817
  for(let j = 0, jl = alignedChainIndice.length - 1; j < jl; ++j) {
133851
133818
  let chainidTmp = chainidArray[alignedChainIndice[j]];
133852
133819
  let gapResObject = this.getResObject(chainidTmp, true);
133853
-
133854
133820
  //for(let k = 0, kl = len - nGap; k < kl; ++k) {
133855
133821
  for(let k = 0, kl = len; k < kl; ++k) {
133856
133822
  ic.alnChainsSeq[chainidTmp].splice(pos_t, 0, gapResObject);
@@ -133867,6 +133833,7 @@ class SetSeqAlign {
133867
133833
  // let resn2 = this.getResn(chainid, start + j);
133868
133834
  let resi2 = (bRealign && me.cfg.aligntool == 'tmalign') ? start + j : ic.ParserUtilsCls.getResi(chainid, start + j);
133869
133835
  let resn2 = this.getResnFromResi(chainid, resi2);
133836
+
133870
133837
  let resn1 = '-';
133871
133838
  let bAlign = false;
133872
133839
  let resObject = this.getResObject(chainid, false, bAlign, resi2, resn2, resn1);
@@ -133875,22 +133842,28 @@ class SetSeqAlign {
133875
133842
  }
133876
133843
 
133877
133844
  getTemplatePosFromOriPos(chainid1, start, end, bRealign) { let ic = this.icn3d; ic.icn3dui;
133878
- //!!!
133879
133845
  let startResi = ic.ParserUtilsCls.getResi(chainid1, start);
133880
133846
  let endResi = ic.ParserUtilsCls.getResi(chainid1, end);
133847
+
133848
+ let result1 = this.getResiPosInTemplate(chainid1, startResi);
133849
+ let result2 = this.getResiPosInTemplate(chainid1, endResi);
133850
+
133851
+ return {"pos1": result1.pos, "pos2": result2.pos};
133852
+ }
133881
133853
 
133882
- // if(bRealign && me.cfg.aligntool == 'tmalign') { // vast alignment
133883
- // let startResi = start;
133884
- // let endResi = end;
133854
+ getTemplatePosFromOriResi(chainid1, start, end, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
133855
+ if(bRealign && me.cfg.aligntool == 'tmalign') { // vast alignment
133856
+ let startResi = start;
133857
+ let endResi = end;
133885
133858
 
133886
133859
  let result1 = this.getResiPosInTemplate(chainid1, startResi);
133887
133860
  let result2 = this.getResiPosInTemplate(chainid1, endResi);
133888
133861
 
133889
133862
  return {"pos1": result1.pos, "pos2": result2.pos};
133890
- // }
133891
- // else {
133892
- // return {"pos1": start, "pos2": end};
133893
- // }
133863
+ }
133864
+ else {
133865
+ return {"pos1": start, "pos2": end};
133866
+ }
133894
133867
  }
133895
133868
 
133896
133869
  mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resid2range_t, start_t, end_t, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
@@ -133952,9 +133925,6 @@ class SetSeqAlign {
133952
133925
  if(!ic.chainsMapping[chainid2]) ic.chainsMapping[chainid2] = {};
133953
133926
 
133954
133927
  let result;
133955
-
133956
- let nGapInTemplate = 0; // number of gaps inserted into the template sequence
133957
- let startPosInTemplate = 0; // position in the template sequence to start the mapping
133958
133928
 
133959
133929
  // need to improve when tmalign with residue number with postfix such as 52A in 4ORZ_C,5ESV_H
133960
133930
  // start and end should be positions, not original residue numbers.
@@ -133962,11 +133932,10 @@ class SetSeqAlign {
133962
133932
  start_t = ic.ParserUtilsCls.getResi(chainid1, start_t);
133963
133933
  end_t = ic.ParserUtilsCls.getResi(chainid1, end_t);
133964
133934
  }
133965
- console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign );
133935
+
133966
133936
  for(let i = 0, il = ic.qt_start_end[chainIndex].length; i < il; ++i) {
133967
133937
  let start1, start2, end1, end2, resiStart1, start1Pos, end1Pos;
133968
-
133969
- if(bRealign && (me.cfg.aligntool == 'tmalign')) { // real residue numbers are stored
133938
+ if(bRealign && me.cfg.aligntool == 'tmalign') { // real residue numbers are stored
133970
133939
  start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start);
133971
133940
  start2 = parseInt(ic.qt_start_end[chainIndex][i].q_start);
133972
133941
  end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end);
@@ -133994,28 +133963,46 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
133994
133963
  end1Pos = end1;
133995
133964
  }
133996
133965
  //let range = resid2range_t[chainid1 + '_' + resiStart1];
133997
-
133966
+
133998
133967
  // if the mapping does not start from start_t, add gaps to the query seq
133999
133968
  if(i == 0) {
134000
- startPosInTemplate = start1Pos;
134001
133969
 
134002
- //!!!
134003
- // result = this.getTemplatePosFromOriPos(chainid1, start_t, start1, bRealign);
134004
- result = this.getTemplatePosFromOriPos(chainid1, start_t, start1Pos, bRealign);
134005
- pos1 = result.pos1;
134006
- pos2 = result.pos2;
133970
+ if(me.cfg.aligntool == 'seqalign') {
133971
+ result = this.getTemplatePosFromOriPos(chainid1, start_t, start1Pos, bRealign);
134007
133972
 
134008
- //!!!
134009
- // if(start1 > start_t) {
134010
- if(start1Pos > start_t) {
134011
- for(let j = 0, jl = pos2 - pos1; j < jl; ++j) {
134012
- ic.alnChainsSeq[chainid2].push(gapResObject2);
133973
+ pos1 = result.pos1;
133974
+ pos2 = result.pos2;
133975
+
133976
+ //if(start1 > start_t) {
133977
+ if(start1Pos > start_t) {
133978
+ for(let j = 0, jl = pos2 - pos1; j < jl; ++j) {
133979
+ ic.alnChainsSeq[chainid2].push(gapResObject2);
133980
+ }
133981
+ }
133982
+ }
133983
+ else {
133984
+ result = this.getTemplatePosFromOriResi(chainid1, start_t, start1, bRealign);
133985
+
133986
+ pos1 = result.pos1;
133987
+ pos2 = result.pos2;
133988
+
133989
+ if(start1 > start_t) {
133990
+ //if(start1Pos > start_t) {
133991
+ for(let j = 0, jl = pos2 - pos1; j < jl; ++j) {
133992
+ ic.alnChainsSeq[chainid2].push(gapResObject2);
133993
+ }
134013
133994
  }
134014
133995
  }
134015
133996
  }
134016
133997
  else {
134017
133998
  //let notAlnLen1 = start1 - (prevIndex1 + 1);
134018
- result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, start1, bRealign);
133999
+ //!!!
134000
+ if(me.cfg.aligntool == 'seqalign') {
134001
+ result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, start1Pos, bRealign);
134002
+ }
134003
+ else {
134004
+ result = this.getTemplatePosFromOriResi(chainid1, prevIndex1, start1, bRealign);
134005
+ }
134019
134006
  pos1 = result.pos1;
134020
134007
  pos2 = result.pos2;
134021
134008
  let notAlnLen1 = pos2 - (pos1 + 1);
@@ -134026,47 +134013,48 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134026
134013
 
134027
134014
  // insert non-aligned residues in query seq
134028
134015
  this.insertNotAlignRes(chainid2, prevIndex2+1, notAlnLen2, bRealign);
134016
+
134029
134017
  if(notAlnLen1 >= notAlnLen2) {
134030
134018
  // add gaps before the query sequence
134031
134019
  for(let j = 0, jl = notAlnLen1 - notAlnLen2; j < jl; ++j) {
134032
134020
  ic.alnChainsSeq[chainid2].push(gapResObject2);
134033
- }
134021
+ }
134034
134022
  }
134035
134023
  else {
134036
134024
  // check the number of gaps before resiStart1 (n), and insert 'notAlnLen2 - notAlnLen1 - n' gaps
134037
134025
  this.addGapAllAlnChains(chainidArray, alignedChainIndice, chainid1, resiStart1, notAlnLen2 - notAlnLen1);
134038
- nGapInTemplate += (notAlnLen2 - notAlnLen1);
134039
134026
  }
134040
134027
  }
134041
134028
 
134042
134029
  // 2. In the mapped residues
134043
- // result = this.getTemplatePosFromOriPos(chainid1, start1, end1, bRealign);
134044
- result = this.getTemplatePosFromOriPos(chainid1, start1Pos, end1Pos, bRealign);
134030
+ if(me.cfg.aligntool == 'seqalign') {
134031
+ result = this.getTemplatePosFromOriPos(chainid1, start1Pos, end1Pos, bRealign);
134032
+ }
134033
+ else {
134034
+ result = this.getTemplatePosFromOriResi(chainid1, start1, end1, bRealign);
134035
+ }
134045
134036
  pos1 = result.pos1;
134046
134037
  pos2 = result.pos2;
134047
-
134038
+
134048
134039
  let k = 0;
134049
134040
  if(!ic.chainsMapping[chainid1]) ic.chainsMapping[chainid1] = {};
134050
134041
  if(!ic.chainsMapping[chainid2]) ic.chainsMapping[chainid2] = {};
134051
- //!!!!!!
134052
- let resiAdjust = ((bRealign && me.cfg.aligntool == 'tmalign') || me.cfg.aligntool == 'seqalign') ? 0 : - startPosInTemplate + nGapInTemplate;
134053
134042
  for(let j = pos1; j <= pos2; ++j) {
134054
134043
  // inherit the gaps from the template
134055
- if(ic.alnChainsSeq[chainid1][j + resiAdjust].resn == '-') {
134044
+ if(ic.alnChainsSeq[chainid1][j].resn == '-') {
134056
134045
  ic.alnChainsSeq[chainid2].push(gapResObject2);
134057
134046
  }
134058
134047
  else {
134059
134048
  let resi1 = (bRealign && me.cfg.aligntool == 'tmalign') ? start1 + k : ic.ParserUtilsCls.getResi(chainid1, start1 + k);
134060
134049
  let resi2 = (bRealign && me.cfg.aligntool == 'tmalign') ? start2 + k : ic.ParserUtilsCls.getResi(chainid2, start2 + k);
134061
-
134062
134050
  let resn1 = this.getResnFromResi(chainid1, resi1); //this.getResn(chainid1, start1 + k);
134063
134051
  let resn2 = this.getResnFromResi(chainid2, resi2); //this.getResn(chainid2, start2 + k);
134064
-
134052
+
134065
134053
  let bAlign = true;
134066
134054
  let resObject = this.getResObject(chainid2, false, bAlign, resi2, resn2, resn1);
134067
134055
  ic.alnChainsSeq[chainid2].push(resObject);
134068
134056
  // update color in the template
134069
- ic.alnChainsSeq[chainid1][j + resiAdjust].color = resObject.color;
134057
+ ic.alnChainsSeq[chainid1][j].color = resObject.color;
134070
134058
 
134071
134059
  ic.chainsMapping[chainid1][chainid1 + '_' + resi1] = resn1 + resi1;
134072
134060
  ic.chainsMapping[chainid2][chainid2 + '_' + resi2] = resn1 + resi1;
@@ -134084,7 +134072,12 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134084
134072
  }
134085
134073
 
134086
134074
  // add gaps at the end
134087
- result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, end_t, bRealign);
134075
+ if(me.cfg.aligntool == 'seqalign') {
134076
+ result = this.getTemplatePosFromOriPos(chainid1, prevIndex1, end_t, bRealign);
134077
+ }
134078
+ else {
134079
+ result = this.getTemplatePosFromOriResi(chainid1, prevIndex1, end_t, bRealign);
134080
+ }
134088
134081
  pos1 = result.pos1;
134089
134082
  pos2 = result.pos2;
134090
134083
  for(let i = pos1; i < pos2; ++i) {
@@ -134104,7 +134097,7 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134104
134097
 
134105
134098
  for(let i = 0, il = ic.qt_start_end[index].length; i < il; ++i) {
134106
134099
  let start1, start2, end1, end2, resiStart1, start1Pos, end1Pos;
134107
-
134100
+
134108
134101
  start1 = ic.qt_start_end[index][i].t_start;
134109
134102
  start2 = ic.qt_start_end[index][i].q_start;
134110
134103
  end1 = ic.qt_start_end[index][i].t_end;
@@ -134420,10 +134413,10 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134420
134413
  }
134421
134414
  }
134422
134415
 
134423
- setMsaFormat(chainidArray) { let ic = this.icn3d, me = ic.icn3dui;
134416
+ setMsaFormat(chainidArray) { let ic = this.icn3d; ic.icn3dui;
134424
134417
  //set MSA
134425
- let fastaFormat = '', clustalwFormat = 'CLUSTALWW\n\n', resbyresFormat = '';
134426
- let chainArrayClustal = [];
134418
+ let fastaFormat = '', clustalwFormat = 'CLUSTALW\n\n', resbyresFormat = '';
134419
+ let chainArrayClustalw = [];
134427
134420
 
134428
134421
  let consArray = [], resiArrayTemplate = [];
134429
134422
  let chainidTemplate = chainidArray[0];
@@ -134432,9 +134425,7 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134432
134425
  fastaFormat += '>' + chainid + '\n';
134433
134426
 
134434
134427
  let clustalwArray = [];
134435
- let itemArray = me.utilsCls.getIdArray(chainid);
134436
- let chainidStr = 'pdb|' + itemArray[0] + '|' + itemArray[1];
134437
- let clustalwLine = chainidStr.padEnd(20, ' ');
134428
+ let clustalwLine = chainid.padEnd(20, ' ');
134438
134429
  let consLine = ''.padEnd(20, ' ');
134439
134430
 
134440
134431
  let resiArrayTarget = [], resiArrayQuery = [];
@@ -134494,8 +134485,8 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134494
134485
 
134495
134486
  fastaFormat += '\n';
134496
134487
 
134497
- chainArrayClustal.push(clustalwArray);
134498
- if(i == il - 1) chainArrayClustal.push(consArray);
134488
+ chainArrayClustalw.push(clustalwArray);
134489
+ if(i == il - 1) chainArrayClustalw.push(consArray);
134499
134490
 
134500
134491
  // residue by residue
134501
134492
  let resiRangeStr1 = ic.resid2specCls.resi2range(resiArrayTarget, true);
@@ -134504,10 +134495,10 @@ console.log("### me.cfg.aligntool " + me.cfg.aligntool + " bRealign " + bRealign
134504
134495
  if(i > 0) resbyresFormat += resiRangeStr1 + ' | ' + resiRangeStr2 + '\n';
134505
134496
  }
134506
134497
 
134507
- // CLUSTALWW
134508
- for(let j = 0, jl = chainArrayClustal[0].length; j < jl; ++j) {
134509
- for(let i = 0, il = chainArrayClustal.length; i < il; ++i) {
134510
- clustalwFormat += chainArrayClustal[i][j] + '\n';
134498
+ // CLUSTALW
134499
+ for(let j = 0, jl = chainArrayClustalw[0].length; j < jl; ++j) {
134500
+ for(let i = 0, il = chainArrayClustalw.length; i < il; ++i) {
134501
+ clustalwFormat += chainArrayClustalw[i][j] + '\n';
134511
134502
  }
134512
134503
  clustalwFormat += '\n';
134513
134504
  }
@@ -142631,6 +142622,15 @@ class Resid2spec {
142631
142622
  return Object.keys(residueHash);
142632
142623
  }
142633
142624
 
142625
+ atoms2chains(atoms) {var ic = this.icn3d; ic.icn3dui;
142626
+ let chains = {};
142627
+ for(let i in atoms) {
142628
+ let atom = ic.atoms[i];
142629
+ chains[atom.structure + '_' + atom.chain] = 1;
142630
+ }
142631
+ return chains;
142632
+ }
142633
+
142634
142634
  atoms2structureArray(atoms) {var ic = this.icn3d; ic.icn3dui;
142635
142635
  let structures = {};
142636
142636
  for(let i in atoms) {
@@ -150246,11 +150246,10 @@ class ResizeCanvas {
150246
150246
  //me.htmlCls.HEIGHT = $( window ).height();
150247
150247
  me.utilsCls.setViewerWidthHeight(ic.icn3dui);
150248
150248
 
150249
- let width = me.htmlCls.WIDTH; // - me.htmlCls.LESSWIDTH_RESIZE;
150250
- let height = me.htmlCls.HEIGHT; // - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT;
150249
+ me.htmlCls.WIDTH; // - me.htmlCls.LESSWIDTH_RESIZE;
150250
+ me.htmlCls.HEIGHT; // - me.htmlCls.LESSHEIGHT - me.htmlCls.EXTRAHEIGHT;
150251
150251
 
150252
- // if(ic !== undefined && !ic.bFullscreen) thisClass.resizeCanvas(width, height);
150253
- if(ic !== undefined && !ic.bFullscreen) thisClass.resizeCanvas(width, height, true, true);
150252
+ //if(ic !== undefined && !ic.bFullscreen) thisClass.resizeCanvas(width, height, true, true);
150254
150253
  });
150255
150254
  }
150256
150255
  }
@@ -155000,8 +154999,8 @@ class iCn3D {
155000
154999
  }
155001
155000
  }
155002
155001
  //When users first load a structure, call this function to empty previous settings.
155003
- iCn3D.prototype.init = function (bKeepCmd, bKeepConfig) {
155004
- this.init_base(bKeepCmd, bKeepConfig);
155002
+ iCn3D.prototype.init = function (bClearCmd, bKeepConfig) {
155003
+ this.init_base(bClearCmd, bKeepConfig);
155005
155004
 
155006
155005
  this.molTitle = "";
155007
155006
 
@@ -155021,7 +155020,7 @@ iCn3D.prototype.init = function (bKeepCmd, bKeepConfig) {
155021
155020
  this.axes = [];
155022
155021
  };
155023
155022
 
155024
- iCn3D.prototype.init_base = function (bKeepCmd, bKeepConfig) {
155023
+ iCn3D.prototype.init_base = function (bClearCmd, bKeepConfig) {
155025
155024
  if(!bKeepConfig) this.resetConfig();
155026
155025
 
155027
155026
  this.structures = {}; // structure name -> array of chains
@@ -155116,7 +155115,7 @@ iCn3D.prototype.init_base = function (bKeepCmd, bKeepConfig) {
155116
155115
  this.transformCls.rotateCount = 0;
155117
155116
  this.transformCls.rotateCountMax = 20;
155118
155117
 
155119
- if(bKeepCmd) this.commands = [];
155118
+ if(bClearCmd) this.commands = [];
155120
155119
 
155121
155120
  this.axes = [];
155122
155121
 
@@ -155308,9 +155307,9 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
155308
155307
  resize: function( event, ui ) {
155309
155308
  me.htmlCls.WIDTH = ui.size.width; //$("#" + ic.pre + "canvas").width();
155310
155309
  me.htmlCls.HEIGHT = ui.size.height; //$("#" + ic.pre + "canvas").height();
155311
- if(ic !== undefined && !me.icn3d.bFullscreen) {
155312
- ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
155313
- }
155310
+ // if(ic !== undefined && !me.icn3d.bFullscreen) {
155311
+ // ic.resizeCanvasCls.resizeCanvas(me.htmlCls.WIDTH, me.htmlCls.HEIGHT, true);
155312
+ // }
155314
155313
  }
155315
155314
  });
155316
155315
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.54.7",
3
+ "version": "3.54.8",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {