icn3d 3.49.2 → 3.49.4

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
@@ -128174,6 +128174,68 @@ 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 mouseover text in R2DT didn't match the residue number 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
+
128227
+ // set cursor for all nodes
128228
+ if(!ic.bSetCursor) {
128229
+ ic.bSetCursor = true;
128230
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
128231
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
128232
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
128233
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
128234
+ elemArray[i].style.cursor = "pointer";
128235
+ }
128236
+ }
128237
+ }
128238
+ });
128177
128239
  }
128178
128240
 
128179
128241
  clickNode(node) { let ic = this.icn3d, me = ic.icn3dui;
@@ -128400,12 +128462,16 @@ class Diagram2d {
128400
128462
  }
128401
128463
 
128402
128464
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
128465
+ ic.r2dt_chainid = chainid;
128466
+
128403
128467
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
128404
128468
 
128405
128469
  let data = await me.getAjaxPromise(url, 'jsonp');
128406
128470
 
128407
128471
  let html = '';
128408
128472
  if(data && data.rnaid) {
128473
+ ic.bSetCursor = false;
128474
+
128409
128475
  html += '<r2dt-web search=\'{"urs": "' + data.rnaid + '"}\' />';
128410
128476
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
128411
128477
  $("#" + me.pre + "2ddiagramDiv").html(html);
@@ -128445,15 +128511,13 @@ class Diagram2d {
128445
128511
 
128446
128512
  if(igType == 'IgV' || igType == 'IgC1' || igType == 'IgC2' || igType == 'IgI') {
128447
128513
  bFound = true;
128448
- igTypeArray.push(igType);
128449
- }
128450
- else {
128451
- igTypeArray.push('');
128452
128514
  }
128515
+
128516
+ igTypeArray.push(igType);
128453
128517
  }
128454
128518
 
128455
128519
  if(!bFound) {
128456
- var aaa = 1; //alert("The Ig type for chain " + chainid + " is " + igType + ". Currently only IgV, IgC1, IgC2 and IgI types are supported for drawing Ig diagrams.");
128520
+ 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.");
128457
128521
  return;
128458
128522
  }
128459
128523
 
@@ -128488,8 +128552,8 @@ class Diagram2d {
128488
128552
  for(let i = 0, il = igArray.length; i < il; ++i) {
128489
128553
  let domainid = igArray[i].domainid;
128490
128554
  let igType = igTypeArray[i];
128491
- if(!igType) {
128492
- mainWorkbook.addWorksheet(`Sheet_${i + 1}`);
128555
+ if(!(igType == 'IgV' || igType == 'IgC1' || igType == 'IgC2' || igType == 'IgI')) {
128556
+ mainWorkbook.addWorksheet((i + 1) + ". " + igType);
128493
128557
  }
128494
128558
  else {
128495
128559
  let url = "/Structure/icn3d/template/igstrand_template_" + igType + ".xlsx";
@@ -128504,7 +128568,7 @@ class Diagram2d {
128504
128568
  // Clone the model to transfer styles and data
128505
128569
  newSheet.model = {
128506
128570
  ...worksheet.model,
128507
- name: "Ig Domain " + (i + 1)
128571
+ name: (i + 1) + ". " + igType
128508
128572
  };
128509
128573
 
128510
128574
  // Iterate over all rows that have values
@@ -134800,7 +134864,7 @@ class iCn3DUI {
134800
134864
  //even when multiple iCn3D viewers are shown together.
134801
134865
  this.pre = this.cfg.divid + "_";
134802
134866
 
134803
- this.REVISION = '3.49.1';
134867
+ this.REVISION = '3.49.2';
134804
134868
 
134805
134869
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
134806
134870
  this.bNode = (Object.keys(window).length < 3) ? true : false;