icn3d 3.37.2 → 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>";
@@ -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();
@@ -57812,6 +57834,19 @@ class SdfParser {
57812
57834
  }
57813
57835
  }
57814
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
+
57815
57850
  async loadSdfData(data) { let ic = this.icn3d, me = ic.icn3dui;
57816
57851
  let bResult = this.loadSdfAtomData(data);
57817
57852
 
@@ -69096,6 +69131,10 @@ class LoadScript {
69096
69131
  me.cfg.cid = id;
69097
69132
  await ic.sdfParserCls.downloadCid(id);
69098
69133
  }
69134
+ else if(command.indexOf('load smiles') !== -1) {
69135
+ me.cfg.smiles = id;
69136
+ await ic.sdfParserCls.downloadSmiles(id);
69137
+ }
69099
69138
  else if(command.indexOf('load alignment') !== -1) {
69100
69139
  me.cfg.align = id;
69101
69140
 
@@ -82432,7 +82471,7 @@ class iCn3DUI {
82432
82471
  //even when multiple iCn3D viewers are shown together.
82433
82472
  this.pre = this.cfg.divid + "_";
82434
82473
 
82435
- this.REVISION = '3.37.0';
82474
+ this.REVISION = '3.38.0';
82436
82475
 
82437
82476
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82438
82477
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -82844,6 +82883,12 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
82844
82883
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
82845
82884
  await ic.sdfParserCls.downloadCid(me.cfg.cid);
82846
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
+ }
82847
82892
  else if(me.cfg.mmcifid !== undefined) {
82848
82893
  ic.inputid = me.cfg.mmcifid;
82849
82894
  ic.loadCmd = 'load mmcif ' + me.cfg.mmcifid;