icn3d 3.21.3 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/icn3d.js CHANGED
@@ -5986,11 +5986,23 @@ class ClickMenu {
5986
5986
  thisClass.setLogCmd("export pqr", true);
5987
5987
  });
5988
5988
 
5989
- me.myEventCls.onIds(["#" + me.pre + "delphipdbh", "#" + me.pre + "phipqr", "#" + me.pre + "phiurlpqr"], "click", async function(e) { me.icn3d; //e.preventDefault();
5990
- let bPdb = true;
5991
- await me.htmlCls.setHtmlCls.exportPqr(bPdb);
5992
- thisClass.setLogCmd("export pdbh", false);
5993
- });
5989
+ // me.myEventCls.onIds("#" + me.pre + "delphipqbh", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
5990
+ // let bPdb = true;
5991
+ // await me.htmlCls.setHtmlCls.exportPqr(bPdb);
5992
+ // thisClass.setLogCmd("export pdbh", false);
5993
+ // });
5994
+
5995
+ me.myEventCls.onIds("#" + me.pre + "profixpdb", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
5996
+ let bHydrogen = false;
5997
+ await ic.scapCls.exportPdbProfix(bHydrogen);
5998
+ thisClass.setLogCmd("export pdb missing atoms", true);
5999
+ });
6000
+
6001
+ me.myEventCls.onIds("#" + me.pre + "profixpdbh", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6002
+ let bHydrogen = true;
6003
+ await ic.scapCls.exportPdbProfix(bHydrogen);
6004
+ thisClass.setLogCmd("export pdb hydrogen", true);
6005
+ });
5994
6006
 
5995
6007
  me.myEventCls.onIds("#" + me.pre + "mn1_exportStl", "click", function(e) { let ic = me.icn3d; //e.preventDefault();
5996
6008
  thisClass.setLogCmd("export stl file", false);
@@ -8498,7 +8510,8 @@ class SetMenu {
8498
8510
  html += this.getLink('mn1_exportCounts', 'Residue Counts', undefined, 2);
8499
8511
 
8500
8512
  html += this.getLink('mn1_exportPdbRes', 'PDB', 1, 2);
8501
- html += this.getLink('delphipdbh', 'PDB with Hydrogens', undefined, 2);
8513
+ html += this.getLink('profixpdb', 'PDB with Missing Atoms', undefined, 2);
8514
+ html += this.getLink('profixpdbh', 'PDB with Hydrogens', undefined, 2);
8502
8515
 
8503
8516
  if(me.cfg.cid === undefined) {
8504
8517
  html += this.getLink('mn1_exportSecondary', 'Secondary Structure', undefined, 2);
@@ -10907,11 +10920,14 @@ class SetDialog {
10907
10920
 
10908
10921
  html += me.htmlCls.divStr + "dl_realignbystruct' class='" + dialogClass + "'>";
10909
10922
 
10910
- html += me.htmlCls.divNowrapStr + "1. Select sets in two chains below <br>or use your current selection:</div><br>";
10923
+ html += me.htmlCls.divNowrapStr + "<b>1</b>. Select sets in two chains below <br>or use your current selection:</div><br>";
10911
10924
  html += "<div style='text-indent:1.1em'><select id='" + me.pre + "atomsCustomRealignByStruct' multiple size='5' style='min-width:130px;'>";
10912
10925
  html += "</select></div><br>";
10913
10926
 
10914
- html += "<div>2. " + me.htmlCls.buttonStr + "applyRealignByStruct_tmalign'>Realign with TM-align</button>" + me.htmlCls.buttonStr + "applyRealignByStruct' style='margin-left:30px'>Realign with VAST</button></div><br>";
10927
+ html += "<div><b>2a</b>. <div style='display:inline-block; width:80px'>MSA:</div> " + me.htmlCls.buttonStr + "applyRealignByStructMsa_tmalign'>Realign with TM-align</button>" + me.htmlCls.buttonStr + "applyRealignByStructMsa' style='margin-left:30px'>Realign with VAST</button></div><br>";
10928
+
10929
+ html += "<div>or <b>2b</b>. <div style='display:inline-block; width:65px'>Pairwise:</div> " + me.htmlCls.buttonStr + "applyRealignByStruct_tmalign'>Realign with TM-align</button>" + me.htmlCls.buttonStr + "applyRealignByStruct' style='margin-left:30px'>Realign with VAST</button></div><br>";
10930
+
10915
10931
  html += "</div>";
10916
10932
 
10917
10933
  html += me.htmlCls.divStr + "dl_realigntwostru' class='" + dialogClass + "'>";
@@ -11584,6 +11600,32 @@ class Events {
11584
11600
  thisClass.setLogCmd('select ' + select + ' | name ' + commandname, true);
11585
11601
  }
11586
11602
 
11603
+ async setRealign(alignType, bMsa) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
11604
+ let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
11605
+ if(nameArray.length > 0) {
11606
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
11607
+ }
11608
+
11609
+ me.cfg.aligntool = alignType;
11610
+
11611
+ if(bMsa) {
11612
+ await ic.realignParserCls.realignOnStructAlignMsa(nameArray);
11613
+ }
11614
+ else {
11615
+ await ic.realignParserCls.realignOnStructAlign();
11616
+ }
11617
+
11618
+ let alignStr = (alignType == 'vast') ? 'structure align' : 'tmalign';
11619
+ alignStr += (bMsa) ? ' msa' : '';
11620
+
11621
+ if(nameArray.length > 0) {
11622
+ thisClass.setLogCmd("realign on " + alignStr + " | " + nameArray, true);
11623
+ }
11624
+ else {
11625
+ thisClass.setLogCmd("realign on " + alignStr, true);
11626
+ }
11627
+ }
11628
+
11587
11629
  readFile(bAppend, files, index, dataStrAll) { let me = this.icn3dui, ic = me.icn3d, thisClass = this;
11588
11630
  let file = files[index];
11589
11631
  let commandName = (bAppend) ? 'append': 'load';
@@ -11894,42 +11936,32 @@ class Events {
11894
11936
  }
11895
11937
  });
11896
11938
 
11897
- me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct", "click", async function(e) { let ic = me.icn3d;
11939
+ me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct", "click", async function(e) { me.icn3d;
11898
11940
  e.preventDefault();
11899
11941
  if(!me.cfg.notebook) dialog.dialog( "close" );
11900
- let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
11901
- if(nameArray.length > 0) {
11902
- ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
11903
- }
11904
-
11905
- me.cfg.aligntool = 'vast';
11906
-
11907
- await ic.realignParserCls.realignOnStructAlign();
11908
- if(nameArray.length > 0) {
11909
- thisClass.setLogCmd("realign on structure align | " + nameArray, true);
11910
- }
11911
- else {
11912
- thisClass.setLogCmd("realign on structure align", true);
11913
- }
11942
+
11943
+ await thisClass.setRealign('vast', false);
11914
11944
  });
11915
11945
 
11916
- me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct_tmalign", "click", async function(e) { let ic = me.icn3d;
11946
+ me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct_tmalign", "click", async function(e) { me.icn3d;
11917
11947
  e.preventDefault();
11918
11948
  if(!me.cfg.notebook) dialog.dialog( "close" );
11919
- let nameArray = $("#" + me.pre + "atomsCustomRealignByStruct").val();
11920
- if(nameArray.length > 0) {
11921
- ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
11922
- }
11923
11949
 
11924
- me.cfg.aligntool = 'tmalign';
11925
-
11926
- await ic.realignParserCls.realignOnStructAlign();
11927
- if(nameArray.length > 0) {
11928
- thisClass.setLogCmd("realign on tmalign | " + nameArray, true);
11929
- }
11930
- else {
11931
- thisClass.setLogCmd("realign on tmalign", true);
11932
- }
11950
+ await thisClass.setRealign('tmalign', false);
11951
+ });
11952
+
11953
+ me.myEventCls.onIds("#" + me.pre + "applyRealignByStructMsa", "click", async function(e) { me.icn3d;
11954
+ e.preventDefault();
11955
+ if(!me.cfg.notebook) dialog.dialog( "close" );
11956
+
11957
+ await thisClass.setRealign('vast', true);
11958
+ });
11959
+
11960
+ me.myEventCls.onIds("#" + me.pre + "applyRealignByStructMsa_tmalign", "click", async function(e) { me.icn3d;
11961
+ e.preventDefault();
11962
+ if(!me.cfg.notebook) dialog.dialog( "close" );
11963
+
11964
+ await thisClass.setRealign('tmalign', true);
11933
11965
  });
11934
11966
 
11935
11967
  me.myEventCls.onIds("#" + me.pre + "applyRealignByStruct_vastplus", "click", async function(e) { let ic = me.icn3d;
@@ -34014,7 +34046,7 @@ class AnnoCddSite {
34014
34046
 
34015
34047
  let linkStr = (bCoordinates) ? 'icn3d-link icn3d-blue' : '';
34016
34048
 
34017
- let htmlTmp2 = '<div class="icn3d-seqTitle ' + linkStr + '" site="site" posarray="' + adjustedResPosArray.toString() + '" shorttitle="' + title + '" setname="' + chnid + '_site_' + index + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">' + title + ' </div>';
34049
+ let htmlTmp2 = '<div class="icn3d-seqTitle ' + linkStr + '" site="site" posarray="' + resPosArray.toString() + '" shorttitle="' + title + '" setname="' + chnid + '_site_' + index + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">' + title + ' </div>';
34018
34050
  let htmlTmp3 = '<span class="icn3d-residueNum" title="residue count">' + resCnt.toString() + ' Res</span>';
34019
34051
  let htmlTmp = '<span class="icn3d-seqLine">';
34020
34052
  html3 += htmlTmp2 + htmlTmp3 + '<br>';
@@ -34186,8 +34218,9 @@ class AnnoCddSite {
34186
34218
  let from = parseInt(fromArray[i]), to = parseInt(toArray[i]);
34187
34219
 
34188
34220
  for(let j = from; j <= to; ++j) {
34189
-
34190
- let resid = chnid + "_" + j;
34221
+ let resi = ic.ParserUtilsCls.getResi(chnid, j);
34222
+ //let resid = chnid + "_" + j;
34223
+ let resid = chnid + "_" + resi;
34191
34224
 
34192
34225
  if(ic.residues.hasOwnProperty(resid)) {
34193
34226
  bCoordinates = true;
@@ -41114,7 +41147,9 @@ class LineGraph {
41114
41147
  nodeArray2 = nodeArrays.nodeArray2;
41115
41148
  ic.lineGraphStr = '{\n';
41116
41149
 
41117
- let structureArray = ic.resid2specCls.atoms2structureArray(ic.hAtoms);
41150
+ //let structureArray = ic.resid2specCls.atoms2structureArray(ic.hAtoms);
41151
+ let structureArray = Object.keys(ic.structures);
41152
+
41118
41153
  //if(Object.keys(ic.structures).length > 1) {
41119
41154
  if(structureArray.length > 1) {
41120
41155
 
@@ -41882,6 +41917,7 @@ class GetGraph {
41882
41917
 
41883
41918
  updateGraphColor() { let ic = this.icn3d, me = ic.icn3dui;
41884
41919
  // change graph color
41920
+
41885
41921
  if(ic.graphStr !== undefined) {
41886
41922
  let graphJson = JSON.parse(ic.graphStr);
41887
41923
  let resid2color = {};
@@ -44545,7 +44581,8 @@ class ChainalignParser {
44545
44581
  }
44546
44582
  }
44547
44583
 
44548
- async downloadChainalignmentPart2b(chainresiCalphaHash2, chainidArray, hAtoms, dataArray, indexArray, mmdbid_t, struArray) { let ic = this.icn3d, me = ic.icn3dui;
44584
+ async downloadChainalignmentPart2b(chainresiCalphaHash2, chainidArray, hAtoms, dataArray,
44585
+ indexArray, mmdbid_t, struArray) { let ic = this.icn3d, me = ic.icn3dui;
44549
44586
  //let bTargetTransformed = (ic.qt_start_end[0]) ? true : false;
44550
44587
 
44551
44588
  // modify the previous trans and rotation matrix
@@ -45076,11 +45113,16 @@ class ChainalignParser {
45076
45113
  if(ic.afChainIndexHash.hasOwnProperty(index)) {
45077
45114
  ++missedChainCnt;
45078
45115
 
45079
- // need to pass C-alpha coords and get transformation matrix from backend
45080
- ic.t_trans_add[index-1] = {"x":0, "y":0, "z":0};
45081
- ic.q_trans_sub[index-1] = {"x":0, "y":0, "z":0};
45116
+
45082
45117
 
45083
- if(me.cfg.aligntool == 'tmalign') ic.q_trans_add[index-1] = {"x":0, "y":0, "z":0};
45118
+ if(me.cfg.aligntool == 'tmalign') {
45119
+ ic.q_trans_add[index-1] = {"x":0, "y":0, "z":0};
45120
+ }
45121
+ else {
45122
+ // need to pass C-alpha coords and get transformation matrix from backend
45123
+ ic.t_trans_add[index-1] = {"x":0, "y":0, "z":0};
45124
+ ic.q_trans_sub[index-1] = {"x":0, "y":0, "z":0};
45125
+ }
45084
45126
 
45085
45127
  ic.q_rotation[index-1] = {"x1":1, "y1":0, "z1":0, "x2":0, "y2":1, "z2":0, "x3":0, "y3":0, "z3":1};
45086
45128
  ic.qt_start_end[index-1] = undefined;
@@ -45137,10 +45179,14 @@ class ChainalignParser {
45137
45179
  ic.q_rotation.push(align[0].q_rotation);
45138
45180
  ic.qt_start_end.push(align[0].segs);
45139
45181
  */
45140
- ic.t_trans_add[index] = align[0].t_trans_add;
45141
- ic.q_trans_sub[index] = align[0].q_trans_sub;
45142
45182
 
45143
- if(me.cfg.aligntool == 'tmalign') ic.q_trans_add[index] = align[0].q_trans_add;
45183
+ if(me.cfg.aligntool == 'tmalign') {
45184
+ ic.q_trans_add[index] = align[0].q_trans_add;
45185
+ }
45186
+ else {
45187
+ ic.t_trans_add[index] = align[0].t_trans_add;
45188
+ ic.q_trans_sub[index] = align[0].q_trans_sub;
45189
+ }
45144
45190
 
45145
45191
  ic.q_rotation[index] = align[0].q_rotation;
45146
45192
  ic.qt_start_end[index] = align[0].segs;
@@ -47911,6 +47957,8 @@ class RealignParser {
47911
47957
  let ajaxArray = [], chainidPairArray = [];
47912
47958
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
47913
47959
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
47960
+
47961
+ //let cnt = 0;
47914
47962
  let structArray = Object.keys(struct2domain);
47915
47963
  for(let s = 0, sl = structArray.length; s < sl; ++s) {
47916
47964
  let struct1 = structArray[s];
@@ -47923,13 +47971,13 @@ class RealignParser {
47923
47971
 
47924
47972
  for(let i = 0, il = chainidArray1.length; i < il; ++i) {
47925
47973
  let chainid1 = chainidArray1[i];
47974
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
47926
47975
  for(let j = 0, jl = chainidArray2.length; j < jl; ++j) {
47927
47976
  let chainid2 = chainidArray2[j];
47928
47977
 
47929
47978
  let alignAjax;
47930
47979
 
47931
47980
  if(me.cfg.aligntool != 'tmalign') {
47932
- let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct1][chainid1]);
47933
47981
  let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
47934
47982
 
47935
47983
  let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
@@ -47947,7 +47995,8 @@ class RealignParser {
47947
47995
  }
47948
47996
 
47949
47997
  ajaxArray.push(alignAjax);
47950
- chainidPairArray.push(chainid1 + ',' + chainid2); // chainid2 is target
47998
+ chainidPairArray.push(chainid1 + ',' + chainid2);
47999
+ //++cnt;
47951
48000
  }
47952
48001
  }
47953
48002
  }
@@ -47964,6 +48013,87 @@ class RealignParser {
47964
48013
  }
47965
48014
  }
47966
48015
 
48016
+ async realignOnStructAlignMsa(nameArray) { let ic = this.icn3d, me = ic.icn3dui;
48017
+ // each 3D domain should have at least 3 secondary structures
48018
+ let minSseCnt = 3;
48019
+ let chainid2domain = {};
48020
+
48021
+ for(let i = 0, il = nameArray.length; i < il; ++i) {
48022
+ let chainid = nameArray[i];
48023
+ let atoms = me.hashUtilsCls.intHash(ic.hAtoms, ic.chains[chainid]);
48024
+ let sseCnt = 0;
48025
+ for(let serial in atoms) {
48026
+ if(ic.atoms[serial].ssbegin) ++sseCnt;
48027
+ if(sseCnt == minSseCnt) {
48028
+ chainid2domain[chainid] = atoms;
48029
+ break;
48030
+ }
48031
+ }
48032
+ }
48033
+
48034
+ let ajaxArray = [], indexArray = [], struArray = [];
48035
+ let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
48036
+ let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
48037
+
48038
+ let chainid1 = nameArray[0];
48039
+ let struct1 = chainid1.substr(0, chainid1.indexOf('_'));
48040
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(chainid2domain[chainid1]);
48041
+
48042
+ for(let i = 1, il = nameArray.length; i < il; ++i) {
48043
+ let chainid2 = nameArray[i];
48044
+ let struct2 = chainid2.substr(0, chainid2.indexOf('_'));
48045
+
48046
+ let alignAjax;
48047
+
48048
+ if(me.cfg.aligntool != 'tmalign') {
48049
+ let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(chainid2domain[chainid2]);
48050
+
48051
+ let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
48052
+ alignAjax = me.getAjaxPostPromise(urlalign, dataObj);
48053
+ }
48054
+ else {
48055
+ // let pdb_target = ic.saveFileCls.getAtomPDB(chainid2domain[chainid1], undefined, undefined, undefined, undefined, struct1);
48056
+ // let pdb_query = ic.saveFileCls.getAtomPDB(chainid2domain[chainid2], undefined, undefined, undefined, undefined, struct2);
48057
+
48058
+ let pdb_target = ic.saveFileCls.getAtomPDB(ic.chains[chainid1], undefined, undefined, undefined, undefined, struct1);
48059
+ let pdb_query = ic.saveFileCls.getAtomPDB(ic.chains[chainid2], undefined, undefined, undefined, undefined, struct2);
48060
+
48061
+ let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target};
48062
+ alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
48063
+ }
48064
+
48065
+ ajaxArray.push(alignAjax);
48066
+ //chainidPairArray.push(chainid1 + ',' + chainid2);
48067
+
48068
+ indexArray.push(i - 1);
48069
+ struArray.push(struct2);
48070
+
48071
+ //++cnt;
48072
+ }
48073
+
48074
+ let allPromise = Promise.allSettled(ajaxArray);
48075
+ //try {
48076
+ let dataArray = await allPromise;
48077
+ //ic.qt_start_end = []; // reset the alignment
48078
+ //await ic.chainalignParserCls.downloadChainalignmentPart2bRealignMsa(dataArray, chainidPairArray);
48079
+
48080
+ // set trans and rotation matrix
48081
+ ic.t_trans_add = [];
48082
+ ic.q_trans_sub = [];
48083
+
48084
+ if(me.cfg.aligntool == 'tmalign') ic.q_trans_add = [];
48085
+
48086
+ ic.q_rotation = [];
48087
+ ic.qt_start_end = [];
48088
+
48089
+ await ic.chainalignParserCls.downloadChainalignmentPart2b(undefined, nameArray, undefined, dataArray,
48090
+ indexArray, struct1, struArray);
48091
+ // }
48092
+ // catch(err) {
48093
+ // if(ic.bRender) var aaa = 1; //alert("These structures can NOT be aligned to each other...");
48094
+ // }
48095
+ }
48096
+
47967
48097
  async realignChainOnSeqAlign(chainresiCalphaHash2, chainidArray, bRealign, bPredefined) { let ic = this.icn3d, me = ic.icn3dui;
47968
48098
  let thisClass = this;
47969
48099
 
@@ -53807,6 +53937,12 @@ class ApplyCommand {
53807
53937
  else if(command == 'export pdb') {
53808
53938
  me.htmlCls.setHtmlCls.exportPdb();
53809
53939
  }
53940
+ else if(command == 'export pdb missing atoms') {
53941
+ await ic.scapCls.exportPdbProfix(false);
53942
+ }
53943
+ else if(command == 'export pdb hydrogen') {
53944
+ await ic.scapCls.exportPdbProfix(true);
53945
+ }
53810
53946
  else if(command == 'export secondary structure') {
53811
53947
  me.htmlCls.setHtmlCls.exportSecondary();
53812
53948
  }
@@ -56197,6 +56333,17 @@ class LoadScript {
56197
56333
  await this.execCommandsBase(start, end, steps);
56198
56334
  }
56199
56335
 
56336
+ getNameArray(command) { let ic = this.icn3d; ic.icn3dui;
56337
+ let paraArray = command.split(' | ');
56338
+ let nameArray = [];
56339
+ if(paraArray.length == 2) {
56340
+ nameArray = paraArray[1].split(',');
56341
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
56342
+ }
56343
+
56344
+ return nameArray;
56345
+ }
56346
+
56200
56347
  async execCommandsBase(start, end, steps, bFinalStep) { let ic = this.icn3d, me = ic.icn3dui;
56201
56348
  let thisClass = this;
56202
56349
  let i;
@@ -56338,31 +56485,37 @@ class LoadScript {
56338
56485
  await ic.scapCls.applyCommandScap(command);
56339
56486
  }
56340
56487
  else if(command.indexOf('realign on seq align') == 0) {
56341
- let paraArray = command.split(' | ');
56342
- if(paraArray.length == 2) {
56343
- let nameArray = paraArray[1].split(',');
56344
- ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
56345
- }
56488
+ this.getNameArray(command);
56346
56489
 
56347
56490
  await thisClass.applyCommandRealign(command);
56348
56491
  }
56492
+ else if(command.indexOf('realign on structure align msa') == 0) {
56493
+ let nameArray = this.getNameArray(command);
56494
+
56495
+ me.cfg.aligntool = 'vast';
56496
+
56497
+ await ic.realignParserCls.realignOnStructAlignMsa(nameArray);
56498
+ }
56349
56499
  else if(command.indexOf('realign on structure align') == 0) {
56350
- let paraArray = command.split(' | ');
56351
- if(paraArray.length == 2) {
56352
- let nameArray = paraArray[1].split(',');
56353
- ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(nameArray);
56354
- }
56500
+ this.getNameArray(command);
56355
56501
 
56356
56502
  me.cfg.aligntool = 'vast';
56357
56503
 
56358
- await thisClass.applyCommandRealignByStruct(command);
56504
+ await ic.realignParserCls.realignOnStructAlign();
56505
+ }
56506
+ else if(command.indexOf('realign on tmalign msa') == 0) {
56507
+ let nameArray = this.getNameArray(command);
56508
+
56509
+ me.cfg.aligntool = 'tmalign';
56510
+
56511
+ await ic.realignParserCls.realignOnStructAlignMsa(nameArray);
56359
56512
  }
56360
56513
  else if(command.indexOf('realign on tmalign') == 0) {
56361
- thisClass.getHAtoms(ic.commands[i]);
56514
+ this.getNameArray(command);
56362
56515
 
56363
56516
  me.cfg.aligntool = 'tmalign';
56364
56517
 
56365
- await thisClass.applyCommandRealignByStruct(ic.commands[i]);
56518
+ await ic.realignParserCls.realignOnStructAlign();
56366
56519
  }
56367
56520
  else if(command.indexOf('realign on vastplus') == 0) {
56368
56521
  thisClass.getHAtoms(ic.commands[i]);
@@ -59831,11 +59984,12 @@ console.log("free energy: " + energy + " kcal/mol");
59831
59984
 
59832
59985
  // get the full mutatnt PDB
59833
59986
  let pdbDataMutant = ic.saveFileCls.getAtomPDB(ic.atoms, false, false, false, chainResi2pdb);
59987
+
59834
59988
  ic.hAtoms = {};
59835
59989
  let bMutation = true;
59836
59990
  ic.loadPDBCls.loadPDB(pdbDataMutant, pdbid, false, false, bMutation, bAddition);
59837
59991
  //let allAtoms2 = me.hashUtilsCls.cloneHash(ic.hAtoms);
59838
-
59992
+
59839
59993
  ic.setStyleCls.setAtomStyleByOptions(ic.opts);
59840
59994
  ic.setColorCls.setColorByOptions(ic.opts, ic.hAtoms);
59841
59995
 
@@ -59890,11 +60044,10 @@ console.log("free energy: " + energy + " kcal/mol");
59890
60044
  }
59891
60045
 
59892
60046
  if(bPdb) {
59893
- //let pdbStr = '';
59894
- //pdbStr += ic.saveFileCls.getAtomPDB(ic.hAtoms);
60047
+ // let file_pref =(ic.inputid) ? ic.inputid : "custom";
60048
+ // ic.saveFileCls.saveFile(file_pref + '_' + snpStr + '.pdb', 'text', [pdbDataMutant]);
59895
60049
 
59896
- let file_pref =(ic.inputid) ? ic.inputid : "custom";
59897
- ic.saveFileCls.saveFile(file_pref + '_' + snpStr + '.pdb', 'text', [pdbDataMutant]);
60050
+ await thisClass.exportPdbProfix(false, pdbDataMutant, snpStr);
59898
60051
 
59899
60052
  ic.drawCls.draw();
59900
60053
  }
@@ -59945,7 +60098,40 @@ console.log("free energy: " + energy + " kcal/mol");
59945
60098
 
59946
60099
  /// if(ic.deferredScap !== undefined) ic.deferredScap.resolve();
59947
60100
  return;
59948
- } }
60101
+ }
60102
+ }
60103
+
60104
+ async exportPdbProfix(bHydrogen, pdb, snpStr) { let ic = this.icn3d, me = ic.icn3dui;
60105
+ let pdbStr;
60106
+
60107
+ if(pdb) {
60108
+ pdbStr = pdb;
60109
+ }
60110
+ else {
60111
+ let atoms = me.hashUtilsCls.intHash(ic.dAtoms, ic.hAtoms);
60112
+ pdbStr += ic.saveFileCls.getAtomPDB(atoms);
60113
+ }
60114
+
60115
+ let url = me.htmlCls.baseUrl + "scap/scap.cgi";
60116
+ let hydrogenStr = (bHydrogen) ? '1' : '0';
60117
+ let dataObj = {'pdb': pdbStr, 'profix': '1', 'hydrogen': hydrogenStr};
60118
+
60119
+ let data;
60120
+
60121
+ try {
60122
+ data = await me.getAjaxPostPromise(url, dataObj, undefined, undefined, undefined, undefined, 'text');
60123
+ }
60124
+ catch(err) {
60125
+ var aaa = 1; //alert("There are some problems in adding missing atoms or hydrogens...");
60126
+ return;
60127
+ }
60128
+
60129
+ let file_pref =(ic.inputid) ? ic.inputid : "custom";
60130
+ let postfix = (bHydrogen) ? "add_hydrogen" : "add_missing_atoms";
60131
+ if(snpStr) postfix = snpStr;
60132
+
60133
+ ic.saveFileCls.saveFile(file_pref + '_icn3d_' + postfix + '.pdb', 'text', [data]);
60134
+ }
59949
60135
  }
59950
60136
 
59951
60137
  /**
@@ -63789,10 +63975,11 @@ class SaveFile {
63789
63975
  }
63790
63976
 
63791
63977
  // if(!bNoSs) {
63792
- let prevResi, stru;
63978
+ let prevResi, stru, chainid;
63793
63979
  for(let i in calphaHash) {
63794
63980
  let atom = ic.atoms[i];
63795
63981
  stru = atom.structure;
63982
+ chainid = atom.structure + '_' + atom.chain;
63796
63983
 
63797
63984
  if(atom.ssbegin) {
63798
63985
  if(atom.ss == 'helix') {
@@ -63813,7 +64000,9 @@ class SaveFile {
63813
64000
  if(atom.ssend) {
63814
64001
  if(atom.ss == 'helix') {
63815
64002
  bHelixEnd = true;
63816
- let helixLen = ic.resid2ncbi[atom.resi] - ic.resid2ncbi[prevResi];
64003
+ let residEnd = ic.resid2ncbi[chainid + '_' + atom.resi];
64004
+ let residStart = ic.resid2ncbi[chainid + '_' + prevResi];
64005
+ let helixLen = (residEnd && residStart) ? parseInt(residEnd.substr(residEnd.lastIndexOf('_') + 1)) - parseInt(residStart.substr(residStart.lastIndexOf('_') + 1)) : 0;
63817
64006
  let helixType = 1;
63818
64007
  if(bHelixBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
63819
64008
  + atom.resi.toString().padStart(5, ' ') + ' ' + helixType + helixLen.toString().padStart(36, ' ') + '\n';
@@ -63894,7 +64083,7 @@ class SaveFile {
63894
64083
  }
63895
64084
 
63896
64085
  let chainResi = atom.chain + '_' + atom.resi;
63897
- if(chainResi2pdb && chainResi2pdb.hasOwnProperty(chainResi)) {
64086
+ if(chainResi2pdb && chainResi2pdb.hasOwnProperty(chainResi)) {
63898
64087
  if(!addedChainResiHash.hasOwnProperty(chainResi)) {
63899
64088
  pdbStr += chainResi2pdb[chainResi];
63900
64089
  addedChainResiHash[chainResi] = 1;
@@ -64059,7 +64248,7 @@ class SaveFile {
64059
64248
  }
64060
64249
 
64061
64250
  pdbStr += connStr;
64062
-
64251
+
64063
64252
  if(bMulStruc) pdbStr += '\nENDMDL\n';
64064
64253
 
64065
64254
  return pdbStr;
@@ -67451,7 +67640,7 @@ class iCn3DUI {
67451
67640
  //even when multiple iCn3D viewers are shown together.
67452
67641
  this.pre = this.cfg.divid + "_";
67453
67642
 
67454
- this.REVISION = '3.21.3';
67643
+ this.REVISION = '3.22.0';
67455
67644
 
67456
67645
  // In nodejs, iCn3D defines "window = {navigator: {}}"
67457
67646
  this.bNode = (Object.keys(window).length < 2) ? true : false;