icn3d 3.49.4 → 3.49.6

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 + "'>";
@@ -121752,7 +121752,8 @@ class LoadScript {
121752
121752
  }
121753
121753
  else if(command.indexOf('diagram 2d nucleotide') == 0) {
121754
121754
  let paraArray = command.split(' | ');
121755
- let chainid = paraArray[1];
121755
+ let pos = command.lastIndexOf(' ');
121756
+ let chainid = (paraArray.length == 2) ? paraArray[1] : command.substr(pos + 1);
121756
121757
 
121757
121758
  ic.bRender = true;
121758
121759
  await ic.diagram2dCls.drawR2dt(chainid);
@@ -121760,7 +121761,8 @@ class LoadScript {
121760
121761
  }
121761
121762
  else if(command.indexOf('diagram 2d ig') == 0) {
121762
121763
  let paraArray = command.split(' | ');
121763
- let chainid = paraArray[1];
121764
+ let pos = command.lastIndexOf(' ');
121765
+ let chainid = (paraArray.length == 2) ? paraArray[1] : command.substr(pos + 1);
121764
121766
 
121765
121767
  ic.bRender = true;
121766
121768
  await ic.diagram2dCls.drawIgdgm(chainid);
@@ -129085,7 +129087,6 @@ class Diagram2d {
129085
129087
  let titleElem = clickedElement.querySelector('title');
129086
129088
 
129087
129089
  if(titleElem) {
129088
- titleElem.style.cursor = "pointer";
129089
129090
  let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
129090
129091
  let textArray = title.split(' ');
129091
129092
  let position_resn = textArray[textArray.length - 1].split('.');
@@ -129104,7 +129105,7 @@ class Diagram2d {
129104
129105
  let realResn = (resn == 'T') ? 'U' : resn;
129105
129106
 
129106
129107
  if(resn != oneLetterRes && realResn != oneLetterRes) {
129107
- var aaa = 1; //alert("The mouseover text in R2DT didn't match the residue number in 3D view...");
129108
+ var aaa = 1; //alert("The residue number in R2DT didn't match that in 3D view...");
129108
129109
  }
129109
129110
  else {
129110
129111
  // highlight the selected residue
@@ -129123,17 +129124,11 @@ class Diagram2d {
129123
129124
  let textElem = clickedElement.querySelector('text');
129124
129125
  textElem.setAttribute("stroke", "#f8b84e");
129125
129126
  textElem.setAttribute("stroke-width", "0.5px");
129126
- }
129127
129127
 
129128
- // set cursor for all nodes
129129
- if(!ic.bSetCursor) {
129130
- ic.bSetCursor = true;
129131
- let r2dt = document.querySelector('r2dt-web').shadowRoot;
129132
- let elemArray = r2dt.querySelectorAll('g:has(title)');
129133
- for(let i = 0, il = elemArray.length; i < il; ++i) {
129134
- if(!elemArray[i].hasAttribute('id')) { // skip the main g element
129135
- elemArray[i].style.cursor = "pointer";
129136
- }
129128
+ // add cursor
129129
+ if(!ic.bAddedCursors) {
129130
+ ic.bAddedCursors = true;
129131
+ ic.diagram2dCls.makeResiduesClickable();
129137
129132
  }
129138
129133
  }
129139
129134
  });
@@ -129362,7 +129357,20 @@ class Diagram2d {
129362
129357
  return html;
129363
129358
  }
129364
129359
 
129360
+ makeResiduesClickable() { let ic = this.icn3d; ic.icn3dui;
129361
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
129362
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
129363
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
129364
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
129365
+ elemArray[i].style.cursor = "pointer";
129366
+ }
129367
+ }
129368
+ }
129369
+
129365
129370
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
129371
+ let thisClass = this;
129372
+ ic.bAddedCursors = false;
129373
+
129366
129374
  ic.r2dt_chainid = chainid;
129367
129375
 
129368
129376
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
@@ -129371,12 +129379,16 @@ class Diagram2d {
129371
129379
 
129372
129380
  let html = '';
129373
129381
  if(data && data.rnaid) {
129374
- ic.bSetCursor = false;
129375
-
129376
129382
  html += '<r2dt-web search=\'{"urs": "' + data.rnaid + '"}\' />';
129377
129383
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
129378
129384
  $("#" + me.pre + "2ddiagramDiv").html(html);
129379
129385
  me.htmlCls.dialogCls.openDlg('dl_2ddiagram', 'Show R2DT Diagram for chain ' + chainid);
129386
+
129387
+ // set cursor for all nodes
129388
+ setTimeout(function(){
129389
+ //ic.bAddedCursors = true;
129390
+ thisClass.makeResiduesClickable();
129391
+ }, 3000);
129380
129392
  }
129381
129393
  else {
129382
129394
  var aaa = 1; //alert("No R2DT diagram can be found for chain " + chainid);
@@ -129437,7 +129449,7 @@ class Diagram2d {
129437
129449
  if(refnumLabel) {
129438
129450
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
129439
129451
  if(!refnum2resn[domainid]) refnum2resn[domainid] = {};
129440
- refnum2resn[domainid][refnumStr] = resn;
129452
+ refnum2resn[domainid][refnumStr] = resn + resid.split('_')[2];
129441
129453
  }
129442
129454
  }
129443
129455
 
@@ -129450,6 +129462,8 @@ class Diagram2d {
129450
129462
 
129451
129463
  const mainWorkbook = new ExcelJS.Workbook();
129452
129464
 
129465
+ let ig2width = {'IgC1': 17, 'IgC2': 18, 'IgI': 19, 'IgV': 19};
129466
+
129453
129467
  for(let i = 0, il = igArray.length; i < il; ++i) {
129454
129468
  let domainid = igArray[i].domainid;
129455
129469
  let igType = igTypeArray[i];
@@ -129467,10 +129481,8 @@ class Diagram2d {
129467
129481
 
129468
129482
  const newSheet = mainWorkbook.addWorksheet();
129469
129483
  // Clone the model to transfer styles and data
129470
- newSheet.model = {
129471
- ...worksheet.model,
129472
- name: (i + 1) + ". " + igType
129473
- };
129484
+ newSheet.model = worksheet.model;
129485
+ newSheet.name = (i + 1) + ". " + igType;
129474
129486
 
129475
129487
  // Iterate over all rows that have values
129476
129488
  newSheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
@@ -129485,8 +129497,28 @@ class Diagram2d {
129485
129497
  cell.value = '';
129486
129498
  }
129487
129499
  }
129500
+ else if(cell.value == 'NUMBERING') {
129501
+ cell.value = '';
129502
+ }
129488
129503
  });
129489
129504
  });
129505
+
129506
+ // copy the original data
129507
+ let colNum = ig2width[igType]; // some extra columns
129508
+ for(let i = 1; i <= colNum; ++i) {
129509
+ const sourceCol = worksheet.getColumn(i);
129510
+
129511
+ // Copy values and styles
129512
+ sourceCol.eachCell({ includeEmpty: true }, (cell, rowNumber) => {
129513
+ const targetCell = newSheet.getRow(rowNumber).getCell(colNum + 2 + i);
129514
+
129515
+ targetCell.value = cell.value;
129516
+ targetCell.style = cell.style; // Copies font, borders, and fills
129517
+ });
129518
+
129519
+ // reset width for each column
129520
+ newSheet.getColumn(colNum + 2 + i).width = worksheet.getColumn(i).width;
129521
+ }
129490
129522
  }
129491
129523
  }
129492
129524
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.49.4",
3
+ "version": "3.49.6",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {