icn3d 3.49.0 → 3.49.1

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
@@ -120586,14 +120586,14 @@ class DefinedSets {
120586
120586
  let colorStr =(atom === undefined || atom.color === undefined || atom.color.getHexString().toUpperCase() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
120587
120587
  let color =(atom !== undefined && atom.color !== undefined) ? colorStr : '000000';
120588
120588
 
120589
- if(bNucleotide) {
120589
+ if(bNucleotide && atom) {
120590
120590
  // Handle nucleotide-specific logic
120591
120591
  if(ic.nucleotides.hasOwnProperty(atom.serial) && name != 'nucleotides' && !ic.structures.hasOwnProperty(name)) {
120592
120592
  html += "<option value='" + name + "' style='color:#" + color + "'>" + name + "</option>";
120593
120593
  bFoundNucleotide = true;
120594
120594
  }
120595
120595
  }
120596
- else if(bProtein) {
120596
+ else if(bProtein && atom) {
120597
120597
  // Handle protein-specific logic
120598
120598
  if(ic.proteins.hasOwnProperty(atom.serial) && name != 'proteins' && !ic.structures.hasOwnProperty(name)) {
120599
120599
  html += "<option value='" + name + "' style='color:#" + color + "'>" + name + "</option>";
@@ -129334,7 +129334,7 @@ class Diagram2d {
129334
129334
 
129335
129335
  let igArray = ic.chain2igArray[chainid];
129336
129336
 
129337
- let igType = '', bFound = false;
129337
+ let igTypeArray = [], bFound = false;
129338
129338
  for(let i = 0, il = igArray.length; i < il; ++i) {
129339
129339
  let domainid = igArray[i].domainid;
129340
129340
  if(!ic.domainid2info) continue;
@@ -129342,11 +129342,14 @@ class Diagram2d {
129342
129342
  let info = ic.domainid2info[domainid];
129343
129343
  if(!info) continue;
129344
129344
 
129345
- igType = ic.ref2igtype[info.refpdbname];
129345
+ let igType = ic.ref2igtype[info.refpdbname];
129346
129346
 
129347
129347
  if(igType == 'IgV' || igType == 'IgC1' || igType == 'IgC2' || igType == 'IgI') {
129348
129348
  bFound = true;
129349
- break;
129349
+ igTypeArray.push(igType);
129350
+ }
129351
+ else {
129352
+ igTypeArray.push('');
129350
129353
  }
129351
129354
  }
129352
129355
 
@@ -129365,10 +129368,12 @@ class Diagram2d {
129365
129368
  let resn = me.utilsCls.residueName2Abbr(atom.resn);
129366
129369
 
129367
129370
  let refnumStr, refnumLabel = ic.resid2refnum[resid];
129371
+ let domainid = ic.resid2domainid[resid];
129368
129372
 
129369
129373
  if(refnumLabel) {
129370
129374
  refnumStr = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
129371
- refnum2resn[refnumStr] = resn;
129375
+ if(!refnum2resn[domainid]) refnum2resn[domainid] = {};
129376
+ refnum2resn[domainid][refnumStr] = resn;
129372
129377
  }
129373
129378
  }
129374
129379
 
@@ -129379,32 +129384,50 @@ class Diagram2d {
129379
129384
  ic.bXlsx = true;
129380
129385
  }
129381
129386
 
129382
- let url = "/Structure/icn3d/template/igstrand_template_" + igType + ".xlsx";
129383
- let arrayBuffer = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'xlsx');
129387
+ const mainWorkbook = new ExcelJS.Workbook();
129384
129388
 
129385
- const workbook = new ExcelJS.Workbook();
129386
- // Load the workbook from the buffer
129387
- await workbook.xlsx.load(arrayBuffer);
129388
- const worksheet = workbook.getWorksheet(1);
129389
+ for(let i = 0, il = igArray.length; i < il; ++i) {
129390
+ let domainid = igArray[i].domainid;
129391
+ let igType = igTypeArray[i];
129392
+ if(!igType) {
129393
+ mainWorkbook.addWorksheet(`Sheet_${i + 1}`);
129394
+ }
129395
+ else {
129396
+ let url = "/Structure/icn3d/template/igstrand_template_" + igType + ".xlsx";
129397
+ let arrayBuffer = await me.getXMLHttpRqstPromise(url, 'GET', 'arraybuffer', 'xlsx');
129398
+
129399
+ const workbook = new ExcelJS.Workbook();
129400
+ // Load the workbook from the buffer
129401
+ await workbook.xlsx.load(arrayBuffer);
129402
+ const worksheet = workbook.getWorksheet(1);
129403
+
129404
+ const newSheet = mainWorkbook.addWorksheet();
129405
+ // Clone the model to transfer styles and data
129406
+ newSheet.model = {
129407
+ ...worksheet.model,
129408
+ name: "Ig Domain " + (i + 1)
129409
+ };
129389
129410
 
129390
- // Iterate over all rows that have values
129391
- worksheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
129392
- // Iterate over all cells in the row
129393
- row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
129394
- //console.log(`Cell [${rowNumber}, ${colNumber}] = ${cell.value}`);
129395
- if (cell.value && !isNaN(cell.value) && cell.value > 1000 && cell.value < 10000) {
129396
- if(refnum2resn.hasOwnProperty(cell.value)) {
129397
- cell.value = refnum2resn[cell.value];
129398
- }
129399
- else {
129400
- cell.value = '';
129401
- }
129402
- }
129403
- });
129404
- });
129411
+ // Iterate over all rows that have values
129412
+ newSheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
129413
+ // Iterate over all cells in the row
129414
+ row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
129415
+ //console.log(`Cell [${rowNumber}, ${colNumber}] = ${cell.value}`);
129416
+ if (cell.value && !isNaN(cell.value) && cell.value > 1000 && cell.value < 10000) {
129417
+ if(refnum2resn[domainid].hasOwnProperty(cell.value)) {
129418
+ cell.value = refnum2resn[domainid][cell.value];
129419
+ }
129420
+ else {
129421
+ cell.value = '';
129422
+ }
129423
+ }
129424
+ });
129425
+ });
129426
+ }
129427
+ }
129405
129428
 
129406
129429
  // Generate the workbook as a Buffer
129407
- const data = await workbook.xlsx.writeBuffer();
129430
+ const data = await mainWorkbook.xlsx.writeBuffer();
129408
129431
 
129409
129432
  // Access the underlying ArrayBuffer
129410
129433
  ic.saveFileCls.saveFile(ic.inputid + '_ig_diagram.xlsx', 'xlsx', data);
@@ -135678,7 +135701,7 @@ class iCn3DUI {
135678
135701
  //even when multiple iCn3D viewers are shown together.
135679
135702
  this.pre = this.cfg.divid + "_";
135680
135703
 
135681
- this.REVISION = '3.49.0';
135704
+ this.REVISION = '1';
135682
135705
 
135683
135706
  // In nodejs, iCn3D defines "window = {navigator: {}}", and added window = {navigator: {}, "__THREE__":"177"}
135684
135707
  this.bNode = (Object.keys(window).length < 3) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.49.0",
3
+ "version": "3.49.1",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {