icn3d 3.37.1 → 3.38.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
@@ -9069,6 +9069,10 @@ class ClickMenu {
9069
9069
  me.htmlCls.dialogCls.openDlg('dl_cid', 'Please input PubChem Compound');
9070
9070
  });
9071
9071
 
9072
+ me.myEventCls.onIds("#" + me.pre + "mn1_smiles", "click", function(e) { me.icn3d; //e.preventDefault();
9073
+ me.htmlCls.dialogCls.openDlg('dl_smiles', 'Please input a chemical SMILES');
9074
+ });
9075
+
9072
9076
  me.myEventCls.onIds("#" + me.pre + "mn1_pngimage", "click", function(e) { me.icn3d; //e.preventDefault();
9073
9077
  me.htmlCls.dialogCls.openDlg('dl_pngimage', 'Please append PNG images');
9074
9078
  });
@@ -11746,6 +11750,7 @@ class SetMenu {
11746
11750
  //html += this.getLink('mn1_gi', 'NCBI gi ' + me.htmlCls.wifiStr, undefined, 2);
11747
11751
 
11748
11752
  html += this.getLink('mn1_cid', 'PubChem CID/Name/InchI ' + me.htmlCls.wifiStr, 1, 2);
11753
+ html += this.getLink('mn1_smiles', 'Chemical SMILES ', undefined, 2);
11749
11754
 
11750
11755
  html += "</ul>";
11751
11756
  html += "</li>";
@@ -14017,7 +14022,7 @@ class SetDialog {
14017
14022
  html += '<div style="width:550px;">You can define your own reference numbers in a custom file using Excel, and then export it as a CSV file. An example file is shown below with cells separated by commas.<br>';
14018
14023
  html += '<pre>refnum,11,12,,21,22,,10C,11C,20C<br>';
14019
14024
  html += '1TUP_A,100,101,,,132,,,,<br>';
14020
- html += '1TUP_B,110,111,,141,142,,,,</pre>';
14025
+ html += '1TUP_B,110,111,,141,142,,,,<br>';
14021
14026
  html += '1TUP_C,,,,,,,200,201,230</pre>';
14022
14027
  html += 'The first row defines the reference residue numbers, which could be any strings. The 1st cell could be anything. The rest cells are reference residue numbers (e.g., 11, 21, 10C, etc.) or empty cells. Each chain has a separate row. The first cell of the second row is the chain ID "1TUP_A". The rest cells are the corresponding real residue numbers for reference residue numbers in the first row. For example, the reference numbers for residues 100, 101, and 132 in the chain 1TUP_A are 11, 12, and 22, respectively. The fourth row shows another set of reference numners for the chain "1TUP_C". It could be a chain from a different structure.<br><br>';
14023
14028
  html += 'To select all residues corresponding to the reference numbers, you can simplay replace ":" with "%" in the <a href="https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#selectb" target="_blank">Specification</a>. For example, "%12" selects the residue 101 in 1TUP_A and the residue 111 in 1TUP_B. ".A%12" has the chain "A" filter and selects the residue 101 in 1TUP_A.<br>';
@@ -14211,6 +14216,12 @@ class SetDialog {
14211
14216
  html += me.htmlCls.buttonStr + "reload_cid'>Load</button>";
14212
14217
  html += "</div>";
14213
14218
 
14219
+ html += me.htmlCls.divStr + "dl_smiles' class='" + dialogClass + "'>";
14220
+ html += this.addNotebookTitle('dl_cid', 'Please input a chemical SMILES');
14221
+ html += "Chemical SMILES: " + me.htmlCls.inputTextStr + "id='" + me.pre + "smiles' value='CC(=O)OC1=CC=CC=C1C(=O)O' size=30> ";
14222
+ html += me.htmlCls.buttonStr + "reload_smiles'>Load</button>";
14223
+ html += "</div>";
14224
+
14214
14225
  html += me.htmlCls.divStr + "dl_pngimage' class='" + dialogClass + "'>";
14215
14226
  html += this.addNotebookTitle('dl_pngimage', 'Please append iCn3D PNG Image files');
14216
14227
  html += "Multiple iCn3D PNG images: " + me.htmlCls.inputFileStr + " multiple id='" + me.pre + "pngimage' size=8><br/>";
@@ -16654,8 +16665,7 @@ class Events {
16654
16665
  });
16655
16666
 
16656
16667
 
16657
- me.myEventCls.onIds("#" + me.pre
16658
- + "reload_cid", "click", function(e) { let ic = me.icn3d;
16668
+ me.myEventCls.onIds("#" + me.pre + "reload_cid", "click", function(e) { let ic = me.icn3d;
16659
16669
  e.preventDefault();
16660
16670
  if(!me.cfg.notebook) dialog.dialog( "close" );
16661
16671
  thisClass.setLogCmd("load cid " + $("#" + me.pre + "cid").val(), false);
@@ -16663,6 +16673,18 @@ class Events {
16663
16673
  window.open(hostUrl + '?cid=' + $("#" + me.pre + "cid").val(), urlTarget);
16664
16674
  });
16665
16675
 
16676
+ me.myEventCls.onIds("#" + me.pre + "reload_smiles", "click", function(e) { let ic = me.icn3d;
16677
+ e.preventDefault();
16678
+ if(!me.cfg.notebook) dialog.dialog( "close" );
16679
+ // thisClass.setLogCmd("load smiles " + $("#" + me.pre + "smiles").val(), false);
16680
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
16681
+
16682
+ urlTarget = '_blank';
16683
+
16684
+ console.log("smiles: " + $("#" + me.pre + "smiles").val() + " encode: " + encodeURIComponent($("#" + me.pre + "smiles").val()));
16685
+ window.open(hostUrl + '?smiles=' + encodeURIComponent($("#" + me.pre + "smiles").val()), urlTarget);
16686
+ });
16687
+
16666
16688
  me.myEventCls.onIds("#" + me.pre + "cid", "keyup", function(e) { let ic = me.icn3d;
16667
16689
  if (e.keyCode === 13) {
16668
16690
  e.preventDefault();
@@ -49711,7 +49733,7 @@ class LineGraph {
49711
49733
  }
49712
49734
  else {
49713
49735
  ++linkedNodeCnt[mappingid];
49714
- linkedNodeInterDiff[mappingid] += link.n;
49736
+ linkedNodeInterDiff[mappingid] += link.n;
49715
49737
 
49716
49738
  linkedNodeInterDiffBool[mappingid] = (linkedNodeInterDiff[mappingid] / link.n == linkedNodeCnt[mappingid]) ? 0 : 1;
49717
49739
  }
@@ -49765,7 +49787,7 @@ class LineGraph {
49765
49787
  let linkDiff = me.hashUtilsCls.cloneHash(link);
49766
49788
  linkDiff.source += separatorDiff + ic.chainsMapping[chainid1][resid1];
49767
49789
  linkDiff.target += separatorDiff + ic.chainsMapping[chainid2][resid2];
49768
-
49790
+
49769
49791
  if(linkedNodeCnt[mappingid] == structureArray.length && (bIgRef || linkedNodeInterDiffBool[mappingid] == 0)) {
49770
49792
  linkArraySplitCommon[index].push(linkCommon);
49771
49793
  }
@@ -50458,6 +50480,7 @@ class GetGraph {
50458
50480
  nodeArray2.push(node);
50459
50481
  }
50460
50482
  }
50483
+
50461
50484
  // sort array
50462
50485
  nodeArray1.sort(function(a,b) {
50463
50486
  return thisClass.compNode(a, b);
@@ -50465,6 +50488,7 @@ class GetGraph {
50465
50488
  nodeArray2.sort(function(a,b) {
50466
50489
  return thisClass.compNode(a, b, bReverseNode);
50467
50490
  });
50491
+
50468
50492
  return {"nodeArray1": nodeArray1, "nodeArray2": nodeArray2, "name2node": name2nodeCommon};
50469
50493
  }
50470
50494
  updateGraphJson(struc, index, nodeArray1, nodeArray2, linkArray) { let ic = this.icn3d, me = ic.icn3dui;
@@ -50769,7 +50793,9 @@ class GetGraph {
50769
50793
  }
50770
50794
 
50771
50795
  for(let linkStr in linkstr2cnt) {
50772
- hbondStr += ', {' + linkStr + ', "n": ' + linkstr2cnt[linkStr] + '}';
50796
+ // do not differentiate the number of contacts
50797
+ let n = (value == me.htmlCls.contactInsideValue || value == me.htmlCls.contactValue) ? 1 : linkstr2cnt[linkStr];
50798
+ hbondStr += ', {' + linkStr + ', "n": ' + n + '}';
50773
50799
  }
50774
50800
 
50775
50801
  return hbondStr;
@@ -57808,6 +57834,19 @@ class SdfParser {
57808
57834
  }
57809
57835
  }
57810
57836
 
57837
+ async downloadSmiles(smiles) { let ic = this.icn3d, me = ic.icn3dui;
57838
+ let urlSmiles = me.htmlCls.baseUrl + "openbabel/openbabel.cgi?smiles2pdb=" + smiles;
57839
+ let pdbStr = await me.getAjaxPromise(urlSmiles, 'text');
57840
+
57841
+ ic.init();
57842
+
57843
+ ic.bInputfile = true;
57844
+ ic.InputfileType = 'pdb';
57845
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + pdbStr : pdbStr;
57846
+
57847
+ await ic.pdbParserCls.loadPdbData(pdbStr);
57848
+ }
57849
+
57811
57850
  async loadSdfData(data) { let ic = this.icn3d, me = ic.icn3dui;
57812
57851
  let bResult = this.loadSdfAtomData(data);
57813
57852
 
@@ -69092,6 +69131,10 @@ class LoadScript {
69092
69131
  me.cfg.cid = id;
69093
69132
  await ic.sdfParserCls.downloadCid(id);
69094
69133
  }
69134
+ else if(command.indexOf('load smiles') !== -1) {
69135
+ me.cfg.smiles = id;
69136
+ await ic.sdfParserCls.downloadSmiles(id);
69137
+ }
69095
69138
  else if(command.indexOf('load alignment') !== -1) {
69096
69139
  me.cfg.align = id;
69097
69140
 
@@ -82428,7 +82471,7 @@ class iCn3DUI {
82428
82471
  //even when multiple iCn3D viewers are shown together.
82429
82472
  this.pre = this.cfg.divid + "_";
82430
82473
 
82431
- this.REVISION = '3.37.0';
82474
+ this.REVISION = '3.38.0';
82432
82475
 
82433
82476
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82434
82477
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -82840,6 +82883,12 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
82840
82883
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
82841
82884
  await ic.sdfParserCls.downloadCid(me.cfg.cid);
82842
82885
  }
82886
+ else if(me.cfg.smiles !== undefined) {
82887
+ ic.inputid = me.cfg.smiles;
82888
+ ic.loadCmd = 'load smiles ' + me.cfg.smiles;
82889
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
82890
+ await ic.sdfParserCls.downloadSmiles(me.cfg.smiles);
82891
+ }
82843
82892
  else if(me.cfg.mmcifid !== undefined) {
82844
82893
  ic.inputid = me.cfg.mmcifid;
82845
82894
  ic.loadCmd = 'load mmcif ' + me.cfg.mmcifid;