icn3d 3.37.2 → 3.38.1

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.module.js CHANGED
@@ -9970,6 +9970,10 @@ class ClickMenu {
9970
9970
  me.htmlCls.dialogCls.openDlg('dl_cid', 'Please input PubChem Compound');
9971
9971
  });
9972
9972
 
9973
+ me.myEventCls.onIds("#" + me.pre + "mn1_smiles", "click", function(e) { me.icn3d; //e.preventDefault();
9974
+ me.htmlCls.dialogCls.openDlg('dl_smiles', 'Please input a chemical SMILES');
9975
+ });
9976
+
9973
9977
  me.myEventCls.onIds("#" + me.pre + "mn1_pngimage", "click", function(e) { me.icn3d; //e.preventDefault();
9974
9978
  me.htmlCls.dialogCls.openDlg('dl_pngimage', 'Please append PNG images');
9975
9979
  });
@@ -12647,6 +12651,7 @@ class SetMenu {
12647
12651
  //html += this.getLink('mn1_gi', 'NCBI gi ' + me.htmlCls.wifiStr, undefined, 2);
12648
12652
 
12649
12653
  html += this.getLink('mn1_cid', 'PubChem CID/Name/InchI ' + me.htmlCls.wifiStr, 1, 2);
12654
+ html += this.getLink('mn1_smiles', 'Chemical SMILES ', undefined, 2);
12650
12655
 
12651
12656
  html += "</ul>";
12652
12657
  html += "</li>";
@@ -15112,6 +15117,12 @@ class SetDialog {
15112
15117
  html += me.htmlCls.buttonStr + "reload_cid'>Load</button>";
15113
15118
  html += "</div>";
15114
15119
 
15120
+ html += me.htmlCls.divStr + "dl_smiles' class='" + dialogClass + "'>";
15121
+ html += this.addNotebookTitle('dl_cid', 'Please input a chemical SMILES');
15122
+ html += "Chemical SMILES: " + me.htmlCls.inputTextStr + "id='" + me.pre + "smiles' value='CC(=O)OC1=CC=CC=C1C(=O)O' size=30> ";
15123
+ html += me.htmlCls.buttonStr + "reload_smiles'>Load</button>";
15124
+ html += "</div>";
15125
+
15115
15126
  html += me.htmlCls.divStr + "dl_pngimage' class='" + dialogClass + "'>";
15116
15127
  html += this.addNotebookTitle('dl_pngimage', 'Please append iCn3D PNG Image files');
15117
15128
  html += "Multiple iCn3D PNG images: " + me.htmlCls.inputFileStr + " multiple id='" + me.pre + "pngimage' size=8><br/>";
@@ -17555,8 +17566,7 @@ class Events {
17555
17566
  });
17556
17567
 
17557
17568
 
17558
- me.myEventCls.onIds("#" + me.pre
17559
- + "reload_cid", "click", function(e) { let ic = me.icn3d;
17569
+ me.myEventCls.onIds("#" + me.pre + "reload_cid", "click", function(e) { let ic = me.icn3d;
17560
17570
  e.preventDefault();
17561
17571
  if(!me.cfg.notebook) dialog.dialog( "close" );
17562
17572
  thisClass.setLogCmd("load cid " + $("#" + me.pre + "cid").val(), false);
@@ -17564,6 +17574,18 @@ class Events {
17564
17574
  window.open(hostUrl + '?cid=' + $("#" + me.pre + "cid").val(), urlTarget);
17565
17575
  });
17566
17576
 
17577
+ me.myEventCls.onIds("#" + me.pre + "reload_smiles", "click", function(e) { let ic = me.icn3d;
17578
+ e.preventDefault();
17579
+ if(!me.cfg.notebook) dialog.dialog( "close" );
17580
+ // thisClass.setLogCmd("load smiles " + $("#" + me.pre + "smiles").val(), false);
17581
+ let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
17582
+
17583
+ urlTarget = '_blank';
17584
+
17585
+ console.log("smiles: " + $("#" + me.pre + "smiles").val() + " encode: " + encodeURIComponent($("#" + me.pre + "smiles").val()));
17586
+ window.open(hostUrl + '?smiles=' + encodeURIComponent($("#" + me.pre + "smiles").val()), urlTarget);
17587
+ });
17588
+
17567
17589
  me.myEventCls.onIds("#" + me.pre + "cid", "keyup", function(e) { let ic = me.icn3d;
17568
17590
  if (e.keyCode === 13) {
17569
17591
  e.preventDefault();
@@ -37826,6 +37848,10 @@ class Contact {
37826
37848
  for(let i in atomlistTarget) {
37827
37849
  //var oriAtom = atomlistTarget[i];
37828
37850
  let oriAtom = ic.atoms[i];
37851
+
37852
+ // skip hydrogen atoms
37853
+ if(bInteraction && oriAtom.elem == 'H') continue;
37854
+
37829
37855
  let r1 = me.parasCls.vdwRadii[oriAtom.elem.toUpperCase()];
37830
37856
  let chainid1 = oriAtom.structure + '_' + oriAtom.chain;
37831
37857
 
@@ -37852,6 +37878,10 @@ class Contact {
37852
37878
 
37853
37879
  for (let j in neighbors) {
37854
37880
  let atom = neighbors[j];
37881
+
37882
+ // skip hydrogen atoms
37883
+ if(bInteraction && atom.elem == 'H') continue;
37884
+
37855
37885
  let r2 = me.parasCls.vdwRadii[atom.elem.toUpperCase()];
37856
37886
  let chainid2 = atom.structure + '_' + atom.chain;
37857
37887
 
@@ -58713,6 +58743,19 @@ class SdfParser {
58713
58743
  }
58714
58744
  }
58715
58745
 
58746
+ async downloadSmiles(smiles) { let ic = this.icn3d, me = ic.icn3dui;
58747
+ let urlSmiles = me.htmlCls.baseUrl + "openbabel/openbabel.cgi?smiles2pdb=" + smiles;
58748
+ let pdbStr = await me.getAjaxPromise(urlSmiles, 'text');
58749
+
58750
+ ic.init();
58751
+
58752
+ ic.bInputfile = true;
58753
+ ic.InputfileType = 'pdb';
58754
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + pdbStr : pdbStr;
58755
+
58756
+ await ic.pdbParserCls.loadPdbData(pdbStr);
58757
+ }
58758
+
58716
58759
  async loadSdfData(data) { let ic = this.icn3d, me = ic.icn3dui;
58717
58760
  let bResult = this.loadSdfAtomData(data);
58718
58761
 
@@ -69997,6 +70040,10 @@ class LoadScript {
69997
70040
  me.cfg.cid = id;
69998
70041
  await ic.sdfParserCls.downloadCid(id);
69999
70042
  }
70043
+ else if(command.indexOf('load smiles') !== -1) {
70044
+ me.cfg.smiles = id;
70045
+ await ic.sdfParserCls.downloadSmiles(id);
70046
+ }
70000
70047
  else if(command.indexOf('load alignment') !== -1) {
70001
70048
  me.cfg.align = id;
70002
70049
 
@@ -83290,7 +83337,7 @@ iCn3D.prototype.resetConfig = function () { let ic = this, me = ic.icn3dui;
83290
83337
  this.opts['nucleotides'] = 'o3 trace';
83291
83338
  }
83292
83339
 
83293
- if(me.cfg.cid !== undefined) {
83340
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
83294
83341
  this.opts['color'] = 'atom';
83295
83342
 
83296
83343
  this.opts['pk'] = 'atom';
@@ -83333,7 +83380,7 @@ class iCn3DUI {
83333
83380
  //even when multiple iCn3D viewers are shown together.
83334
83381
  this.pre = this.cfg.divid + "_";
83335
83382
 
83336
- this.REVISION = '3.37.0';
83383
+ this.REVISION = '3.38.0';
83337
83384
 
83338
83385
  // In nodejs, iCn3D defines "window = {navigator: {}}"
83339
83386
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -83745,6 +83792,12 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
83745
83792
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
83746
83793
  await ic.sdfParserCls.downloadCid(me.cfg.cid);
83747
83794
  }
83795
+ else if(me.cfg.smiles !== undefined) {
83796
+ ic.inputid = me.cfg.smiles;
83797
+ ic.loadCmd = 'load smiles ' + me.cfg.smiles;
83798
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
83799
+ await ic.sdfParserCls.downloadSmiles(me.cfg.smiles);
83800
+ }
83748
83801
  else if(me.cfg.mmcifid !== undefined) {
83749
83802
  ic.inputid = me.cfg.mmcifid;
83750
83803
  ic.loadCmd = 'load mmcif ' + me.cfg.mmcifid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.37.2",
3
+ "version": "3.38.1",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {