icn3d 3.49.3 → 3.49.5

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
@@ -63065,7 +63065,7 @@ class SetDialog {
63065
63065
  html += "1. Select a nucleotide chain to show R2DT diagram:<br>";
63066
63066
  html += "<select style='max-width:200px' id='" + me.pre + "atomsCustomNucleotide' size='5' style='min-width:130px;'>";
63067
63067
  html += "</select><br>";
63068
- html += me.htmlCls.buttonStr + "applyr2dt'>Show R2DT Diagram</button><br>";
63068
+ html += me.htmlCls.buttonStr + "applyr2dt'>Show R2DT Diagram</button> <br><br>(Hints: Click on Residues in 2D to highlight in 3D. <br>Ctrl + click to select multiple residues.)<br>";
63069
63069
  html += "</div>";
63070
63070
 
63071
63071
  html += me.htmlCls.divStr + "dl_2ddgm_igdgm' class='" + dialogClass + "'>";
@@ -129075,6 +129075,56 @@ class Diagram2d {
129075
129075
 
129076
129076
  thisClass.clickNode(this);
129077
129077
  });
129078
+
129079
+ // event for R2DT
129080
+ //document.addEventListener('click', (event) => {
129081
+ $(document).on("click", "r2dt-web", function(e) { let ic = thisClass.icn3d;
129082
+ // The 2nd element in the path is the actual clicked g element
129083
+ const path = e.originalEvent.composedPath();
129084
+ const clickedElement = path[1];
129085
+ let titleElem = clickedElement.querySelector('title');
129086
+
129087
+ if(titleElem) {
129088
+ titleElem.style.cursor = "pointer";
129089
+ let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
129090
+ let textArray = title.split(' ');
129091
+ let position_resn = textArray[textArray.length - 1].split('.');
129092
+ let pos = position_resn[0];
129093
+ let resn = position_resn[1].substr(0, position_resn[1].length - 1);
129094
+
129095
+ let resid = ic.ncbi2resid[ic.r2dt_chainid + '_' + pos];
129096
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
129097
+
129098
+ if(!atom) {
129099
+ var aaa = 1; //alert("This residue has no 3D coordinates...");
129100
+ }
129101
+ else {
129102
+ let oneLetterRes = me.utilsCls.residueName2Abbr(atom.resn);
129103
+
129104
+ let realResn = (resn == 'T') ? 'U' : resn;
129105
+
129106
+ if(resn != oneLetterRes && realResn != oneLetterRes) {
129107
+ var aaa = 1; //alert("The residue number in R2DT didn't match that in 3D view...");
129108
+ }
129109
+ else {
129110
+ // highlight the selected residue
129111
+ if(ic.bCtrl || ic.bShift) {
129112
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.residues[resid]);
129113
+ }
129114
+ else {
129115
+ ic.hAtoms = ic.residues[resid];
129116
+ }
129117
+
129118
+ ic.hlUpdateCls.showHighlight();
129119
+ }
129120
+ }
129121
+
129122
+ // highlight the selected residue in 2D
129123
+ let textElem = clickedElement.querySelector('text');
129124
+ textElem.setAttribute("stroke", "#f8b84e");
129125
+ textElem.setAttribute("stroke-width", "0.5px");
129126
+ }
129127
+ });
129078
129128
  }
129079
129129
 
129080
129130
  clickNode(node) { let ic = this.icn3d, me = ic.icn3dui;
@@ -129301,6 +129351,8 @@ class Diagram2d {
129301
129351
  }
129302
129352
 
129303
129353
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
129354
+ ic.r2dt_chainid = chainid;
129355
+
129304
129356
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
129305
129357
 
129306
129358
  let data = await me.getAjaxPromise(url, 'jsonp');
@@ -129311,6 +129363,17 @@ class Diagram2d {
129311
129363
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
129312
129364
  $("#" + me.pre + "2ddiagramDiv").html(html);
129313
129365
  me.htmlCls.dialogCls.openDlg('dl_2ddiagram', 'Show R2DT Diagram for chain ' + chainid);
129366
+
129367
+ // set cursor for all nodes
129368
+ setTimeout(function(){
129369
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
129370
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
129371
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
129372
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
129373
+ elemArray[i].style.cursor = "pointer";
129374
+ }
129375
+ }
129376
+ }, 1000);
129314
129377
  }
129315
129378
  else {
129316
129379
  var aaa = 1; //alert("No R2DT diagram can be found for chain " + chainid);
@@ -129352,7 +129415,7 @@ class Diagram2d {
129352
129415
  }
129353
129416
 
129354
129417
  if(!bFound) {
129355
- var aaa = 1; //alert("The Ig type for chain " + chainid + " is " + igTypeArray + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
129418
+ var aaa = 1; //alert("The Ig type(s) for chain " + chainid + " is/are " + igTypeArray + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
129356
129419
  return;
129357
129420
  }
129358
129421
 
@@ -135699,7 +135762,7 @@ class iCn3DUI {
135699
135762
  //even when multiple iCn3D viewers are shown together.
135700
135763
  this.pre = this.cfg.divid + "_";
135701
135764
 
135702
- this.REVISION = '3.49.1';
135765
+ this.REVISION = '3.49.2';
135703
135766
 
135704
135767
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
135705
135768
  this.bNode = (Object.keys(window).length < 3) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.49.3",
3
+ "version": "3.49.5",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {