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.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>";
@@ -14918,7 +14923,7 @@ class SetDialog {
14918
14923
  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>';
14919
14924
  html += '<pre>refnum,11,12,,21,22,,10C,11C,20C<br>';
14920
14925
  html += '1TUP_A,100,101,,,132,,,,<br>';
14921
- html += '1TUP_B,110,111,,141,142,,,,</pre>';
14926
+ html += '1TUP_B,110,111,,141,142,,,,<br>';
14922
14927
  html += '1TUP_C,,,,,,,200,201,230</pre>';
14923
14928
  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>';
14924
14929
  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>';
@@ -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();
@@ -50612,7 +50634,7 @@ class LineGraph {
50612
50634
  }
50613
50635
  else {
50614
50636
  ++linkedNodeCnt[mappingid];
50615
- linkedNodeInterDiff[mappingid] += link.n;
50637
+ linkedNodeInterDiff[mappingid] += link.n;
50616
50638
 
50617
50639
  linkedNodeInterDiffBool[mappingid] = (linkedNodeInterDiff[mappingid] / link.n == linkedNodeCnt[mappingid]) ? 0 : 1;
50618
50640
  }
@@ -50666,7 +50688,7 @@ class LineGraph {
50666
50688
  let linkDiff = me.hashUtilsCls.cloneHash(link);
50667
50689
  linkDiff.source += separatorDiff + ic.chainsMapping[chainid1][resid1];
50668
50690
  linkDiff.target += separatorDiff + ic.chainsMapping[chainid2][resid2];
50669
-
50691
+
50670
50692
  if(linkedNodeCnt[mappingid] == structureArray.length && (bIgRef || linkedNodeInterDiffBool[mappingid] == 0)) {
50671
50693
  linkArraySplitCommon[index].push(linkCommon);
50672
50694
  }
@@ -51359,6 +51381,7 @@ class GetGraph {
51359
51381
  nodeArray2.push(node);
51360
51382
  }
51361
51383
  }
51384
+
51362
51385
  // sort array
51363
51386
  nodeArray1.sort(function(a,b) {
51364
51387
  return thisClass.compNode(a, b);
@@ -51366,6 +51389,7 @@ class GetGraph {
51366
51389
  nodeArray2.sort(function(a,b) {
51367
51390
  return thisClass.compNode(a, b, bReverseNode);
51368
51391
  });
51392
+
51369
51393
  return {"nodeArray1": nodeArray1, "nodeArray2": nodeArray2, "name2node": name2nodeCommon};
51370
51394
  }
51371
51395
  updateGraphJson(struc, index, nodeArray1, nodeArray2, linkArray) { let ic = this.icn3d, me = ic.icn3dui;
@@ -51670,7 +51694,9 @@ class GetGraph {
51670
51694
  }
51671
51695
 
51672
51696
  for(let linkStr in linkstr2cnt) {
51673
- hbondStr += ', {' + linkStr + ', "n": ' + linkstr2cnt[linkStr] + '}';
51697
+ // do not differentiate the number of contacts
51698
+ let n = (value == me.htmlCls.contactInsideValue || value == me.htmlCls.contactValue) ? 1 : linkstr2cnt[linkStr];
51699
+ hbondStr += ', {' + linkStr + ', "n": ' + n + '}';
51674
51700
  }
51675
51701
 
51676
51702
  return hbondStr;
@@ -58709,6 +58735,19 @@ class SdfParser {
58709
58735
  }
58710
58736
  }
58711
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
+
58712
58751
  async loadSdfData(data) { let ic = this.icn3d, me = ic.icn3dui;
58713
58752
  let bResult = this.loadSdfAtomData(data);
58714
58753
 
@@ -69993,6 +70032,10 @@ class LoadScript {
69993
70032
  me.cfg.cid = id;
69994
70033
  await ic.sdfParserCls.downloadCid(id);
69995
70034
  }
70035
+ else if(command.indexOf('load smiles') !== -1) {
70036
+ me.cfg.smiles = id;
70037
+ await ic.sdfParserCls.downloadSmiles(id);
70038
+ }
69996
70039
  else if(command.indexOf('load alignment') !== -1) {
69997
70040
  me.cfg.align = id;
69998
70041
 
@@ -83329,7 +83372,7 @@ class iCn3DUI {
83329
83372
  //even when multiple iCn3D viewers are shown together.
83330
83373
  this.pre = this.cfg.divid + "_";
83331
83374
 
83332
- this.REVISION = '3.37.0';
83375
+ this.REVISION = '3.38.0';
83333
83376
 
83334
83377
  // In nodejs, iCn3D defines "window = {navigator: {}}"
83335
83378
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -83741,6 +83784,12 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
83741
83784
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
83742
83785
  await ic.sdfParserCls.downloadCid(me.cfg.cid);
83743
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
+ }
83744
83793
  else if(me.cfg.mmcifid !== undefined) {
83745
83794
  ic.inputid = me.cfg.mmcifid;
83746
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.1",
3
+ "version": "3.38.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {