icn3d 3.39.0 → 3.40.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
@@ -12792,6 +12792,10 @@ class SetMenu {
12792
12792
 
12793
12793
  html += "<ul class='icn3d-mn-item'>";
12794
12794
 
12795
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
12796
+ html += this.getLink('mn2_2ddepiction', '2D Depiction ' + me.htmlCls.wifiStr, 1, 1);
12797
+ }
12798
+
12795
12799
  if(me.cfg.cid === undefined) {
12796
12800
  html += this.getLink('mn6_selectannotations', 'Seq. & Annotations ' + me.htmlCls.wifiStr, 1, 1);
12797
12801
 
@@ -14616,24 +14620,30 @@ class SetDialog {
14616
14620
  html += "</div>";
14617
14621
 
14618
14622
 
14619
- html += me.htmlCls.divStr + "dl_ligplot' sty2D Interaction for One Ligand/Residule='background-color:white' class='" + dialogClass + "'>";
14620
- html += this.addNotebookTitle('dl_ligplot', 'e with Atom Details');
14623
+ html += me.htmlCls.divStr + "dl_ligplot' style='background-color:white' class='" + dialogClass + "'>";
14624
+
14625
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
14626
+ html += this.addNotebookTitle('dl_ligplot', '2D Depiction for Chemicals');
14627
+ }
14628
+ else {
14629
+ html += this.addNotebookTitle('dl_ligplot', '2D Interaction for One Ligand/Residue with Atom Details');
14621
14630
 
14622
- html += me.htmlCls.divNowrapStr + "<b>Note</b>: Nodes/Residues can be dragged. Both nodes and dashed lines/interactions can be clicked to select residues. " + me.htmlCls.space3;
14631
+ html += me.htmlCls.divNowrapStr + "<b>Note</b>: Nodes/Residues can be dragged. Both nodes and dashed lines/interactions can be clicked to select residues. " + me.htmlCls.space3;
14623
14632
 
14624
- html += '<div style="width:20px; margin-top:6px; display:inline-block;"><span id="'
14625
- + me.pre + 'dl_ligplotcolor_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="display:none; width:15px;" title="Expand"></span><span id="'
14626
- + me.pre + 'dl_ligplotcolor_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div></div>';
14633
+ html += '<div style="width:20px; margin-top:6px; display:inline-block;"><span id="'
14634
+ + me.pre + 'dl_ligplotcolor_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="display:none; width:15px;" title="Expand"></span><span id="'
14635
+ + me.pre + 'dl_ligplotcolor_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div></div>';
14627
14636
 
14628
- html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
14637
+ html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
14629
14638
 
14630
- // html += "The real interaction distances are not in scale, and are about twice the distances of dashed line segments.<br>Some \"Contact\" lines are only shown partially to simplify the view.<br>";
14631
- // html += "Mouseover the dashed lines to see interaction types and distances.<br>";
14632
- html += "<b>Color legend</b> for interactions (dashed lines): <br>";
14639
+ // html += "The real interaction distances are not in scale, and are about twice the distances of dashed line segments.<br>Some \"Contact\" lines are only shown partially to simplify the view.<br>";
14640
+ // html += "Mouseover the dashed lines to see interaction types and distances.<br>";
14641
+ html += "<b>Color legend</b> for interactions (dashed lines): <br>";
14633
14642
 
14634
- html += me.htmlCls.setHtmlCls.setColorHints();
14643
+ html += me.htmlCls.setHtmlCls.setColorHints();
14635
14644
 
14636
- html += "<br></div>";
14645
+ html += "<br></div>";
14646
+ }
14637
14647
 
14638
14648
  me.ligplotid = me.pre + 'ligplot';
14639
14649
  html += me.htmlCls.divNowrapStr + buttonStrTmp + me.ligplotid + '_svg">SVG</button>' + me.htmlCls.space2;
@@ -16019,6 +16029,11 @@ class Events {
16019
16029
  thisClass.setLogCmd("view interactions", true);
16020
16030
  });
16021
16031
 
16032
+ me.myEventCls.onIds("#" + me.pre + "mn2_2ddepiction", "click", async function(e) { let ic = me.icn3d;
16033
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
16034
+ thisClass.setLogCmd("view 2d depiction", true);
16035
+ });
16036
+
16022
16037
  me.myEventCls.onIds("#" + me.pre + "search_seq_button", "click", async function(e) { me.icn3d;
16023
16038
  e.stopImmediatePropagation();
16024
16039
  await thisClass.searchSeq();
@@ -27222,6 +27237,8 @@ class Camera {
27222
27237
  }
27223
27238
  }
27224
27239
 
27240
+ // ic.cam.add(ic.directionalLight);
27241
+
27225
27242
  ic.cam.updateProjectionMatrix();
27226
27243
  // }
27227
27244
  }
@@ -37157,6 +37174,11 @@ class Alternate {
37157
37174
  ic.directionalLight.position.copy(ic.lightPos.clone().applyQuaternion( quaternion ).normalize());
37158
37175
  ic.directionalLight2.position.copy(ic.lightPos2.clone().applyQuaternion( quaternion ).normalize());
37159
37176
  ic.directionalLight3.position.copy(ic.lightPos3.clone().applyQuaternion( quaternion ).normalize());
37177
+
37178
+ // adjust the light according to the position of camera
37179
+ ic.directionalLight.applyMatrix4(cam.matrixWorld);
37180
+ ic.directionalLight2.applyMatrix4(cam.matrixWorld);
37181
+ ic.directionalLight3.applyMatrix4(cam.matrixWorld);
37160
37182
  }
37161
37183
 
37162
37184
  if(!ic.bVr) ic.renderer.setPixelRatio( window.devicePixelRatio ); // r71
@@ -52051,7 +52073,10 @@ class ViewInterPairs {
52051
52073
  cntHbond += result.cnt;
52052
52074
  svgHtmlNode += result.svgHtmlNode;
52053
52075
  svgHtmlLine += result.svgHtmlLine;
52054
- if(result.cnt > 0) residname2List += residname2 + ":hbond_" + result.cnt + " ";
52076
+ // if(result.cnt > 0) residname2List += residname2 + ":hbond_" + result.cnt + " ";
52077
+ // add hydrogen bond between main or side chains. result.mainside has value such as main,side,side,side
52078
+ // for two hydrogens between main and side, and side and side chains
52079
+ if(result.cnt > 0) residname2List += residname2 + ":hbond_" + result.cnt + ":type_" + result.mainside + " ";
52055
52080
 
52056
52081
  labels2dist = ic.resids2inter[resids]['ionic'];
52057
52082
  result = this.getInteractionPairDetails(labels2dist, type, 'ionic', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52059,7 +52084,7 @@ class ViewInterPairs {
52059
52084
  cntIonic += result.cnt;
52060
52085
  svgHtmlNode += result.svgHtmlNode;
52061
52086
  svgHtmlLine += result.svgHtmlLine;
52062
- if(result.cnt > 0) residname2List += residname2 + ":ionic_" + result.cnt + " ";
52087
+ if(result.cnt > 0) residname2List += residname2 + ":ionic_" + result.cnt + ":type_" + result.mainside + " ";
52063
52088
 
52064
52089
  labels2dist = ic.resids2inter[resids]['halogen'];
52065
52090
  result = this.getInteractionPairDetails(labels2dist, type, 'halogen', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52067,7 +52092,7 @@ class ViewInterPairs {
52067
52092
  cntHalegen += result.cnt;
52068
52093
  svgHtmlNode += result.svgHtmlNode;
52069
52094
  svgHtmlLine += result.svgHtmlLine;
52070
- if(result.cnt > 0) residname2List += residname2 + ":halogen_" + result.cnt + " ";
52095
+ if(result.cnt > 0) residname2List += residname2 + ":halogen_" + result.cnt + ":type_" + result.mainside + " ";
52071
52096
 
52072
52097
  labels2dist = ic.resids2inter[resids]['pi-cation'];
52073
52098
  result = this.getInteractionPairDetails(labels2dist, type, 'pi-cation', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52075,7 +52100,7 @@ class ViewInterPairs {
52075
52100
  cntPication += result.cnt;
52076
52101
  svgHtmlNode += result.svgHtmlNode;
52077
52102
  svgHtmlLine += result.svgHtmlLine;
52078
- if(result.cnt > 0) residname2List += residname2 + ":pi-cation_" + result.cnt + " ";
52103
+ if(result.cnt > 0) residname2List += residname2 + ":pi-cation_" + result.cnt + ":type_" + result.mainside + " ";
52079
52104
 
52080
52105
  labels2dist = ic.resids2inter[resids]['pi-stacking'];
52081
52106
  result = this.getInteractionPairDetails(labels2dist, type, 'pi-stacking', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52083,7 +52108,7 @@ class ViewInterPairs {
52083
52108
  cntPistacking += result.cnt;
52084
52109
  svgHtmlNode += result.svgHtmlNode;
52085
52110
  svgHtmlLine += result.svgHtmlLine;
52086
- if(result.cnt > 0) residname2List += residname2 + ":pi-stacking_" + result.cnt + " ";
52111
+ if(result.cnt > 0) residname2List += residname2 + ":pi-stacking_" + result.cnt + ":type_" + result.mainside + " ";
52087
52112
 
52088
52113
  // put contact as the last one since contact will use the same node as other interactions in ligand-protein interactoin
52089
52114
  labels2dist = ic.resids2inter[resids]['contact'];
@@ -52137,7 +52162,7 @@ class ViewInterPairs {
52137
52162
  return tmpText;
52138
52163
  }
52139
52164
  getInteractionPairDetails(labels2dist, type, interactionType, index2xy, xlen, ylen, xcenter, ycenter) { let ic = this.icn3d; ic.icn3dui;
52140
- let svgHtmlNode = '', svgHtmlLine = '', tmpText = '', cnt = 0;
52165
+ let svgHtmlNode = '', svgHtmlLine = '', tmpText = '', cnt = 0, mainside= '';
52141
52166
  let colorText1 = ' <span style="background-color:#';
52142
52167
  let colorText2 = '">&nbsp;&nbsp;&nbsp;</span>';
52143
52168
  if(labels2dist !== undefined) {
@@ -52154,6 +52179,12 @@ class ViewInterPairs {
52154
52179
  let resid1 = resid1Ori.substr(0, pos1);
52155
52180
  let resid2 = resid2Ori.substr(0, pos2);
52156
52181
 
52182
+ let atomName1 = resid1.substr(resid1.indexOf('@') + 1);
52183
+ resid2.substr(resid2.indexOf('@') + 1);
52184
+ let atomType1 = (atomName1 === "N" || atomName1 === "C" || atomName1 === "O" || atomName1 === "CA") ? 'main' : 'side';
52185
+ if(mainside) mainside += ';';
52186
+ mainside += atomType1 + ',' + atomType1;
52187
+
52157
52188
  let resid1Real = ic.getGraphCls.convertLabel2Resid(resid1);
52158
52189
  let atom1 = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid1Real]);
52159
52190
  let color1 = (atom1.color) ? atom1.color.getHexString() : '';
@@ -52175,7 +52206,7 @@ class ViewInterPairs {
52175
52206
  }
52176
52207
  }
52177
52208
  }
52178
- return {html: tmpText, cnt: cnt, svgHtmlNode: svgHtmlNode, svgHtmlLine: svgHtmlLine}
52209
+ return {html: tmpText, cnt: cnt, svgHtmlNode: svgHtmlNode, svgHtmlLine: svgHtmlLine, mainside: mainside}
52179
52210
  }
52180
52211
 
52181
52212
  getContactPairDetails(labels2dist, type, interactionType, index2xy, xlen, ylen, xcenter, ycenter) { let ic = this.icn3d; ic.icn3dui;
@@ -63581,6 +63612,9 @@ class LoadPDB {
63581
63612
 
63582
63613
  ///id = line.substr(62, 4).trim();
63583
63614
  id = line.substr(62).trim();
63615
+ // remove "_" in the id
63616
+ id = id.replace(/_/g, '-');
63617
+
63584
63618
  oriId = id;
63585
63619
 
63586
63620
  if(id == '') {
@@ -64491,6 +64525,8 @@ class LoadCIF {
64491
64525
 
64492
64526
  if(block.getCategory("_entry")) {
64493
64527
  id = block.getCategory("_entry").getColumn("id").getString(0);
64528
+ // remove "_" in the id
64529
+ id = id.replace(/_/g, '-');
64494
64530
 
64495
64531
  if(id == '') {
64496
64532
  if(bAppend) {
@@ -69086,7 +69122,9 @@ class LoadScript {
69086
69122
  }
69087
69123
  else if(command.indexOf('view interactions') == 0 && me.cfg.align !== undefined) { // the command may have "|||{"factor"...
69088
69124
  await thisClass.applyCommandViewinteraction(strArray[0].trim());
69089
-
69125
+ }
69126
+ else if(command.indexOf('view 2d depiction') == 0) { // the command may have "|||{"factor"...
69127
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
69090
69128
  }
69091
69129
  else if(command.indexOf('symmetry') == 0) {
69092
69130
  ic.bAxisOnly = false;
@@ -69296,6 +69334,9 @@ class LoadScript {
69296
69334
  else if(lastCommand.indexOf('view interactions') == 0 && me.cfg.align !== undefined) {
69297
69335
  await thisClass.applyCommandViewinteraction(lastCommand);
69298
69336
  }
69337
+ else if(lastCommand.indexOf('view 2d depiction') == 0) {
69338
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
69339
+ }
69299
69340
  else if(lastCommand.indexOf('symmetry') == 0) {
69300
69341
  let title = lastCommand.substr(lastCommand.indexOf(' ') + 1);
69301
69342
  ic.symmetrytitle =(title === 'none') ? undefined : title;
@@ -72213,7 +72254,6 @@ class Dssp {
72213
72254
  if(ssHash !== undefined && JSON.stringify(ssHash).indexOf('Oops there was a problem') === -1) {
72214
72255
  for(let chainNum in ic.chainsSeq) {
72215
72256
  let pos = chainNum.indexOf('_');
72216
-
72217
72257
  // one structure at a time
72218
72258
  if(chainNum.substr(0, pos) != struArray[index]) continue;
72219
72259
 
@@ -77680,8 +77720,13 @@ class Ligplot {
77680
77720
  this.icn3d = icn3d;
77681
77721
  }
77682
77722
 
77683
- async drawLigplot(atomSet1) { let ic = this.icn3d, me = ic.icn3dui;
77684
- me.htmlCls.dialogCls.openDlg('dl_ligplot', 'Show ligand interactions with atom details');
77723
+ async drawLigplot(atomSet1, bDepiction) { let ic = this.icn3d, me = ic.icn3dui;
77724
+ if(bDepiction) {
77725
+ me.htmlCls.dialogCls.openDlg('dl_ligplot', '2D Depiction');
77726
+ }
77727
+ else {
77728
+ me.htmlCls.dialogCls.openDlg('dl_ligplot', 'Show ligand interactions with atom details');
77729
+ }
77685
77730
 
77686
77731
  let widthOri, heightOri, width = 100, height = 100;
77687
77732
  ic.len4ang = 80;
@@ -77763,19 +77808,28 @@ class Ligplot {
77763
77808
  let offset = - ic.len4ang;
77764
77809
  let svgHtml = "<svg id='" + id + "' viewBox='" + offset + "," + offset + "," + width + "," + heightAll + "' width='" + graphWidth + "px' font-family='sans-serif' stroke='rgb(0,0,0)' stroke-width='2' stroke-linecap='round'>";
77765
77810
 
77766
- let xlen = parseInt(widthOri / ic.svgGridSize), ylen = parseInt(heightOri / ic.svgGridSize);
77767
- let result = ic.viewInterPairsCls.getAllInteractionTable("save1", index2xy, xlen, ylen, xcenter, ycenter); // sort on the ligand/set1
77768
- ic.bLigplot = true;
77811
+ if(bDepiction) {
77812
+ svgHtml += lineSvg + nodeSvg;
77813
+ }
77814
+ else {
77815
+ let xlen = parseInt(widthOri / ic.svgGridSize), ylen = parseInt(heightOri / ic.svgGridSize);
77816
+ let result = ic.viewInterPairsCls.getAllInteractionTable("save1", index2xy, xlen, ylen, xcenter, ycenter); // sort on the ligand/set1
77817
+ // ic.bLigplot = true;
77769
77818
 
77770
- svgHtml += lineSvg + result.svgHtmlLine;
77819
+ svgHtml += lineSvg + result.svgHtmlLine;
77771
77820
 
77772
- svgHtml += nodeSvg + result.svgHtmlNode;
77821
+ svgHtml += nodeSvg + result.svgHtmlNode;
77822
+ }
77773
77823
 
77774
77824
  svgHtml += "</svg>";
77775
77825
 
77776
- $("#" + ic.pre + "ligplotDiv").html(svgHtml);
77777
-
77778
- this.setEventsForLigplot();
77826
+ if(bDepiction) {
77827
+ $("#" + ic.pre + "ligplotDiv").html(svgHtml);
77828
+ }
77829
+ else {
77830
+ $("#" + ic.pre + "ligplotDiv").html(svgHtml);
77831
+ this.setEventsForLigplot();
77832
+ }
77779
77833
  }
77780
77834
 
77781
77835
 
@@ -79425,6 +79479,11 @@ class SaveFile {
79425
79479
 
79426
79480
  $("#" + ic.pre + "title").html("PubChem CID <a id='" + ic.pre + "titlelink' href='" + url + "' style='color:" + titlelinkColor + "' target='_blank'>" + ic.inputid.toUpperCase() + "</a>: " + title);
79427
79481
  }
79482
+ else if(me.cfg.smiles !== undefined) {
79483
+ let text = decodeURIComponent(me.cfg.smiles);
79484
+ if(text.length > 60) text = text.substr(0, 60) + "...";
79485
+ $("#" + ic.pre + "title").html("SMILES: " + text);
79486
+ }
79428
79487
  else if(me.cfg.align !== undefined) {
79429
79488
  title = 'VAST+ alignment of ' + Object.keys(ic.structures);
79430
79489
 
@@ -82844,7 +82903,7 @@ class iCn3DUI {
82844
82903
  //even when multiple iCn3D viewers are shown together.
82845
82904
  this.pre = this.cfg.divid + "_";
82846
82905
 
82847
- this.REVISION = '3.39.0';
82906
+ this.REVISION = '3.40.0';
82848
82907
 
82849
82908
  // In nodejs, iCn3D defines "window = {navigator: {}}"
82850
82909
  this.bNode = (Object.keys(window).length < 2) ? true : false;