icn3d 3.49.5 → 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
@@ -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('.');
@@ -128222,6 +128223,12 @@ class Diagram2d {
128222
128223
  let textElem = clickedElement.querySelector('text');
128223
128224
  textElem.setAttribute("stroke", "#f8b84e");
128224
128225
  textElem.setAttribute("stroke-width", "0.5px");
128226
+
128227
+ // add cursor
128228
+ if(!ic.bAddedCursors) {
128229
+ ic.bAddedCursors = true;
128230
+ ic.diagram2dCls.makeResiduesClickable();
128231
+ }
128225
128232
  }
128226
128233
  });
128227
128234
  }
@@ -128449,7 +128456,20 @@ class Diagram2d {
128449
128456
  return html;
128450
128457
  }
128451
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
+
128452
128469
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
128470
+ let thisClass = this;
128471
+ ic.bAddedCursors = false;
128472
+
128453
128473
  ic.r2dt_chainid = chainid;
128454
128474
 
128455
128475
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
@@ -128465,14 +128485,9 @@ class Diagram2d {
128465
128485
 
128466
128486
  // set cursor for all nodes
128467
128487
  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);
128488
+ //ic.bAddedCursors = true;
128489
+ thisClass.makeResiduesClickable();
128490
+ }, 3000);
128476
128491
  }
128477
128492
  else {
128478
128493
  var aaa = 1; //alert("No R2DT diagram can be found for chain " + chainid);
@@ -128533,7 +128548,7 @@ class Diagram2d {
128533
128548
  if(refnumLabel) {
128534
128549
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
128535
128550
  if(!refnum2resn[domainid]) refnum2resn[domainid] = {};
128536
- refnum2resn[domainid][refnumStr] = resn;
128551
+ refnum2resn[domainid][refnumStr] = resn + resid.split('_')[2];
128537
128552
  }
128538
128553
  }
128539
128554
 
@@ -128546,6 +128561,8 @@ class Diagram2d {
128546
128561
 
128547
128562
  const mainWorkbook = new ExcelJS.Workbook();
128548
128563
 
128564
+ let ig2width = {'IgC1': 17, 'IgC2': 18, 'IgI': 19, 'IgV': 19};
128565
+
128549
128566
  for(let i = 0, il = igArray.length; i < il; ++i) {
128550
128567
  let domainid = igArray[i].domainid;
128551
128568
  let igType = igTypeArray[i];
@@ -128563,10 +128580,8 @@ class Diagram2d {
128563
128580
 
128564
128581
  const newSheet = mainWorkbook.addWorksheet();
128565
128582
  // Clone the model to transfer styles and data
128566
- newSheet.model = {
128567
- ...worksheet.model,
128568
- name: (i + 1) + ". " + igType
128569
- };
128583
+ newSheet.model = worksheet.model;
128584
+ newSheet.name = (i + 1) + ". " + igType;
128570
128585
 
128571
128586
  // Iterate over all rows that have values
128572
128587
  newSheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
@@ -128581,8 +128596,28 @@ class Diagram2d {
128581
128596
  cell.value = '';
128582
128597
  }
128583
128598
  }
128599
+ else if(cell.value == 'NUMBERING') {
128600
+ cell.value = '';
128601
+ }
128584
128602
  });
128585
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
+ }
128586
128621
  }
128587
128622
  }
128588
128623