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.module.js CHANGED
@@ -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('.');
@@ -129123,6 +129124,12 @@ class Diagram2d {
129123
129124
  let textElem = clickedElement.querySelector('text');
129124
129125
  textElem.setAttribute("stroke", "#f8b84e");
129125
129126
  textElem.setAttribute("stroke-width", "0.5px");
129127
+
129128
+ // add cursor
129129
+ if(!ic.bAddedCursors) {
129130
+ ic.bAddedCursors = true;
129131
+ ic.diagram2dCls.makeResiduesClickable();
129132
+ }
129126
129133
  }
129127
129134
  });
129128
129135
  }
@@ -129350,7 +129357,20 @@ class Diagram2d {
129350
129357
  return html;
129351
129358
  }
129352
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
+
129353
129370
  async drawR2dt(chainid) { let ic = this.icn3d, me = ic.icn3dui;
129371
+ let thisClass = this;
129372
+ ic.bAddedCursors = false;
129373
+
129354
129374
  ic.r2dt_chainid = chainid;
129355
129375
 
129356
129376
  let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?chainid2rnaid=" + chainid;
@@ -129366,14 +129386,9 @@ class Diagram2d {
129366
129386
 
129367
129387
  // set cursor for all nodes
129368
129388
  setTimeout(function(){
129369
- let r2dt = document.querySelector('r2dt-web').shadowRoot;
129370
- let elemArray = r2dt.querySelectorAll('g:has(title)');
129371
- for(let i = 0, il = elemArray.length; i < il; ++i) {
129372
- if(!elemArray[i].hasAttribute('id')) { // skip the main g element
129373
- elemArray[i].style.cursor = "pointer";
129374
- }
129375
- }
129376
- }, 1000);
129389
+ //ic.bAddedCursors = true;
129390
+ thisClass.makeResiduesClickable();
129391
+ }, 3000);
129377
129392
  }
129378
129393
  else {
129379
129394
  var aaa = 1; //alert("No R2DT diagram can be found for chain " + chainid);
@@ -129434,7 +129449,7 @@ class Diagram2d {
129434
129449
  if(refnumLabel) {
129435
129450
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
129436
129451
  if(!refnum2resn[domainid]) refnum2resn[domainid] = {};
129437
- refnum2resn[domainid][refnumStr] = resn;
129452
+ refnum2resn[domainid][refnumStr] = resn + resid.split('_')[2];
129438
129453
  }
129439
129454
  }
129440
129455
 
@@ -129447,6 +129462,8 @@ class Diagram2d {
129447
129462
 
129448
129463
  const mainWorkbook = new ExcelJS.Workbook();
129449
129464
 
129465
+ let ig2width = {'IgC1': 17, 'IgC2': 18, 'IgI': 19, 'IgV': 19};
129466
+
129450
129467
  for(let i = 0, il = igArray.length; i < il; ++i) {
129451
129468
  let domainid = igArray[i].domainid;
129452
129469
  let igType = igTypeArray[i];
@@ -129464,10 +129481,8 @@ class Diagram2d {
129464
129481
 
129465
129482
  const newSheet = mainWorkbook.addWorksheet();
129466
129483
  // Clone the model to transfer styles and data
129467
- newSheet.model = {
129468
- ...worksheet.model,
129469
- name: (i + 1) + ". " + igType
129470
- };
129484
+ newSheet.model = worksheet.model;
129485
+ newSheet.name = (i + 1) + ". " + igType;
129471
129486
 
129472
129487
  // Iterate over all rows that have values
129473
129488
  newSheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
@@ -129482,8 +129497,28 @@ class Diagram2d {
129482
129497
  cell.value = '';
129483
129498
  }
129484
129499
  }
129500
+ else if(cell.value == 'NUMBERING') {
129501
+ cell.value = '';
129502
+ }
129485
129503
  });
129486
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
+ }
129487
129522
  }
129488
129523
  }
129489
129524
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.49.5",
3
+ "version": "3.49.6",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {