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.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 + "'>";
@@ -120851,7 +120851,8 @@ class LoadScript {
120851
120851
  }
120852
120852
  else if(command.indexOf('diagram 2d nucleotide') == 0) {
120853
120853
  let paraArray = command.split(' | ');
120854
- let chainid = paraArray[1];
120854
+ let pos = command.lastIndexOf(' ');
120855
+ let chainid = (paraArray.length == 2) ? paraArray[1] : command.substr(pos + 1);
120855
120856
 
120856
120857
  ic.bRender = true;
120857
120858
  await ic.diagram2dCls.drawR2dt(chainid);
@@ -120859,7 +120860,8 @@ class LoadScript {
120859
120860
  }
120860
120861
  else if(command.indexOf('diagram 2d ig') == 0) {
120861
120862
  let paraArray = command.split(' | ');
120862
- let chainid = paraArray[1];
120863
+ let pos = command.lastIndexOf(' ');
120864
+ let chainid = (paraArray.length == 2) ? paraArray[1] : command.substr(pos + 1);
120863
120865
 
120864
120866
  ic.bRender = true;
120865
120867
  await ic.diagram2dCls.drawIgdgm(chainid);
@@ -128184,7 +128186,6 @@ class Diagram2d {
128184
128186
  let titleElem = clickedElement.querySelector('title');
128185
128187
 
128186
128188
  if(titleElem) {
128187
- titleElem.style.cursor = "pointer";
128188
128189
  let title = titleElem.textContent; // e.g., 14 (position.label in template: 14.A)
128189
128190
  let textArray = title.split(' ');
128190
128191
  let position_resn = textArray[textArray.length - 1].split('.');
@@ -128203,7 +128204,7 @@ class Diagram2d {
128203
128204
  let realResn = (resn == 'T') ? 'U' : resn;
128204
128205
 
128205
128206
  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
+ var aaa = 1; //alert("The residue number in R2DT didn't match that in 3D view...");
128207
128208
  }
128208
128209
  else {
128209
128210
  // highlight the selected residue
@@ -128222,17 +128223,11 @@ class Diagram2d {
128222
128223
  let textElem = clickedElement.querySelector('text');
128223
128224
  textElem.setAttribute("stroke", "#f8b84e");
128224
128225
  textElem.setAttribute("stroke-width", "0.5px");
128225
- }
128226
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
- }
128227
+ // add cursor
128228
+ if(!ic.bAddedCursors) {
128229
+ ic.bAddedCursors = true;
128230
+ ic.diagram2dCls.makeResiduesClickable();
128236
128231
  }
128237
128232
  }
128238
128233
  });
@@ -128461,7 +128456,20 @@ class Diagram2d {
128461
128456
  return html;
128462
128457
  }
128463
128458
 
128459
+ makeResiduesClickable() { let ic = this.icn3d; ic.icn3dui;
128460
+ let r2dt = document.querySelector('r2dt-web').shadowRoot;
128461
+ let elemArray = r2dt.querySelectorAll('g:has(title)');
128462
+ for(let i = 0, il = elemArray.length; i < il; ++i) {
128463
+ if(!elemArray[i].hasAttribute('id')) { // skip the main g element
128464
+ elemArray[i].style.cursor = "pointer";
128465
+ }
128466
+ }
128467
+ }
128468
+
128464
128469
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
128470
+ let thisClass = this;
128471
+ ic.bAddedCursors = false;
128472
+
128465
128473
  ic.r2dt_chainid = chainid;
128466
128474
 
128467
128475
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
@@ -128470,12 +128478,16 @@ class Diagram2d {
128470
128478
 
128471
128479
  let html = '';
128472
128480
  if(data && data.rnaid) {
128473
- ic.bSetCursor = false;
128474
-
128475
128481
  html += '<r2dt-web search=\'{"urs": "' + data.rnaid + '"}\' />';
128476
128482
  html += '<script type="text/javascript" src="https://rnacentral.github.io/r2dt-web/dist/r2dt-web.js"></script>';
128477
128483
  $("#" + me.pre + "2ddiagramDiv").html(html);
128478
128484
  me.htmlCls.dialogCls.openDlg('dl_2ddiagram', 'Show R2DT Diagram for chain ' + chainid);
128485
+
128486
+ // set cursor for all nodes
128487
+ setTimeout(function(){
128488
+ //ic.bAddedCursors = true;
128489
+ thisClass.makeResiduesClickable();
128490
+ }, 3000);
128479
128491
  }
128480
128492
  else {
128481
128493
  var aaa = 1; //alert("No R2DT diagram can be found for chain " + chainid);
@@ -128536,7 +128548,7 @@ class Diagram2d {
128536
128548
  if(refnumLabel) {
128537
128549
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
128538
128550
  if(!refnum2resn[domainid]) refnum2resn[domainid] = {};
128539
- refnum2resn[domainid][refnumStr] = resn;
128551
+ refnum2resn[domainid][refnumStr] = resn + resid.split('_')[2];
128540
128552
  }
128541
128553
  }
128542
128554
 
@@ -128549,6 +128561,8 @@ class Diagram2d {
128549
128561
 
128550
128562
  const mainWorkbook = new ExcelJS.Workbook();
128551
128563
 
128564
+ let ig2width = {'IgC1': 17, 'IgC2': 18, 'IgI': 19, 'IgV': 19};
128565
+
128552
128566
  for(let i = 0, il = igArray.length; i < il; ++i) {
128553
128567
  let domainid = igArray[i].domainid;
128554
128568
  let igType = igTypeArray[i];
@@ -128566,10 +128580,8 @@ class Diagram2d {
128566
128580
 
128567
128581
  const newSheet = mainWorkbook.addWorksheet();
128568
128582
  // Clone the model to transfer styles and data
128569
- newSheet.model = {
128570
- ...worksheet.model,
128571
- name: (i + 1) + ". " + igType
128572
- };
128583
+ newSheet.model = worksheet.model;
128584
+ newSheet.name = (i + 1) + ". " + igType;
128573
128585
 
128574
128586
  // Iterate over all rows that have values
128575
128587
  newSheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
@@ -128584,8 +128596,28 @@ class Diagram2d {
128584
128596
  cell.value = '';
128585
128597
  }
128586
128598
  }
128599
+ else if(cell.value == 'NUMBERING') {
128600
+ cell.value = '';
128601
+ }
128587
128602
  });
128588
128603
  });
128604
+
128605
+ // copy the original data
128606
+ let colNum = ig2width[igType]; // some extra columns
128607
+ for(let i = 1; i <= colNum; ++i) {
128608
+ const sourceCol = worksheet.getColumn(i);
128609
+
128610
+ // Copy values and styles
128611
+ sourceCol.eachCell({ includeEmpty: true }, (cell, rowNumber) => {
128612
+ const targetCell = newSheet.getRow(rowNumber).getCell(colNum + 2 + i);
128613
+
128614
+ targetCell.value = cell.value;
128615
+ targetCell.style = cell.style; // Copies font, borders, and fills
128616
+ });
128617
+
128618
+ // reset width for each column
128619
+ newSheet.getColumn(colNum + 2 + i).width = worksheet.getColumn(i).width;
128620
+ }
128589
128621
  }
128590
128622
  }
128591
128623