icn3d 3.26.8 → 3.26.9

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
@@ -6031,17 +6031,17 @@ class ClickMenu {
6031
6031
  thisClass.setLogCmd("export pdb hydrogen", true);
6032
6032
  });
6033
6033
 
6034
- me.myEventCls.onIds("#" + me.pre + "m1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6034
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6035
6035
  ic.refnumCls.exportRefnum('igstrand');
6036
6036
  thisClass.setLogCmd("export refnum igstrand", true);
6037
6037
  });
6038
6038
 
6039
- me.myEventCls.onIds("#" + me.pre + "m1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6039
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6040
6040
  ic.refnumCls.exportRefnum('kabat');
6041
6041
  thisClass.setLogCmd("export refnum kabat", true);
6042
6042
  });
6043
6043
 
6044
- me.myEventCls.onIds("#" + me.pre + "m1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6044
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6045
6045
  ic.refnumCls.exportRefnum('imgt');
6046
6046
  thisClass.setLogCmd("export refnum imgt", true);
6047
6047
  });
@@ -44537,8 +44537,8 @@ class LineGraph {
44537
44537
  // let allPromise = Promise.allSettled(ajaxArray);
44538
44538
  // dataArray2 = await allPromise;
44539
44539
 
44540
- //split arrays into chunks of 100 jobs
44541
- let n = (me.bNode) ? 96 : 96;
44540
+ //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
44541
+ let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
44542
44542
 
44543
44543
  for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
44544
44544
  let currAjaxArray = [];
@@ -44638,6 +44638,8 @@ class LineGraph {
44638
44638
  let refpdbname = domainidpairArray[i].substr(domainidpairArray[i].indexOf('|') + 1);
44639
44639
  //let chainid = domainid.split('-')[0];
44640
44640
 
44641
+ if(!me.bNode) console.log("refpdbname " + refpdbname + " TM-score: " + queryData[0].score);
44642
+
44641
44643
  // Ig-like domains: B (2150, 2150a, 2150b), C (3150, 3250), E (7150, 7250), F (8150, 8250) strands
44642
44644
  // Ig domain may require G (7050). But we'll leave that out for now.
44643
44645
  let bBstrand = false, bCstrand = false, bEstrand = false, bFstrand = false;
@@ -48411,7 +48413,7 @@ class ChainalignParser {
48411
48413
  let chainid = chainidArray[i];
48412
48414
  let pos = chainid.indexOf('_');
48413
48415
  let struct = chainid.substr(0, pos);
48414
- if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
48416
+ //if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
48415
48417
 
48416
48418
  if(!struct2cnt.hasOwnProperty(struct)) {
48417
48419
  struct2cnt[struct] = 1;
@@ -51661,7 +51663,7 @@ class RealignParser {
51661
51663
  let pos = chainidArray[i].indexOf('_');
51662
51664
  let mmdbid = chainidArray[i].substr(0, pos); //.toUpperCase();
51663
51665
 
51664
- if(!bRealign) mmdbid = mmdbid.toUpperCase();
51666
+ // if(!bRealign) mmdbid = mmdbid.toUpperCase();
51665
51667
 
51666
51668
  if(i == 0) {
51667
51669
  mmdbid_t = mmdbid;
@@ -51840,14 +51842,12 @@ class RealignParser {
51840
51842
  for(let j = 0, jl = resiArray.length; j < jl; ++j) {
51841
51843
  if(resiArray[j].indexOf('-') != -1) {
51842
51844
  let startEnd = resiArray[j].split('-');
51843
-
51844
51845
  for(let k = parseInt(startEnd[0]); k <= parseInt(startEnd[1]); ++k) {
51845
51846
  // from VAST neighbor page, use NCBI residue number
51846
51847
  //if(me.cfg.usepdbnum === false) k += base - 1;
51847
51848
 
51848
51849
  //let seqIndex = k - base;
51849
51850
  let seqIndex = ic.setSeqAlignCls.getPosFromResi(chainid, k);
51850
-
51851
51851
  // if(ic.bNCBI) {
51852
51852
  // let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chainid + '_' + k]);
51853
51853
  // if(atom && atom.resiNCBI) seqIndex = atom.resiNCBI - 1;
@@ -51864,9 +51864,9 @@ class RealignParser {
51864
51864
  }
51865
51865
  }
51866
51866
  else { // one residue
51867
+
51867
51868
  //let k = parseInt(resiArray[j]);
51868
51869
  let k = resiArray[j];
51869
-
51870
51870
  // from VAST neighbor page, use NCBI residue number
51871
51871
  //if(me.cfg.usepdbnum === false) k += base - 1;
51872
51872
 
@@ -54790,22 +54790,23 @@ class SetSeqAlign {
54790
54790
  }
54791
54791
 
54792
54792
  getPosFromResi(chainid, resi) { let ic = this.icn3d; ic.icn3dui;
54793
- /*
54794
- let pos = undefined; //parseInt(resi);
54795
-
54796
- for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
54797
- if(ic.chainsSeq[chainid][i].resi == resi) {
54798
- pos = i;
54799
- break;
54800
- }
54801
- }
54802
- */
54803
54793
  let residNCBI = ic.resid2ncbi[chainid + '_' + resi];
54804
54794
  let pos = undefined;
54795
+
54805
54796
  if(residNCBI) {
54806
54797
  let resiNCBI = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
54807
54798
  pos = resiNCBI - 1;
54808
54799
  }
54800
+ // else {
54801
+ // //let il = ic.chainsSeq[chainid].length;
54802
+ // let il = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid].length : 0;
54803
+ // for(let i = 0; i < il; ++i) {
54804
+ // if(ic.chainsSeq[chainid][i].resi == resi) {
54805
+ // pos = i;
54806
+ // break;
54807
+ // }
54808
+ // }
54809
+ // }
54809
54810
 
54810
54811
  return pos;
54811
54812
  }
@@ -56264,6 +56265,7 @@ class LoadPDB {
56264
56265
 
56265
56266
  // different residue
56266
56267
  //if(residueNum !== prevResidueNum) {
56268
+
56267
56269
  if(oriResidueNum !== prevOriResidueNum) {
56268
56270
  let residue = me.utilsCls.residueName2Abbr(resn);
56269
56271
  ic.residueId2Name[residueNum] = residue;
@@ -67461,6 +67463,26 @@ class SaveFile {
67461
67463
  return html;
67462
67464
  }
67463
67465
 
67466
+ printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt) { let ic = this.icn3d; ic.icn3dui;
67467
+ let ssText = '';
67468
+
67469
+ // print prev
67470
+ if(prevRealSsObj) {
67471
+ if(bHelix) {
67472
+ let helixType = 1;
67473
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67474
+ + prevRealSsObj.resi.toString().padStart(5, ' ') + ' ' + helixType + ssCnt.toString().padStart(36, ' ') + '\n';
67475
+ }
67476
+ else if(bSheet) {
67477
+ let sense = 0;
67478
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67479
+ + prevRealSsObj.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
67480
+ }
67481
+ }
67482
+
67483
+ return ssText;
67484
+ }
67485
+
67464
67486
  //getAtomPDB: function(atomHash, bPqr, bPdb, bNoChem) { let ic = this.icn3d, me = ic.icn3dui;
67465
67487
  getAtomPDB(atomHash, bPqr, bNoChem, bNoHeader, chainResi2pdb, pdbid) { let ic = this.icn3d, me = ic.icn3dui;
67466
67488
  let pdbStr = '';
@@ -67493,8 +67515,6 @@ class SaveFile {
67493
67515
 
67494
67516
  let calphaHash = me.hashUtilsCls.intHash(atomHash, ic.calphas);
67495
67517
  let helixStr = 'HELIX', sheetStr = 'SHEET';
67496
- let bHelixBegin = false, bHelixEnd = true;
67497
- let bSheetBegin = false, bSheetEnd = true;
67498
67518
 
67499
67519
  let stru2header = {};
67500
67520
  for(let stru in ic.structures) {
@@ -67502,48 +67522,82 @@ class SaveFile {
67502
67522
  }
67503
67523
 
67504
67524
  // if(!bNoSs) {
67505
- let prevResi, stru, chainid;
67525
+ let prevResi, stru;
67526
+ let ssArray = [];
67506
67527
  for(let i in calphaHash) {
67507
67528
  let atom = ic.atoms[i];
67508
67529
  stru = atom.structure;
67509
- chainid = atom.structure + '_' + atom.chain;
67530
+ atom.structure + '_' + atom.chain;
67510
67531
 
67511
- if(atom.ssbegin) {
67512
- if(atom.ss == 'helix') {
67513
- bHelixBegin = true;
67514
- if(bHelixEnd) stru2header[stru] += helixStr.padEnd(15, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67515
- + atom.resi.toString().padStart(5, ' ');
67516
- bHelixEnd = false;
67517
- prevResi = atom.resi;
67518
- }
67519
- else if(atom.ss == 'sheet') {
67520
- bSheetBegin = true;
67521
- if(bSheetEnd) stru2header[stru] += sheetStr.padEnd(17, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67522
- + atom.resi.toString().padStart(4, ' ');
67523
- bSheetEnd = false;
67524
- }
67532
+ let ssObj = {};
67533
+ ssObj.chain = atom.chain;
67534
+ ssObj.resn = atom.resn;
67535
+ ssObj.resi = atom.resi;
67536
+
67537
+ if(parseInt(atom.resi) > parseInt(prevResi) + 1) {
67538
+ ssObj.ss = ' ';
67539
+ ssArray.push(ssObj);
67540
+ }
67541
+
67542
+ if(atom.ss == 'helix') {
67543
+ ssObj.ss = 'H';
67544
+ ssArray.push(ssObj);
67545
+ }
67546
+ else if(atom.ss == 'sheet') {
67547
+ ssObj.ss = 'S';
67548
+ ssArray.push(ssObj);
67525
67549
  }
67526
67550
 
67527
67551
  if(atom.ssend) {
67528
- if(atom.ss == 'helix') {
67529
- bHelixEnd = true;
67530
- let residEnd = ic.resid2ncbi[chainid + '_' + atom.resi];
67531
- let residStart = ic.resid2ncbi[chainid + '_' + prevResi];
67532
- let helixLen = (residEnd && residStart) ? parseInt(residEnd.substr(residEnd.lastIndexOf('_') + 1)) - parseInt(residStart.substr(residStart.lastIndexOf('_') + 1)) : 0;
67533
- let helixType = 1;
67534
- if(bHelixBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67535
- + atom.resi.toString().padStart(5, ' ') + ' ' + helixType + helixLen.toString().padStart(36, ' ') + '\n';
67536
- bHelixBegin = false;
67537
- }
67538
- else if(atom.ss == 'sheet') {
67539
- bSheetEnd = true;
67540
- let sense = 0;
67541
- if(bSheetBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67542
- + atom.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
67543
- bSheetBegin = false;
67552
+ let ssObj2 = me.hashUtilsCls.cloneHash(ssObj);
67553
+ ssObj2.ss = ' ';
67554
+ ssArray.push(ssObj2);
67555
+ }
67556
+
67557
+ prevResi = atom.resi;
67558
+ }
67559
+
67560
+ let prevSs, prevRealSsObj, ssCnt = 0, bHelix = false, bSheet = false;
67561
+ for(let i = 0, il = ssArray.length; i < il; ++i) {
67562
+ let ssObj = ssArray[i];
67563
+
67564
+ if(ssObj.ss != prevSs) {
67565
+ // print prev
67566
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
67567
+
67568
+ // print current
67569
+ ssCnt = 0;
67570
+ bHelix = false;
67571
+ bSheet = false;
67572
+ prevRealSsObj = undefined;
67573
+
67574
+ if(ssObj.ss != ' ') {
67575
+ if(ssObj.ss == 'H') {
67576
+ bHelix = true;
67577
+ prevRealSsObj = ssObj;
67578
+ stru2header[stru] += helixStr.padEnd(15, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67579
+ + ssObj.resi.toString().padStart(5, ' ');
67580
+ }
67581
+ else if(ssObj.ss == 'S') {
67582
+ bSheet = true;
67583
+ prevRealSsObj = ssObj;
67584
+ stru2header[stru] += sheetStr.padEnd(17, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67585
+ + ssObj.resi.toString().padStart(4, ' ');
67586
+ }
67544
67587
  }
67545
67588
  }
67589
+
67590
+ if(ssObj.ss != ' ') {
67591
+ ++ssCnt;
67592
+ prevRealSsObj = ssObj;
67593
+ }
67594
+
67595
+ prevSs = ssObj.ss;
67546
67596
  }
67597
+
67598
+ // print prev
67599
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
67600
+
67547
67601
  // add a new line in case the structure is a subset
67548
67602
  stru2header[stru] += '\n';
67549
67603
  // }
@@ -67974,7 +68028,7 @@ class SaveFile {
67974
68028
  let structureidArray = Object.keys(idHash);
67975
68029
  inputid = structureidArray.join(',');
67976
68030
 
67977
- text = inputid.toUpperCase();
68031
+ text = (me.cfg.refseqid) ? ic.inputid : inputid.toUpperCase();
67978
68032
 
67979
68033
  //idName = (isNaN(inputid) && inputid.length > 5) ? "AlphaFold ID" : "PDB ID";
67980
68034
  if(bPdb && bAlphaFold) {
@@ -71464,6 +71518,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
71464
71518
  }
71465
71519
  else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
71466
71520
  let stru_t = Object.keys(ic.structures)[0];
71521
+
71467
71522
  let chain_t = stru_t + '_' + me.cfg.masterchain;
71468
71523
  let domainidArray = me.cfg.matchedchains.split(',');
71469
71524
  let chainidArray = [];