icn3d 3.34.0 → 3.34.2

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
@@ -14552,7 +14552,7 @@ class SetDialog {
14552
14552
  html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
14553
14553
 
14554
14554
  // html += "The real interaction distances are not in scale, and are about twice the distances of dashed line segments.<br>Some \"Contact\" lines are only shown partially to simplify the view.<br>";
14555
- html += "<b>Color Legend</b>: <br>";
14555
+ html += "Color legend for interactions (dashed lines): <br>";
14556
14556
 
14557
14557
  html += me.htmlCls.setHtmlCls.setColorHints();
14558
14558
 
@@ -15614,8 +15614,8 @@ class Events {
15614
15614
  hostUrl = (pos == -1) ? hostUrl : hostUrl.substr(0, pos);
15615
15615
 
15616
15616
  // some URLs from VAST search are like https://www.ncbi.nlm.nih.gov/Structure/vast/icn3d/
15617
- if(hostUrl == 'https://www.ncbi.nlm.nih.gov/Structure/vast/icn3d/') {
15618
- hostUrl = 'https://www.ncbi.nlm.nih.gov/Structure/icn3d/';
15617
+ if(hostUrl.indexOf('/vast/icn3d/')) {
15618
+ hostUrl = hostUrl.replace(/\/vast\/icn3d\//g, '/icn3d/');
15619
15619
  }
15620
15620
 
15621
15621
  ic.definedSetsCls.clickCustomAtoms();
@@ -38594,15 +38594,16 @@ class SetColor {
38594
38594
  atoms = me.hashUtilsCls.intHash(atoms, ic.hAtoms);
38595
38595
 
38596
38596
  for (let i in atoms) {
38597
- let atom = ic.atoms[i];
38598
- if(!atom.het) ++cnt;
38597
+ ic.atoms[i];
38598
+ // if(!atom.het) ++cnt;
38599
+ ++cnt;
38599
38600
  }
38600
38601
 
38601
38602
  let lastTerSerialInv = (cnt > 1) ? 1 / (cnt - 1) : 1;
38602
38603
  for (let i in atoms) {
38603
38604
  let atom = ic.atoms[i];
38604
- //atom.color = atom.het ? me.parasCls.atomColors[atom.elem] || me.parasCls.defaultAtomColor : me.parasCls.thr().setHSL(2 / 3 * (1 - idx++ * lastTerSerialInv), 1, 0.45);
38605
- atom.color = atom.het ? me.parasCls.atomColors[atom.elem] || me.parasCls.defaultAtomColor : me.parasCls.thr().setHSL(3 / 4 * (1 - idx++ * lastTerSerialInv), 1, 0.45);
38605
+ // atom.color = atom.het ? me.parasCls.atomColors[atom.elem] || me.parasCls.defaultAtomColor : me.parasCls.thr().setHSL(3 / 4 * (1 - idx++ * lastTerSerialInv), 1, 0.45);
38606
+ atom.color = me.parasCls.thr().setHSL(3 / 4 * (1 - idx++ * lastTerSerialInv), 1, 0.45);
38606
38607
 
38607
38608
  ic.atomPrevColors[i] = atom.color;
38608
38609
  }
@@ -38616,14 +38617,16 @@ class SetColor {
38616
38617
  atoms = me.hashUtilsCls.intHash(atoms, ic.hAtoms);
38617
38618
 
38618
38619
  for (let i in atoms) {
38619
- let atom = ic.atoms[i];
38620
- if(!atom.het) ++cnt;
38620
+ ic.atoms[i];
38621
+ // if(!atom.het) ++cnt;
38622
+ ++cnt;
38621
38623
  }
38622
38624
 
38623
38625
  let lastTerSerialInv = (cnt > 1) ? 1 / (cnt - 1) : 1;
38624
38626
  for (let i in atoms) {
38625
38627
  let atom = ic.atoms[i];
38626
- atom.color = atom.het ? me.parasCls.atomColors[atom.elem] || me.parasCls.defaultAtomColor : me.parasCls.thr().setHSL(3 / 4 * idx++ * lastTerSerialInv, 1, 0.45);
38628
+ // atom.color = atom.het ? me.parasCls.atomColors[atom.elem] || me.parasCls.defaultAtomColor : me.parasCls.thr().setHSL(3 / 4 * idx++ * lastTerSerialInv, 1, 0.45);
38629
+ atom.color = me.parasCls.thr().setHSL(3 / 4 * idx++ * lastTerSerialInv, 1, 0.45);
38627
38630
 
38628
38631
  ic.atomPrevColors[i] = atom.color;
38629
38632
  }
@@ -49712,7 +49715,8 @@ class LineGraph {
49712
49715
  if(pos1 === undefined || pos2 === undefined) continue;
49713
49716
  let linestrokewidth;
49714
49717
  if(link.v == me.htmlCls.contactValue) {
49715
- linestrokewidth = (link.n == 1) ? 1 : 3;
49718
+ // linestrokewidth = (link.n == 1) ? 1 : 3;
49719
+ linestrokewidth = 1;
49716
49720
  } else {
49717
49721
  linestrokewidth = (link.n == 1) ? 2 : 4;
49718
49722
  }
@@ -49840,7 +49844,8 @@ class LineGraph {
49840
49844
 
49841
49845
  let linestrokewidth;
49842
49846
  if(link.v == me.htmlCls.contactValue) {
49843
- linestrokewidth = (link.n == 1) ? 1 : 3;
49847
+ // linestrokewidth = (link.n == 1) ? 1 : 3;
49848
+ linestrokewidth = 1;
49844
49849
  } else {
49845
49850
  linestrokewidth = (link.n == 1) ? 2 : 4;
49846
49851
  }
@@ -50310,6 +50315,7 @@ class GetGraph {
50310
50315
  interStr += this.getContactLinks(ssAtomsArray[i], ssAtomsArray[j], labelType, true, bCartoon2d);
50311
50316
  }
50312
50317
  }
50318
+
50313
50319
  return interStr;
50314
50320
  }
50315
50321
  getContactLinks(atomlistTarget, otherAtoms, labelType, bInternal, bCartoon2d) { let ic = this.icn3d, me = ic.icn3dui;
@@ -50352,7 +50358,14 @@ class GetGraph {
50352
50358
  for(let resid1 in hash1) {
50353
50359
  //ASN $1KQ2.A:6@ND2
50354
50360
  //or ASN $1KQ2.A:6
50355
- resid1 = resid1.trim();
50361
+ // or ASN $1KQ2.A:6@ND2 2006
50362
+ let resid1Ori = resid1.trim();
50363
+
50364
+ let idArray1 = resid1Ori.split(' ');
50365
+ if(idArray1.length == 3) {
50366
+ resid1 = idArray1[0] + ' ' + idArray1[1];
50367
+ }
50368
+
50356
50369
  let pos1a = resid1.indexOf(' ');
50357
50370
  let pos1b = resid1.indexOf(':');
50358
50371
  let posTmp1 = resid1.indexOf('@');
@@ -50362,8 +50375,14 @@ class GetGraph {
50362
50375
  let resName1 = me.utilsCls.residueName2Abbr(resid1.substr(0, pos1a)) + resid1.substr(pos1b + 1, pos1c - pos1b - 1);
50363
50376
  if(labelType == 'chain' || labelType == 'structure') resName1 += '.' + resid1.substr(pos1d + 1, pos1b - pos1d - 1);
50364
50377
  if(labelType == 'structure') resName1 += '.' + resid1.substr(pos1e + 1, pos1d - pos1e - 1);
50365
- for(let resid2 in hash2[resid1]) {
50366
- resid2 = resid2.trim();
50378
+ for(let resid2 in hash2[resid1Ori]) {
50379
+ let resid2Ori = resid2.trim();
50380
+
50381
+ let idArray2 = resid2Ori.split(' ');
50382
+ if(idArray2.length == 3) {
50383
+ resid2 = idArray2[0] + ' ' + idArray2[1];
50384
+ }
50385
+
50367
50386
  let pos2a = resid2.indexOf(' ');
50368
50387
  let pos2b = resid2.indexOf(':');
50369
50388
  let posTmp2 = resid2.indexOf('@');
@@ -50379,16 +50398,6 @@ class GetGraph {
50379
50398
  resName1 = ic.resi2resirange[resName1];
50380
50399
  resName2 = ic.resi2resirange[resName2];
50381
50400
  }
50382
- /*
50383
- if(!sourceTargetHash.hasOwnProperty(resName1 + '_' + resName2) && resName1 !== undefined && resName2 !== undefined ) {
50384
- let linkStr = ', {"source": "' + resName1 + '", "target": "' + resName2 + '", "v": ' + value + ', "c": "' + color + '"}';
50385
- if(linkStr != prevLinkStr) hbondStr += linkStr;
50386
- prevLinkStr = linkStr;
50387
-
50388
- sourceTargetHash[resName1 + '_' + resName2] = 1;
50389
- sourceTargetHash[resName2 + '_' + resName1] = 1;
50390
- }
50391
- */
50392
50401
 
50393
50402
  if(resName1 !== undefined && resName2 !== undefined ) {
50394
50403
  let linkStr = '"source": "' + resName1 + '", "target": "' + resName2 + '", "v": ' + value + ', "c": "' + color + '"';
@@ -52952,16 +52961,17 @@ class ChainalignParser {
52952
52961
  // calculate secondary structures with applyCommandDssp
52953
52962
  //$.when(ic.pdbParserCls.applyCommandDssp(true)).then(function() {
52954
52963
  await ic.pdbParserCls.applyCommandDssp(true);
52955
-
52964
+ //!!!
52965
+ /*
52956
52966
  // original version =============
52957
52967
  // align PDB chains
52958
52968
  for(let index in ic.pdbChainIndexHash) {
52959
52969
  //ic.pdbChainIndexHash[index] = mmdbid_q_tmp + "_" + ic.chain_q + "_" + ic.mmdbid_t + "_" + ic.chain_t;
52960
52970
  let idArray = ic.pdbChainIndexHash[index].split('_');
52961
52971
  mmdbid_q = idArray[0];
52962
- idArray[1];
52972
+ let chain_q = idArray[1];
52963
52973
  mmdbid_t = idArray[2];
52964
- idArray[3];
52974
+ let chain_t = idArray[3];
52965
52975
 
52966
52976
  thisClass.transformStructure(mmdbid_q, index-1, 'query');
52967
52977
  }
@@ -52971,7 +52981,7 @@ class ChainalignParser {
52971
52981
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
52972
52982
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
52973
52983
 
52974
- let resRangeArray = (me.cfg.resrange) ? me.cfg.resrange.split(' | ') : [];
52984
+ let resRangeArray = (me.cfg.resrange) ? me.cfg.resrange.split(',') : [];
52975
52985
 
52976
52986
  for(let index in ic.afChainIndexHash) {
52977
52987
  let idArray = ic.afChainIndexHash[index].split('_');
@@ -52983,25 +52993,26 @@ class ChainalignParser {
52983
52993
  let chain_t = idArray[3];
52984
52994
  let chainid_t = mmdbid_t + '_' + chain_t;
52985
52995
 
52986
- let atomSet_t = (resRangeArray[0]) ? ic.realignParserCls.getSeqCoorResid(resRangeArray[0].split(','), chainid_t).hAtoms : ic.chains[chainid_t];
52987
- let atomSet_q = (resRangeArray[index]) ? ic.realignParserCls.getSeqCoorResid(resRangeArray[index].split(','), chainid_q).hAtoms : ic.chains[chainid_q];
52996
+ // let atomSet_t = (resRangeArray[0]) ? ic.realignParserCls.getSeqCoorResid(resRangeArray[0].split(','), chainid_t, true).hAtoms : ic.chains[chainid_t];
52997
+ // let atomSet_q = (resRangeArray[index]) ? ic.realignParserCls.getSeqCoorResid(resRangeArray[index].split(','), chainid_q, true).hAtoms : ic.chains[chainid_q];
52998
+ let atomSet_t = (resRangeArray[0]) ? ic.realignParserCls.getSeqCoorResid([resRangeArray[0]], chainid_t, true).hAtoms : ic.chains[chainid_t];
52999
+ let atomSet_q = (resRangeArray[index]) ? ic.realignParserCls.getSeqCoorResid([resRangeArray[index]], chainid_q, true).hAtoms : ic.chains[chainid_q];
52988
53000
  // end of original version =============
52989
-
52990
- /*
53001
+ */
53002
+
52991
53003
  // new version to be done for VASTsrv ==============
52992
53004
  // dynamically align pairs in all chainids
52993
53005
  let ajaxArray = [], indexArray = [], struArray = [];
52994
53006
  let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
52995
53007
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
52996
53008
 
52997
- let resRangeArray = (me.cfg.resrange) ? me.cfg.resrange.split(' | ') : [];
53009
+ let resRangeArray = (me.cfg.resrange) ? me.cfg.resrange.split(',') : [];
52998
53010
 
52999
53011
  // dynamically align pairs in all chainids
53000
- let atomSet_t = (me.cfg.resrange) ? ic.realignParserCls.getSeqCoorResid(resRangeArray[0].split(','), chainidArray[0]).hAtoms : ic.chains[chainidArray[0]];
53012
+ let atomSet_t = (me.cfg.resrange) ? ic.realignParserCls.getSeqCoorResid([resRangeArray[0]], chainidArray[0], true).hAtoms : ic.chains[chainidArray[0]];
53001
53013
  for(let index = 1, indexl = chainidArray.length; index < indexl; ++index) {
53002
- let atomSet_q = (me.cfg.resrange) ? ic.realignParserCls.getSeqCoorResid(resRangeArray[index].split(','), chainidArray[index]).hAtoms : ic.chains[chainidArray[index]];
53014
+ let atomSet_q = (me.cfg.resrange) ? ic.realignParserCls.getSeqCoorResid([resRangeArray[index]], chainidArray[index], true).hAtoms : ic.chains[chainidArray[index]];
53003
53015
  // end of new version to be done for VASTsrv ==============
53004
- */
53005
53016
 
53006
53017
  let alignAjax;
53007
53018
  if(me.cfg.aligntool != 'tmalign') {
@@ -53229,10 +53240,11 @@ class ChainalignParser {
53229
53240
 
53230
53241
  // chainid1 is target
53231
53242
  aligType = 'target';
53232
- this.transformStructure(target, index, aligType);
53243
+ let bForce = true;
53244
+ this.transformStructure(target, index, aligType, bForce);
53233
53245
 
53234
53246
  aligType = 'query';
53235
- this.transformStructure(query, index, aligType);
53247
+ this.transformStructure(query, index, aligType, bForce);
53236
53248
 
53237
53249
  allChainidHash[chainidArray[0]] = 1;
53238
53250
  allChainidHash[chainidArray[1]] = 1;
@@ -53910,8 +53922,12 @@ class ChainalignParser {
53910
53922
 
53911
53923
  if(bQuery && me.cfg.matchedchains) {
53912
53924
  // $.when(ic.pdbParserCls.applyCommandDssp(true)).then(function() {
53913
- let bRealign = true, bPredefined = true;
53914
- await ic.realignParserCls.realignChainOnSeqAlign(undefined, ic.chainidArray, bRealign, bPredefined);
53925
+ // let bRealign = true, bPredefined = true;
53926
+ // await ic.realignParserCls.realignChainOnSeqAlign(undefined, ic.chainidArray, bRealign, bPredefined);
53927
+
53928
+ ic.hAtoms = ic.definedSetsCls.getAtomsFromNameArray(ic.chainidArray);
53929
+ await ic.realignParserCls.realignOnStructAlign();
53930
+
53915
53931
  // reset annotations
53916
53932
  $("#" + ic.pre + "dl_annotations").html("");
53917
53933
  ic.bAnnoShown = false;
@@ -58482,7 +58498,7 @@ class RealignParser {
58482
58498
  }
58483
58499
  }
58484
58500
 
58485
- getSeqCoorResid(resiArray, chainid) { let ic = this.icn3d, me = ic.icn3dui;
58501
+ getSeqCoorResid(resiArray, chainid, bNCBI) { let ic = this.icn3d, me = ic.icn3dui;
58486
58502
  let seq = '', coorArray = [], residArray = [];
58487
58503
  let hAtoms = {};
58488
58504
 
@@ -58490,15 +58506,7 @@ class RealignParser {
58490
58506
  if(resiArray[j].indexOf('-') != -1) {
58491
58507
  let startEnd = resiArray[j].split('-');
58492
58508
  for(let k = parseInt(startEnd[0]); k <= parseInt(startEnd[1]); ++k) {
58493
- // from VAST neighbor page, use NCBI residue number
58494
- //if(me.cfg.usepdbnum === false) k += base - 1;
58495
-
58496
- //let seqIndex = k - base;
58497
- let seqIndex = ic.setSeqAlignCls.getPosFromResi(chainid, k);
58498
- // if(ic.bNCBI) {
58499
- // let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chainid + '_' + k]);
58500
- // if(atom && atom.resiNCBI) seqIndex = atom.resiNCBI - 1;
58501
- // }
58509
+ let seqIndex = (bNCBI) ? k : ic.setSeqAlignCls.getPosFromResi(chainid, k);
58502
58510
 
58503
58511
  // don't align solvent or chemicals
58504
58512
  if(!ic.chainsSeq[chainid] || !ic.chainsSeq[chainid][seqIndex] || me.parasCls.b62ResArray.indexOf(ic.chainsSeq[chainid][seqIndex].name.toUpperCase()) == -1) continue;
@@ -58510,20 +58518,14 @@ class RealignParser {
58510
58518
  residArray.push(chainid + '_' + k);
58511
58519
  }
58512
58520
  }
58521
+ else if(resiArray[j] == 0) { // 0 means the whole chain
58522
+ let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.chains[chainid]);
58523
+ residArray = Object.keys(residueHash);
58524
+ }
58513
58525
  else { // one residue
58514
-
58515
- //let k = parseInt(resiArray[j]);
58516
58526
  let k = resiArray[j];
58517
- // from VAST neighbor page, use NCBI residue number
58518
- //if(me.cfg.usepdbnum === false) k += base - 1;
58519
58527
 
58520
- //let seqIndex = k - base;
58521
- let seqIndex = ic.setSeqAlignCls.getPosFromResi(chainid, k);
58522
-
58523
- // if(ic.bNCBI) {
58524
- // let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chainid + '_' + k]);
58525
- // if(atom && atom.resiNCBI) seqIndex = atom.resiNCBI - 1;
58526
- // }
58528
+ let seqIndex = (bNCBI) ? k : ic.setSeqAlignCls.getPosFromResi(chainid, k);
58527
58529
 
58528
58530
  if(!ic.chainsSeq[chainid][seqIndex]) continue;
58529
58531
 
@@ -68524,9 +68526,10 @@ class LoadScript {
68524
68526
 
68525
68527
  if(command.indexOf('load') !== -1) { // 'load pdb [pdbid]'
68526
68528
  let load_parameters = command.split(' | ');
68527
-
68528
68529
  let loadStr = load_parameters[0];
68529
- if(load_parameters.length > 1) {
68530
+
68531
+ // do not reset me.cfg.inpara from "command=..." part if it was not empty
68532
+ if(load_parameters.length > 1 && !me.cfg.inpara) {
68530
68533
  let firstSpacePos = load_parameters[load_parameters.length - 1].indexOf(' ');
68531
68534
  me.cfg.inpara = load_parameters[load_parameters.length - 1].substr(firstSpacePos + 1);
68532
68535
  if(me.cfg.inpara === 'undefined') {
@@ -81904,7 +81907,7 @@ class iCn3DUI {
81904
81907
  //even when multiple iCn3D viewers are shown together.
81905
81908
  this.pre = this.cfg.divid + "_";
81906
81909
 
81907
- this.REVISION = '3.34.0';
81910
+ this.REVISION = '3.34.1';
81908
81911
 
81909
81912
  // In nodejs, iCn3D defines "window = {navigator: {}}"
81910
81913
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -82094,7 +82097,8 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
82094
82097
  await ic.realignParserCls.realignChainOnSeqAlign(undefined, chainidArray, bRealign, bPredefined);
82095
82098
  }
82096
82099
  }
82097
- else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
82100
+ // else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
82101
+ else if(me.cfg.matchedchains !== undefined) {
82098
82102
  let stru_t = Object.keys(ic.structures)[0];
82099
82103
 
82100
82104
  let chain_t = stru_t + '_' + me.cfg.masterchain;
@@ -82122,7 +82126,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
82122
82126
  ic.chainidArray = [chain_t].concat(chainidArray);
82123
82127
  ic.chainidArray = ic.chainalignParserCls.addPostfixForChainids(ic.chainidArray);
82124
82128
 
82125
- me.htmlCls.clickMenuCls.setLogCmd('resdef ' + me.cfg.resdef, true);
82129
+ // me.htmlCls.clickMenuCls.setLogCmd('resdef ' + me.cfg.resdef, true);
82126
82130
 
82127
82131
  ic.loadCmd = 'vast_search_chainid ' + ic.chainidArray;
82128
82132
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
@@ -82348,7 +82352,8 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
82348
82352
  ic.bChainAlign = true;
82349
82353
  ic.inputid = me.cfg.chainalign;
82350
82354
  let resrangeStr = (me.cfg.resrange) ? ' | resrange ' + me.cfg.resrange : '';
82351
- ic.loadCmd = 'load chainalignment ' + me.cfg.chainalign + ' | resnum ' + me.cfg.resnum + ' | resdef ' + me.cfg.resdef + ' | aligntool ' + me.cfg.aligntool + ' | parameters ' + me.cfg.inpara + resrangeStr;
82355
+ let resdef = (me.cfg.resdef) ? me.cfg.resdef : '';
82356
+ ic.loadCmd = 'load chainalignment ' + me.cfg.chainalign + ' | resnum ' + me.cfg.resnum + ' | resdef ' + resdef + ' | aligntool ' + me.cfg.aligntool + ' | parameters ' + me.cfg.inpara + resrangeStr;
82352
82357
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
82353
82358
  await ic.chainalignParserCls.downloadChainalignment(me.cfg.chainalign);
82354
82359
  }