icn3d 3.26.7 → 3.26.8

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
@@ -6932,6 +6932,21 @@ class ClickMenu {
6932
6932
  thisClass.setLogCmd("export pdb hydrogen", true);
6933
6933
  });
6934
6934
 
6935
+ me.myEventCls.onIds("#" + me.pre + "m1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6936
+ ic.refnumCls.exportRefnum('igstrand');
6937
+ thisClass.setLogCmd("export refnum igstrand", true);
6938
+ });
6939
+
6940
+ me.myEventCls.onIds("#" + me.pre + "m1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6941
+ ic.refnumCls.exportRefnum('kabat');
6942
+ thisClass.setLogCmd("export refnum kabat", true);
6943
+ });
6944
+
6945
+ me.myEventCls.onIds("#" + me.pre + "m1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6946
+ ic.refnumCls.exportRefnum('imgt');
6947
+ thisClass.setLogCmd("export refnum imgt", true);
6948
+ });
6949
+
6935
6950
  me.myEventCls.onIds("#" + me.pre + "mn1_exportStl", "click", function(e) { let ic = me.icn3d; //e.preventDefault();
6936
6951
  thisClass.setLogCmd("export stl file", false);
6937
6952
  //ic.threeDPrintCls.hideStabilizer();
@@ -9504,6 +9519,16 @@ class SetMenu {
9504
9519
  html += this.getLink('mn1_exportSecondary', 'Secondary Structure', undefined, 2);
9505
9520
  }
9506
9521
 
9522
+ //!!!
9523
+ /*
9524
+ html += this.getMenuText('m1_exportrefnum', 'Reference Numbers', undefined, undefined, 2);
9525
+ html += "<ul>";
9526
+ html += this.getLink('mn1_exportIgstrand', 'Ig Strand', undefined, 3);
9527
+ html += this.getLink('mn1_exportKabat', 'Kabat', undefined, 3);
9528
+ html += this.getLink('mn1_exportImgt', 'IMGT', undefined, 3);
9529
+ html += "</ul>";
9530
+ */
9531
+
9507
9532
  html += "<li><br/></li>";
9508
9533
 
9509
9534
  html += "</ul>";
@@ -13760,7 +13785,7 @@ class Events {
13760
13785
  if(esmfold_fasta.indexOf('>') != -1) { //FASTA with header
13761
13786
  let pos = esmfold_fasta.indexOf('\n');
13762
13787
  ic.esmTitle = esmfold_fasta.substr(1, pos - 1).trim();
13763
- pdbid = ic.esmTitle.substr(0, ic.esmTitle.indexOf(' '));
13788
+ pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
13764
13789
  if(pdbid.length < 6) pdbid = pdbid.padEnd(6, '-');
13765
13790
 
13766
13791
  esmfold_fasta = esmfold_fasta.substr(pos + 1);
@@ -42993,6 +43018,7 @@ class ShowSeq {
42993
43018
  break;
42994
43019
  }
42995
43020
  }
43021
+
42996
43022
  if(kabat_or_imgt == 1 && !bKabatFound) {
42997
43023
  return {html: '', html3: ''};
42998
43024
  }
@@ -45336,9 +45362,14 @@ class LineGraph {
45336
45362
  domainAtomsArray.push(currAtoms);
45337
45363
 
45338
45364
  let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
45365
+
45366
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(currAtoms);
45367
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(currAtoms);
45368
+ let resiSum = parseInt(atomFirst.resi) + parseInt(atomLast.resi);
45369
+
45339
45370
  for(let n = 0, nl = residueArray.length; n < nl; ++n) {
45340
45371
  let resid = residueArray[n];
45341
- ic.resid2domainid[resid] = chainid + '-0' + '_' + Object.keys(currAtoms).length;
45372
+ ic.resid2domainid[resid] = chainid + '-0' + '_' + resiSum;
45342
45373
  }
45343
45374
  }
45344
45375
  else {
@@ -45358,13 +45389,17 @@ class LineGraph {
45358
45389
 
45359
45390
  domainAtomsArray.push(domainAtoms);
45360
45391
 
45392
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtoms);
45393
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtoms);
45394
+ let resiSum = parseInt(atomFirst.resi) + parseInt(atomLast.resi);
45395
+
45361
45396
  for(let m = 0, ml = segArray.length; m < ml; m += 2) {
45362
45397
  let startResi = segArray[m];
45363
45398
  let endResi = segArray[m+1];
45364
45399
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
45365
45400
  let resid = chainid + '_' + pos2resi[n];
45366
45401
  //domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
45367
- ic.resid2domainid[resid] = chainid + '-' + k + '_' + Object.keys(domainAtoms).length;
45402
+ ic.resid2domainid[resid] = chainid + '-' + k + '_' + resiSum;
45368
45403
  }
45369
45404
  }
45370
45405
  }
@@ -45404,7 +45439,7 @@ class LineGraph {
45404
45439
  // dataArray2 = await allPromise;
45405
45440
 
45406
45441
  //split arrays into chunks of 100 jobs
45407
- let n = (me.bNode) ? 16 : 96;
45442
+ let n = (me.bNode) ? 96 : 96;
45408
45443
 
45409
45444
  for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
45410
45445
  let currAjaxArray = [];
@@ -45627,6 +45662,8 @@ class LineGraph {
45627
45662
  if(!ic.resid2refnum) ic.resid2refnum = {};
45628
45663
  if(!ic.refnum2residArray) ic.refnum2residArray = {};
45629
45664
  if(!ic.chainsMapping) ic.chainsMapping = {};
45665
+
45666
+ if(!ic.refPdbList) ic.refPdbList = [];
45630
45667
  for(let chainid in chainid2segs) {
45631
45668
  let segArray = chainid2segs[chainid];
45632
45669
 
@@ -45635,7 +45672,8 @@ class LineGraph {
45635
45672
  let chainList = this.getTemplateList(chainid);
45636
45673
 
45637
45674
  //if(!me.bNode) console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
45638
- console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
45675
+ if(!me.bNode) console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
45676
+ ic.refPdbList.push("The reference PDB(s) for chain " + chainid + " are " + chainList);
45639
45677
 
45640
45678
  let prevStrand;
45641
45679
  let bCd19 = refpdbnameArray.length == 1 && refpdbnameArray[0] == 'CD19_6al5A_human_C2orV-n1';
@@ -45818,9 +45856,121 @@ class LineGraph {
45818
45856
  ic.annotationCls.setAnnoViewAndDisplay('detailed view');
45819
45857
  }
45820
45858
 
45821
- rmStrandFromRefnumlabel(refnumLabel) {
45859
+ rmStrandFromRefnumlabel(refnumLabel) { let ic = this.icn3d; ic.icn3dui;
45822
45860
  return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
45823
45861
  }
45862
+
45863
+ exportRefnum(type) { let ic = this.icn3d, me = ic.icn3dui;
45864
+ let refData = '';
45865
+
45866
+ // 1. show IgStrand ref numbers
45867
+ if(type == 'igstrand' || type == 'IgStrand') {
45868
+ // iGStrand reference numbers were adjusted when showing in sequences
45869
+ if(me.bNode) {
45870
+ for(let chnid in ic.chains) {
45871
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
45872
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
45873
+ let giSeq = [];
45874
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
45875
+ giSeq.push(ic.chainsSeq[chnid][i].name);
45876
+ }
45877
+ ic.showSeqCls.showRefNum(giSeq, chnid);
45878
+ }
45879
+ }
45880
+ }
45881
+
45882
+ let resid2refnum = {};
45883
+ for(let resid in ic.resid2refnum) {
45884
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45885
+ if(!atom) continue;
45886
+
45887
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45888
+
45889
+ let domainid = ic.resid2domainid[resid];
45890
+ let refnumLabel = ic.resid2refnum[resid];
45891
+
45892
+ if(refnumLabel) {
45893
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45894
+ (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
45895
+ }
45896
+
45897
+ if(ic.resid2refnum[resid]) {
45898
+ if(ic.residIgLoop.hasOwnProperty(resid)) { // loop
45899
+ resid2refnum[resid + '_' + resn] = ic.resid2refnum[resid] + '_loop';
45900
+ }
45901
+ else {
45902
+ resid2refnum[resid + '_' + resn] = ic.resid2refnum[resid];
45903
+ }
45904
+ }
45905
+ }
45906
+
45907
+ refData += '{"ref PDB" : ' + JSON.stringify(ic.refPdbList) + ",\n";
45908
+
45909
+ refData += '"data": {\n';
45910
+ for(let chnid in ic.chains) {
45911
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
45912
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
45913
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
45914
+ const resid = chnid + '_' + ic.chainsSeq[chnid][i].resi + '_' + ic.chainsSeq[chnid][i].name;
45915
+
45916
+ refData += "'" + resid + "': '" + resid2refnum[resid] + "',\n";
45917
+ }
45918
+ }
45919
+ }
45920
+ refData += '}\n';
45921
+ refData += '}\n';
45922
+ }
45923
+ // 2. show Kabat ref numbers
45924
+ else if(type == 'kabat' || type == 'Kabat') {
45925
+ let resid2kabat = {};
45926
+ for(let resid in ic.resid2refnum) {
45927
+ let domainid = ic.resid2domainid[resid];
45928
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
45929
+
45930
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45931
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45932
+
45933
+ if(refnumLabel) {
45934
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45935
+ refnumStr = (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
45936
+ }
45937
+
45938
+ resid2kabat[resid + '_' + resn] = refnumStr;
45939
+ }
45940
+
45941
+ refData += JSON.stringify(resid2kabat);
45942
+ }
45943
+ // 3. show IMGT ref numbers
45944
+ else if(type == 'imgt'|| type == 'IMGT') {
45945
+ let resid2imgt = {};
45946
+ for(let resid in ic.resid2refnum) {
45947
+ let domainid = ic.resid2domainid[resid];
45948
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
45949
+
45950
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45951
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45952
+
45953
+ if(refnumLabel) {
45954
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45955
+ refnumStr = (ic.domainid2ig2imgt[domainid]) ? ic.domainid2ig2imgt[domainid][refnumStr_ori] : undefined;
45956
+ }
45957
+
45958
+ resid2imgt[resid + '_' + resn] = refnumStr;
45959
+ }
45960
+
45961
+ refData += JSON.stringify(resid2imgt);
45962
+ }
45963
+
45964
+
45965
+ if(!me.bNode) {
45966
+ let file_pref = Object.keys(me.utilsCls.getHlStructures()).join(',');
45967
+
45968
+ ic.saveFileCls.saveFile(file_pref + '_refnum_' + type + '.txt', 'text', [refData]);
45969
+ }
45970
+ else {
45971
+ return refData;
45972
+ }
45973
+ }
45824
45974
  }
45825
45975
 
45826
45976
  /**
@@ -58355,6 +58505,11 @@ class ApplyCommand {
58355
58505
  else if(command == 'export pdb hydrogen') {
58356
58506
  await ic.scapCls.exportPdbProfix(true);
58357
58507
  }
58508
+ else if(command.indexOf('export refnum ') != -1) {
58509
+ let type = command.substr(14);
58510
+
58511
+ ic.refnumCls.exportRefnum(type);
58512
+ }
58358
58513
  else if(command == 'export secondary structure') {
58359
58514
  me.htmlCls.setHtmlCls.exportSecondary();
58360
58515
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.26.7",
3
+ "version": "3.26.8",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {