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.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>";
@@ -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();
@@ -36925,6 +36947,10 @@ class Contact {
36925
36947
  for(let i in atomlistTarget) {
36926
36948
  //var oriAtom = atomlistTarget[i];
36927
36949
  let oriAtom = ic.atoms[i];
36950
+
36951
+ // skip hydrogen atoms
36952
+ if(bInteraction && oriAtom.elem == 'H') continue;
36953
+
36928
36954
  let r1 = me.parasCls.vdwRadii[oriAtom.elem.toUpperCase()];
36929
36955
  let chainid1 = oriAtom.structure + '_' + oriAtom.chain;
36930
36956
 
@@ -36951,6 +36977,10 @@ class Contact {
36951
36977
 
36952
36978
  for (let j in neighbors) {
36953
36979
  let atom = neighbors[j];
36980
+
36981
+ // skip hydrogen atoms
36982
+ if(bInteraction && atom.elem == 'H') continue;
36983
+
36954
36984
  let r2 = me.parasCls.vdwRadii[atom.elem.toUpperCase()];
36955
36985
  let chainid2 = atom.structure + '_' + atom.chain;
36956
36986
 
@@ -57812,6 +57842,19 @@ class SdfParser {
57812
57842
  }
57813
57843
  }
57814
57844
 
57845
+ async downloadSmiles(smiles) { let ic = this.icn3d, me = ic.icn3dui;
57846
+ let urlSmiles = me.htmlCls.baseUrl + "openbabel/openbabel.cgi?smiles2pdb=" + smiles;
57847
+ let pdbStr = await me.getAjaxPromise(urlSmiles, 'text');
57848
+
57849
+ ic.init();
57850
+
57851
+ ic.bInputfile = true;
57852
+ ic.InputfileType = 'pdb';
57853
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + pdbStr : pdbStr;
57854
+
57855
+ await ic.pdbParserCls.loadPdbData(pdbStr);
57856
+ }
57857
+
57815
57858
  async loadSdfData(data) { let ic = this.icn3d, me = ic.icn3dui;
57816
57859
  let bResult = this.loadSdfAtomData(data);
57817
57860
 
@@ -69096,6 +69139,10 @@ class LoadScript {
69096
69139
  me.cfg.cid = id;
69097
69140
  await ic.sdfParserCls.downloadCid(id);
69098
69141
  }
69142
+ else if(command.indexOf('load smiles') !== -1) {
69143
+ me.cfg.smiles = id;
69144
+ await ic.sdfParserCls.downloadSmiles(id);
69145
+ }
69099
69146
  else if(command.indexOf('load alignment') !== -1) {
69100
69147
  me.cfg.align = id;
69101
69148
 
@@ -82389,7 +82436,7 @@ iCn3D.prototype.resetConfig = function () { let ic = this, me = ic.icn3dui;
82389
82436
  this.opts['nucleotides'] = 'o3 trace';
82390
82437
  }
82391
82438
 
82392
- if(me.cfg.cid !== undefined) {
82439
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
82393
82440
  this.opts['color'] = 'atom';
82394
82441
 
82395
82442
  this.opts['pk'] = 'atom';
@@ -82432,7 +82479,7 @@ class iCn3DUI {
82432
82479
  //even when multiple iCn3D viewers are shown together.
82433
82480
  this.pre = this.cfg.divid + "_";
82434
82481
 
82435
- this.REVISION = '3.37.0';
82482
+ this.REVISION = '3.38.0';
82436
82483
 
82437
82484
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82438
82485
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -82844,6 +82891,12 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
82844
82891
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
82845
82892
  await ic.sdfParserCls.downloadCid(me.cfg.cid);
82846
82893
  }
82894
+ else if(me.cfg.smiles !== undefined) {
82895
+ ic.inputid = me.cfg.smiles;
82896
+ ic.loadCmd = 'load smiles ' + me.cfg.smiles;
82897
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
82898
+ await ic.sdfParserCls.downloadSmiles(me.cfg.smiles);
82899
+ }
82847
82900
  else if(me.cfg.mmcifid !== undefined) {
82848
82901
  ic.inputid = me.cfg.mmcifid;
82849
82902
  ic.loadCmd = 'load mmcif ' + me.cfg.mmcifid;