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.module.js CHANGED
@@ -13693,6 +13693,10 @@ class SetMenu {
13693
13693
 
13694
13694
  html += "<ul class='icn3d-mn-item'>";
13695
13695
 
13696
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
13697
+ html += this.getLink('mn2_2ddepiction', '2D Depiction ' + me.htmlCls.wifiStr, 1, 1);
13698
+ }
13699
+
13696
13700
  if(me.cfg.cid === undefined) {
13697
13701
  html += this.getLink('mn6_selectannotations', 'Seq. & Annotations ' + me.htmlCls.wifiStr, 1, 1);
13698
13702
 
@@ -15517,24 +15521,30 @@ class SetDialog {
15517
15521
  html += "</div>";
15518
15522
 
15519
15523
 
15520
- html += me.htmlCls.divStr + "dl_ligplot' sty2D Interaction for One Ligand/Residule='background-color:white' class='" + dialogClass + "'>";
15521
- html += this.addNotebookTitle('dl_ligplot', 'e with Atom Details');
15524
+ html += me.htmlCls.divStr + "dl_ligplot' style='background-color:white' class='" + dialogClass + "'>";
15525
+
15526
+ if(me.cfg.cid !== undefined || me.cfg.smiles !== undefined) {
15527
+ html += this.addNotebookTitle('dl_ligplot', '2D Depiction for Chemicals');
15528
+ }
15529
+ else {
15530
+ html += this.addNotebookTitle('dl_ligplot', '2D Interaction for One Ligand/Residue with Atom Details');
15522
15531
 
15523
- 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;
15532
+ 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;
15524
15533
 
15525
- html += '<div style="width:20px; margin-top:6px; display:inline-block;"><span id="'
15526
- + 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="'
15527
- + me.pre + 'dl_ligplotcolor_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div></div>';
15534
+ html += '<div style="width:20px; margin-top:6px; display:inline-block;"><span id="'
15535
+ + 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="'
15536
+ + me.pre + 'dl_ligplotcolor_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div></div>';
15528
15537
 
15529
- html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
15538
+ html += me.htmlCls.divStr + "dl_ligplotcolor' style='inline-block;'>";
15530
15539
 
15531
- // 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>";
15532
- // html += "Mouseover the dashed lines to see interaction types and distances.<br>";
15533
- html += "<b>Color legend</b> for interactions (dashed lines): <br>";
15540
+ // 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>";
15541
+ // html += "Mouseover the dashed lines to see interaction types and distances.<br>";
15542
+ html += "<b>Color legend</b> for interactions (dashed lines): <br>";
15534
15543
 
15535
- html += me.htmlCls.setHtmlCls.setColorHints();
15544
+ html += me.htmlCls.setHtmlCls.setColorHints();
15536
15545
 
15537
- html += "<br></div>";
15546
+ html += "<br></div>";
15547
+ }
15538
15548
 
15539
15549
  me.ligplotid = me.pre + 'ligplot';
15540
15550
  html += me.htmlCls.divNowrapStr + buttonStrTmp + me.ligplotid + '_svg">SVG</button>' + me.htmlCls.space2;
@@ -16920,6 +16930,11 @@ class Events {
16920
16930
  thisClass.setLogCmd("view interactions", true);
16921
16931
  });
16922
16932
 
16933
+ me.myEventCls.onIds("#" + me.pre + "mn2_2ddepiction", "click", async function(e) { let ic = me.icn3d;
16934
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
16935
+ thisClass.setLogCmd("view 2d depiction", true);
16936
+ });
16937
+
16923
16938
  me.myEventCls.onIds("#" + me.pre + "search_seq_button", "click", async function(e) { me.icn3d;
16924
16939
  e.stopImmediatePropagation();
16925
16940
  await thisClass.searchSeq();
@@ -28123,6 +28138,8 @@ class Camera {
28123
28138
  }
28124
28139
  }
28125
28140
 
28141
+ // ic.cam.add(ic.directionalLight);
28142
+
28126
28143
  ic.cam.updateProjectionMatrix();
28127
28144
  // }
28128
28145
  }
@@ -38058,6 +38075,11 @@ class Alternate {
38058
38075
  ic.directionalLight.position.copy(ic.lightPos.clone().applyQuaternion( quaternion ).normalize());
38059
38076
  ic.directionalLight2.position.copy(ic.lightPos2.clone().applyQuaternion( quaternion ).normalize());
38060
38077
  ic.directionalLight3.position.copy(ic.lightPos3.clone().applyQuaternion( quaternion ).normalize());
38078
+
38079
+ // adjust the light according to the position of camera
38080
+ ic.directionalLight.applyMatrix4(cam.matrixWorld);
38081
+ ic.directionalLight2.applyMatrix4(cam.matrixWorld);
38082
+ ic.directionalLight3.applyMatrix4(cam.matrixWorld);
38061
38083
  }
38062
38084
 
38063
38085
  if(!ic.bVr) ic.renderer.setPixelRatio( window.devicePixelRatio ); // r71
@@ -52952,7 +52974,10 @@ class ViewInterPairs {
52952
52974
  cntHbond += result.cnt;
52953
52975
  svgHtmlNode += result.svgHtmlNode;
52954
52976
  svgHtmlLine += result.svgHtmlLine;
52955
- if(result.cnt > 0) residname2List += residname2 + ":hbond_" + result.cnt + " ";
52977
+ // if(result.cnt > 0) residname2List += residname2 + ":hbond_" + result.cnt + " ";
52978
+ // add hydrogen bond between main or side chains. result.mainside has value such as main,side,side,side
52979
+ // for two hydrogens between main and side, and side and side chains
52980
+ if(result.cnt > 0) residname2List += residname2 + ":hbond_" + result.cnt + ":type_" + result.mainside + " ";
52956
52981
 
52957
52982
  labels2dist = ic.resids2inter[resids]['ionic'];
52958
52983
  result = this.getInteractionPairDetails(labels2dist, type, 'ionic', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52960,7 +52985,7 @@ class ViewInterPairs {
52960
52985
  cntIonic += result.cnt;
52961
52986
  svgHtmlNode += result.svgHtmlNode;
52962
52987
  svgHtmlLine += result.svgHtmlLine;
52963
- if(result.cnt > 0) residname2List += residname2 + ":ionic_" + result.cnt + " ";
52988
+ if(result.cnt > 0) residname2List += residname2 + ":ionic_" + result.cnt + ":type_" + result.mainside + " ";
52964
52989
 
52965
52990
  labels2dist = ic.resids2inter[resids]['halogen'];
52966
52991
  result = this.getInteractionPairDetails(labels2dist, type, 'halogen', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52968,7 +52993,7 @@ class ViewInterPairs {
52968
52993
  cntHalegen += result.cnt;
52969
52994
  svgHtmlNode += result.svgHtmlNode;
52970
52995
  svgHtmlLine += result.svgHtmlLine;
52971
- if(result.cnt > 0) residname2List += residname2 + ":halogen_" + result.cnt + " ";
52996
+ if(result.cnt > 0) residname2List += residname2 + ":halogen_" + result.cnt + ":type_" + result.mainside + " ";
52972
52997
 
52973
52998
  labels2dist = ic.resids2inter[resids]['pi-cation'];
52974
52999
  result = this.getInteractionPairDetails(labels2dist, type, 'pi-cation', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52976,7 +53001,7 @@ class ViewInterPairs {
52976
53001
  cntPication += result.cnt;
52977
53002
  svgHtmlNode += result.svgHtmlNode;
52978
53003
  svgHtmlLine += result.svgHtmlLine;
52979
- if(result.cnt > 0) residname2List += residname2 + ":pi-cation_" + result.cnt + " ";
53004
+ if(result.cnt > 0) residname2List += residname2 + ":pi-cation_" + result.cnt + ":type_" + result.mainside + " ";
52980
53005
 
52981
53006
  labels2dist = ic.resids2inter[resids]['pi-stacking'];
52982
53007
  result = this.getInteractionPairDetails(labels2dist, type, 'pi-stacking', index2xy, xlen, ylen, xcenter, ycenter);
@@ -52984,7 +53009,7 @@ class ViewInterPairs {
52984
53009
  cntPistacking += result.cnt;
52985
53010
  svgHtmlNode += result.svgHtmlNode;
52986
53011
  svgHtmlLine += result.svgHtmlLine;
52987
- if(result.cnt > 0) residname2List += residname2 + ":pi-stacking_" + result.cnt + " ";
53012
+ if(result.cnt > 0) residname2List += residname2 + ":pi-stacking_" + result.cnt + ":type_" + result.mainside + " ";
52988
53013
 
52989
53014
  // put contact as the last one since contact will use the same node as other interactions in ligand-protein interactoin
52990
53015
  labels2dist = ic.resids2inter[resids]['contact'];
@@ -53038,7 +53063,7 @@ class ViewInterPairs {
53038
53063
  return tmpText;
53039
53064
  }
53040
53065
  getInteractionPairDetails(labels2dist, type, interactionType, index2xy, xlen, ylen, xcenter, ycenter) { let ic = this.icn3d; ic.icn3dui;
53041
- let svgHtmlNode = '', svgHtmlLine = '', tmpText = '', cnt = 0;
53066
+ let svgHtmlNode = '', svgHtmlLine = '', tmpText = '', cnt = 0, mainside= '';
53042
53067
  let colorText1 = ' <span style="background-color:#';
53043
53068
  let colorText2 = '">&nbsp;&nbsp;&nbsp;</span>';
53044
53069
  if(labels2dist !== undefined) {
@@ -53055,6 +53080,12 @@ class ViewInterPairs {
53055
53080
  let resid1 = resid1Ori.substr(0, pos1);
53056
53081
  let resid2 = resid2Ori.substr(0, pos2);
53057
53082
 
53083
+ let atomName1 = resid1.substr(resid1.indexOf('@') + 1);
53084
+ resid2.substr(resid2.indexOf('@') + 1);
53085
+ let atomType1 = (atomName1 === "N" || atomName1 === "C" || atomName1 === "O" || atomName1 === "CA") ? 'main' : 'side';
53086
+ if(mainside) mainside += ';';
53087
+ mainside += atomType1 + ',' + atomType1;
53088
+
53058
53089
  let resid1Real = ic.getGraphCls.convertLabel2Resid(resid1);
53059
53090
  let atom1 = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid1Real]);
53060
53091
  let color1 = (atom1.color) ? atom1.color.getHexString() : '';
@@ -53076,7 +53107,7 @@ class ViewInterPairs {
53076
53107
  }
53077
53108
  }
53078
53109
  }
53079
- return {html: tmpText, cnt: cnt, svgHtmlNode: svgHtmlNode, svgHtmlLine: svgHtmlLine}
53110
+ return {html: tmpText, cnt: cnt, svgHtmlNode: svgHtmlNode, svgHtmlLine: svgHtmlLine, mainside: mainside}
53080
53111
  }
53081
53112
 
53082
53113
  getContactPairDetails(labels2dist, type, interactionType, index2xy, xlen, ylen, xcenter, ycenter) { let ic = this.icn3d; ic.icn3dui;
@@ -64482,6 +64513,9 @@ class LoadPDB {
64482
64513
 
64483
64514
  ///id = line.substr(62, 4).trim();
64484
64515
  id = line.substr(62).trim();
64516
+ // remove "_" in the id
64517
+ id = id.replace(/_/g, '-');
64518
+
64485
64519
  oriId = id;
64486
64520
 
64487
64521
  if(id == '') {
@@ -65392,6 +65426,8 @@ class LoadCIF {
65392
65426
 
65393
65427
  if(block.getCategory("_entry")) {
65394
65428
  id = block.getCategory("_entry").getColumn("id").getString(0);
65429
+ // remove "_" in the id
65430
+ id = id.replace(/_/g, '-');
65395
65431
 
65396
65432
  if(id == '') {
65397
65433
  if(bAppend) {
@@ -69987,7 +70023,9 @@ class LoadScript {
69987
70023
  }
69988
70024
  else if(command.indexOf('view interactions') == 0 && me.cfg.align !== undefined) { // the command may have "|||{"factor"...
69989
70025
  await thisClass.applyCommandViewinteraction(strArray[0].trim());
69990
-
70026
+ }
70027
+ else if(command.indexOf('view 2d depiction') == 0) { // the command may have "|||{"factor"...
70028
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
69991
70029
  }
69992
70030
  else if(command.indexOf('symmetry') == 0) {
69993
70031
  ic.bAxisOnly = false;
@@ -70197,6 +70235,9 @@ class LoadScript {
70197
70235
  else if(lastCommand.indexOf('view interactions') == 0 && me.cfg.align !== undefined) {
70198
70236
  await thisClass.applyCommandViewinteraction(lastCommand);
70199
70237
  }
70238
+ else if(lastCommand.indexOf('view 2d depiction') == 0) {
70239
+ await ic.ligplotCls.drawLigplot(ic.atoms, true);
70240
+ }
70200
70241
  else if(lastCommand.indexOf('symmetry') == 0) {
70201
70242
  let title = lastCommand.substr(lastCommand.indexOf(' ') + 1);
70202
70243
  ic.symmetrytitle =(title === 'none') ? undefined : title;
@@ -73114,7 +73155,6 @@ class Dssp {
73114
73155
  if(ssHash !== undefined && JSON.stringify(ssHash).indexOf('Oops there was a problem') === -1) {
73115
73156
  for(let chainNum in ic.chainsSeq) {
73116
73157
  let pos = chainNum.indexOf('_');
73117
-
73118
73158
  // one structure at a time
73119
73159
  if(chainNum.substr(0, pos) != struArray[index]) continue;
73120
73160
 
@@ -78581,8 +78621,13 @@ class Ligplot {
78581
78621
  this.icn3d = icn3d;
78582
78622
  }
78583
78623
 
78584
- async drawLigplot(atomSet1) { let ic = this.icn3d, me = ic.icn3dui;
78585
- me.htmlCls.dialogCls.openDlg('dl_ligplot', 'Show ligand interactions with atom details');
78624
+ async drawLigplot(atomSet1, bDepiction) { let ic = this.icn3d, me = ic.icn3dui;
78625
+ if(bDepiction) {
78626
+ me.htmlCls.dialogCls.openDlg('dl_ligplot', '2D Depiction');
78627
+ }
78628
+ else {
78629
+ me.htmlCls.dialogCls.openDlg('dl_ligplot', 'Show ligand interactions with atom details');
78630
+ }
78586
78631
 
78587
78632
  let widthOri, heightOri, width = 100, height = 100;
78588
78633
  ic.len4ang = 80;
@@ -78664,19 +78709,28 @@ class Ligplot {
78664
78709
  let offset = - ic.len4ang;
78665
78710
  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'>";
78666
78711
 
78667
- let xlen = parseInt(widthOri / ic.svgGridSize), ylen = parseInt(heightOri / ic.svgGridSize);
78668
- let result = ic.viewInterPairsCls.getAllInteractionTable("save1", index2xy, xlen, ylen, xcenter, ycenter); // sort on the ligand/set1
78669
- ic.bLigplot = true;
78712
+ if(bDepiction) {
78713
+ svgHtml += lineSvg + nodeSvg;
78714
+ }
78715
+ else {
78716
+ let xlen = parseInt(widthOri / ic.svgGridSize), ylen = parseInt(heightOri / ic.svgGridSize);
78717
+ let result = ic.viewInterPairsCls.getAllInteractionTable("save1", index2xy, xlen, ylen, xcenter, ycenter); // sort on the ligand/set1
78718
+ // ic.bLigplot = true;
78670
78719
 
78671
- svgHtml += lineSvg + result.svgHtmlLine;
78720
+ svgHtml += lineSvg + result.svgHtmlLine;
78672
78721
 
78673
- svgHtml += nodeSvg + result.svgHtmlNode;
78722
+ svgHtml += nodeSvg + result.svgHtmlNode;
78723
+ }
78674
78724
 
78675
78725
  svgHtml += "</svg>";
78676
78726
 
78677
- $("#" + ic.pre + "ligplotDiv").html(svgHtml);
78678
-
78679
- this.setEventsForLigplot();
78727
+ if(bDepiction) {
78728
+ $("#" + ic.pre + "ligplotDiv").html(svgHtml);
78729
+ }
78730
+ else {
78731
+ $("#" + ic.pre + "ligplotDiv").html(svgHtml);
78732
+ this.setEventsForLigplot();
78733
+ }
78680
78734
  }
78681
78735
 
78682
78736
 
@@ -80326,6 +80380,11 @@ class SaveFile {
80326
80380
 
80327
80381
  $("#" + ic.pre + "title").html("PubChem CID <a id='" + ic.pre + "titlelink' href='" + url + "' style='color:" + titlelinkColor + "' target='_blank'>" + ic.inputid.toUpperCase() + "</a>: " + title);
80328
80382
  }
80383
+ else if(me.cfg.smiles !== undefined) {
80384
+ let text = decodeURIComponent(me.cfg.smiles);
80385
+ if(text.length > 60) text = text.substr(0, 60) + "...";
80386
+ $("#" + ic.pre + "title").html("SMILES: " + text);
80387
+ }
80329
80388
  else if(me.cfg.align !== undefined) {
80330
80389
  title = 'VAST+ alignment of ' + Object.keys(ic.structures);
80331
80390
 
@@ -83745,7 +83804,7 @@ class iCn3DUI {
83745
83804
  //even when multiple iCn3D viewers are shown together.
83746
83805
  this.pre = this.cfg.divid + "_";
83747
83806
 
83748
- this.REVISION = '3.39.0';
83807
+ this.REVISION = '3.40.0';
83749
83808
 
83750
83809
  // In nodejs, iCn3D defines "window = {navigator: {}}"
83751
83810
  this.bNode = (Object.keys(window).length < 2) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.39.0",
3
+ "version": "3.40.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {