icn3d 3.49.0 → 3.49.2

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
@@ -119685,14 +119685,14 @@ class DefinedSets {
119685
119685
  let colorStr =(atom === undefined || atom.color === undefined || atom.color.getHexString().toUpperCase() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
119686
119686
  let color =(atom !== undefined && atom.color !== undefined) ? colorStr : '000000';
119687
119687
 
119688
- if(bNucleotide) {
119688
+ if(bNucleotide && atom) {
119689
119689
  // Handle nucleotide-specific logic
119690
119690
  if(ic.nucleotides.hasOwnProperty(atom.serial) && name != 'nucleotides' && !ic.structures.hasOwnProperty(name)) {
119691
119691
  html += "<option value='" + name + "' style='color:#" + color + "'>" + name + "</option>";
119692
119692
  bFoundNucleotide = true;
119693
119693
  }
119694
119694
  }
119695
- else if(bProtein) {
119695
+ else if(bProtein && atom) {
119696
119696
  // Handle protein-specific logic
119697
119697
  if(ic.proteins.hasOwnProperty(atom.serial) && name != 'proteins' && !ic.structures.hasOwnProperty(name)) {
119698
119698
  html += "<option value='" + name + "' style='color:#" + color + "'>" + name + "</option>";
@@ -128433,7 +128433,7 @@ class Diagram2d {
128433
128433
 
128434
128434
  let igArray = ic.chain2igArray[chainid];
128435
128435
 
128436
- let igType = '', bFound = false;
128436
+ let igTypeArray = [], bFound = false;
128437
128437
  for(let i = 0, il = igArray.length; i < il; ++i) {
128438
128438
  let domainid = igArray[i].domainid;
128439
128439
  if(!ic.domainid2info) continue;
@@ -128441,11 +128441,14 @@ class Diagram2d {
128441
128441
  let info = ic.domainid2info[domainid];
128442
128442
  if(!info) continue;
128443
128443
 
128444
- igType = ic.ref2igtype[info.refpdbname];
128444
+ let igType = ic.ref2igtype[info.refpdbname];
128445
128445
 
128446
128446
  if(igType == 'IgV' || igType == 'IgC1' || igType == 'IgC2' || igType == 'IgI') {
128447
128447
  bFound = true;
128448
- break;
128448
+ igTypeArray.push(igType);
128449
+ }
128450
+ else {
128451
+ igTypeArray.push('');
128449
128452
  }
128450
128453
  }
128451
128454
 
@@ -128464,10 +128467,12 @@ class Diagram2d {
128464
128467
  let resn = me.utilsCls.residueName2Abbr(atom.resn);
128465
128468
 
128466
128469
  let refnumStr, refnumLabel = ic.resid2refnum[resid];
128470
+ let domainid = ic.resid2domainid[resid];
128467
128471
 
128468
128472
  if(refnumLabel) {
128469
128473
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
128470
- refnum2resn[refnumStr] = resn;
128474
+ if(!refnum2resn[domainid]) refnum2resn[domainid] = {};
128475
+ refnum2resn[domainid][refnumStr] = resn;
128471
128476
  }
128472
128477
  }
128473
128478
 
@@ -128478,32 +128483,50 @@ class Diagram2d {
128478
128483
  ic.bXlsx = true;
128479
128484
  }
128480
128485
 
128481
- let url = "/Structure/icn3d/template/igstrand_template_" + igType + ".xlsx";
128482
- let arrayBuffer = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'xlsx');
128486
+ const mainWorkbook = new ExcelJS.Workbook();
128483
128487
 
128484
- const workbook = new ExcelJS.Workbook();
128485
- // Load the workbook from the buffer
128486
- await workbook.xlsx.load(arrayBuffer);
128487
- const worksheet = workbook.getWorksheet(1);
128488
+ for(let i = 0, il = igArray.length; i < il; ++i) {
128489
+ let domainid = igArray[i].domainid;
128490
+ let igType = igTypeArray[i];
128491
+ if(!igType) {
128492
+ mainWorkbook.addWorksheet(`Sheet_${i + 1}`);
128493
+ }
128494
+ else {
128495
+ let url = "/Structure/icn3d/template/igstrand_template_" + igType + ".xlsx";
128496
+ let arrayBuffer = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'xlsx');
128497
+
128498
+ const workbook = new ExcelJS.Workbook();
128499
+ // Load the workbook from the buffer
128500
+ await workbook.xlsx.load(arrayBuffer);
128501
+ const worksheet = workbook.getWorksheet(1);
128502
+
128503
+ const newSheet = mainWorkbook.addWorksheet();
128504
+ // Clone the model to transfer styles and data
128505
+ newSheet.model = {
128506
+ ...worksheet.model,
128507
+ name: "Ig Domain " + (i + 1)
128508
+ };
128488
128509
 
128489
- // Iterate over all rows that have values
128490
- worksheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
128491
- // Iterate over all cells in the row
128492
- row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
128493
- //console.log(`Cell [${rowNumber}, ${colNumber}] = ${cell.value}`);
128494
- if (cell.value && !isNaN(cell.value) && cell.value > 1000 && cell.value < 10000) {
128495
- if(refnum2resn.hasOwnProperty(cell.value)) {
128496
- cell.value = refnum2resn[cell.value];
128497
- }
128498
- else {
128499
- cell.value = '';
128500
- }
128501
- }
128502
- });
128503
- });
128510
+ // Iterate over all rows that have values
128511
+ newSheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
128512
+ // Iterate over all cells in the row
128513
+ row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
128514
+ //console.log(`Cell [${rowNumber}, ${colNumber}] = ${cell.value}`);
128515
+ if (cell.value && !isNaN(cell.value) && cell.value > 1000 && cell.value < 10000) {
128516
+ if(refnum2resn[domainid].hasOwnProperty(cell.value)) {
128517
+ cell.value = refnum2resn[domainid][cell.value];
128518
+ }
128519
+ else {
128520
+ cell.value = '';
128521
+ }
128522
+ }
128523
+ });
128524
+ });
128525
+ }
128526
+ }
128504
128527
 
128505
128528
  // Generate the workbook as a Buffer
128506
- const data = await workbook.xlsx.writeBuffer();
128529
+ const data = await mainWorkbook.xlsx.writeBuffer();
128507
128530
 
128508
128531
  // Access the underlying ArrayBuffer
128509
128532
  ic.saveFileCls.saveFile(ic.inputid + '_ig_diagram.xlsx', 'xlsx', data);
@@ -134777,7 +134800,7 @@ class iCn3DUI {
134777
134800
  //even when multiple iCn3D viewers are shown together.
134778
134801
  this.pre = this.cfg.divid + "_";
134779
134802
 
134780
- this.REVISION = '3.49.0';
134803
+ this.REVISION = '3.49.1';
134781
134804
 
134782
134805
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
134783
134806
  this.bNode = (Object.keys(window).length < 3) ? true : false;