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.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();
@@ -58713,6 +58735,19 @@ class SdfParser {
58713
58735
  }
58714
58736
  }
58715
58737
 
58738
+ async downloadSmiles(smiles) { let ic = this.icn3d, me = ic.icn3dui;
58739
+ let urlSmiles = me.htmlCls.baseUrl + "openbabel/openbabel.cgi?smiles2pdb=" + smiles;
58740
+ let pdbStr = await me.getAjaxPromise(urlSmiles, 'text');
58741
+
58742
+ ic.init();
58743
+
58744
+ ic.bInputfile = true;
58745
+ ic.InputfileType = 'pdb';
58746
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + pdbStr : pdbStr;
58747
+
58748
+ await ic.pdbParserCls.loadPdbData(pdbStr);
58749
+ }
58750
+
58716
58751
  async loadSdfData(data) { let ic = this.icn3d, me = ic.icn3dui;
58717
58752
  let bResult = this.loadSdfAtomData(data);
58718
58753
 
@@ -69997,6 +70032,10 @@ class LoadScript {
69997
70032
  me.cfg.cid = id;
69998
70033
  await ic.sdfParserCls.downloadCid(id);
69999
70034
  }
70035
+ else if(command.indexOf('load smiles') !== -1) {
70036
+ me.cfg.smiles = id;
70037
+ await ic.sdfParserCls.downloadSmiles(id);
70038
+ }
70000
70039
  else if(command.indexOf('load alignment') !== -1) {
70001
70040
  me.cfg.align = id;
70002
70041
 
@@ -83333,7 +83372,7 @@ class iCn3DUI {
83333
83372
  //even when multiple iCn3D viewers are shown together.
83334
83373
  this.pre = this.cfg.divid + "_";
83335
83374
 
83336
- this.REVISION = '3.37.0';
83375
+ this.REVISION = '3.38.0';
83337
83376
 
83338
83377
  // In nodejs, iCn3D defines "window = {navigator: {}}"
83339
83378
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -83745,6 +83784,12 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
83745
83784
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
83746
83785
  await ic.sdfParserCls.downloadCid(me.cfg.cid);
83747
83786
  }
83787
+ else if(me.cfg.smiles !== undefined) {
83788
+ ic.inputid = me.cfg.smiles;
83789
+ ic.loadCmd = 'load smiles ' + me.cfg.smiles;
83790
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
83791
+ await ic.sdfParserCls.downloadSmiles(me.cfg.smiles);
83792
+ }
83748
83793
  else if(me.cfg.mmcifid !== undefined) {
83749
83794
  ic.inputid = me.cfg.mmcifid;
83750
83795
  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.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {