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.js CHANGED
@@ -62164,7 +62164,7 @@ class SetDialog {
62164
62164
  html += "1. Select a nucleotide chain to show R2DT diagram:<br>";
62165
62165
  html += "<select style='max-width:200px' id='" + me.pre + "atomsCustomNucleotide' size='5' style='min-width:130px;'>";
62166
62166
  html += "</select><br>";
62167
- html += me.htmlCls.buttonStr + "applyr2dt'>Show R2DT Diagram</button><br>";
62167
+ 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>";
62168
62168
  html += "</div>";
62169
62169
 
62170
62170
  html += me.htmlCls.divStr + "dl_2ddgm_igdgm' class='" + dialogClass + "'>";
@@ -128174,6 +128174,56 @@ class Diagram2d {
128174
128174
 
128175
128175
  thisClass.clickNode(this);
128176
128176
  });
128177
+
128178
+ // event for R2DT
128179
+ //document.addEventListener('click', (event) => {
128180
+ $(document).on("click", "r2dt-web", function(e) { let ic = thisClass.icn3d;
128181
+ // The 2nd element in the path is the actual clicked g element
128182
+ const path = e.originalEvent.composedPath();
128183
+ const clickedElement = path[1];
128184
+ let titleElem = clickedElement.querySelector('title');
128185
+
128186
+ if(titleElem) {
128187
+ titleElem.style.cursor = "pointer";
128188
+ let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
128189
+ let textArray = title.split(' ');
128190
+ let position_resn = textArray[textArray.length - 1].split('.');
128191
+ let pos = position_resn[0];
128192
+ let resn = position_resn[1].substr(0, position_resn[1].length - 1);
128193
+
128194
+ let resid = ic.ncbi2resid[ic.r2dt_chainid + '_' + pos];
128195
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
128196
+
128197
+ if(!atom) {
128198
+ var aaa = 1; //alert("This residue has no 3D coordinates...");
128199
+ }
128200
+ else {
128201
+ let oneLetterRes = me.utilsCls.residueName2Abbr(atom.resn);
128202
+
128203
+ let realResn = (resn == 'T') ? 'U' : resn;
128204
+
128205
+ if(resn != oneLetterRes && realResn != oneLetterRes) {
128206
+ var aaa = 1; //alert("The residue number in R2DT didn't match that in 3D view...");
128207
+ }
128208
+ else {
128209
+ // highlight the selected residue
128210
+ if(ic.bCtrl || ic.bShift) {
128211
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.residues[resid]);
128212
+ }
128213
+ else {
128214
+ ic.hAtoms = ic.residues[resid];
128215
+ }
128216
+
128217
+ ic.hlUpdateCls.showHighlight();
128218
+ }
128219
+ }
128220
+
128221
+ // highlight the selected residue in 2D
128222
+ let textElem = clickedElement.querySelector('text');
128223
+ textElem.setAttribute("stroke", "#f8b84e");
128224
+ textElem.setAttribute("stroke-width", "0.5px");
128225
+ }
128226
+ });
128177
128227
  }
128178
128228
 
128179
128229
  clickNode(node) { let ic = this.icn3d, me = ic.icn3dui;
@@ -128400,6 +128450,8 @@ class Diagram2d {
128400
128450
  }
128401
128451
 
128402
128452
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
128453
+ ic.r2dt_chainid = chainid;
128454
+
128403
128455
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
128404
128456
 
128405
128457
  let data = await me.getAjaxPromise(url, 'jsonp');
@@ -128410,6 +128462,17 @@ class Diagram2d {
128410
128462
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
128411
128463
  $("#" + me.pre + "2ddiagramDiv").html(html);
128412
128464
  me.htmlCls.dialogCls.openDlg('dl_2ddiagram', 'Show R2DT Diagram for chain ' + chainid);
128465
+
128466
+ // set cursor for all nodes
128467
+ setTimeout(function(){
128468
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
128469
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
128470
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
128471
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
128472
+ elemArray[i].style.cursor = "pointer";
128473
+ }
128474
+ }
128475
+ }, 1000);
128413
128476
  }
128414
128477
  else {
128415
128478
  var aaa = 1; //alert("No R2DT diagram can be found for chain " + chainid);
@@ -128451,7 +128514,7 @@ class Diagram2d {
128451
128514
  }
128452
128515
 
128453
128516
  if(!bFound) {
128454
- 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.");
128517
+ 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.");
128455
128518
  return;
128456
128519
  }
128457
128520
 
@@ -134798,7 +134861,7 @@ class iCn3DUI {
134798
134861
  //even when multiple iCn3D viewers are shown together.
134799
134862
  this.pre = this.cfg.divid + "_";
134800
134863
 
134801
- this.REVISION = '3.49.1';
134864
+ this.REVISION = '3.49.2';
134802
134865
 
134803
134866
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
134804
134867
  this.bNode = (Object.keys(window).length < 3) ? true : false;