icn3d 3.26.6 → 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.js CHANGED
@@ -6031,6 +6031,21 @@ 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();
6035
+ ic.refnumCls.exportRefnum('igstrand');
6036
+ thisClass.setLogCmd("export refnum igstrand", true);
6037
+ });
6038
+
6039
+ me.myEventCls.onIds("#" + me.pre + "m1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6040
+ ic.refnumCls.exportRefnum('kabat');
6041
+ thisClass.setLogCmd("export refnum kabat", true);
6042
+ });
6043
+
6044
+ me.myEventCls.onIds("#" + me.pre + "m1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6045
+ ic.refnumCls.exportRefnum('imgt');
6046
+ thisClass.setLogCmd("export refnum imgt", true);
6047
+ });
6048
+
6034
6049
  me.myEventCls.onIds("#" + me.pre + "mn1_exportStl", "click", function(e) { let ic = me.icn3d; //e.preventDefault();
6035
6050
  thisClass.setLogCmd("export stl file", false);
6036
6051
  //ic.threeDPrintCls.hideStabilizer();
@@ -8603,6 +8618,16 @@ class SetMenu {
8603
8618
  html += this.getLink('mn1_exportSecondary', 'Secondary Structure', undefined, 2);
8604
8619
  }
8605
8620
 
8621
+ //!!!
8622
+ /*
8623
+ html += this.getMenuText('m1_exportrefnum', 'Reference Numbers', undefined, undefined, 2);
8624
+ html += "<ul>";
8625
+ html += this.getLink('mn1_exportIgstrand', 'Ig Strand', undefined, 3);
8626
+ html += this.getLink('mn1_exportKabat', 'Kabat', undefined, 3);
8627
+ html += this.getLink('mn1_exportImgt', 'IMGT', undefined, 3);
8628
+ html += "</ul>";
8629
+ */
8630
+
8606
8631
  html += "<li><br/></li>";
8607
8632
 
8608
8633
  html += "</ul>";
@@ -12859,7 +12884,7 @@ class Events {
12859
12884
  if(esmfold_fasta.indexOf('>') != -1) { //FASTA with header
12860
12885
  let pos = esmfold_fasta.indexOf('\n');
12861
12886
  ic.esmTitle = esmfold_fasta.substr(1, pos - 1).trim();
12862
- pdbid = ic.esmTitle.substr(0, ic.esmTitle.indexOf(' '));
12887
+ pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
12863
12888
  if(pdbid.length < 6) pdbid = pdbid.padEnd(6, '-');
12864
12889
 
12865
12890
  esmfold_fasta = esmfold_fasta.substr(pos + 1);
@@ -42092,6 +42117,7 @@ class ShowSeq {
42092
42117
  break;
42093
42118
  }
42094
42119
  }
42120
+
42095
42121
  if(kabat_or_imgt == 1 && !bKabatFound) {
42096
42122
  return {html: '', html3: ''};
42097
42123
  }
@@ -44435,9 +44461,14 @@ class LineGraph {
44435
44461
  domainAtomsArray.push(currAtoms);
44436
44462
 
44437
44463
  let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
44464
+
44465
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(currAtoms);
44466
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(currAtoms);
44467
+ let resiSum = parseInt(atomFirst.resi) + parseInt(atomLast.resi);
44468
+
44438
44469
  for(let n = 0, nl = residueArray.length; n < nl; ++n) {
44439
44470
  let resid = residueArray[n];
44440
- ic.resid2domainid[resid] = chainid + '-0' + '_' + Object.keys(currAtoms).length;
44471
+ ic.resid2domainid[resid] = chainid + '-0' + '_' + resiSum;
44441
44472
  }
44442
44473
  }
44443
44474
  else {
@@ -44457,13 +44488,17 @@ class LineGraph {
44457
44488
 
44458
44489
  domainAtomsArray.push(domainAtoms);
44459
44490
 
44491
+ let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtoms);
44492
+ let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtoms);
44493
+ let resiSum = parseInt(atomFirst.resi) + parseInt(atomLast.resi);
44494
+
44460
44495
  for(let m = 0, ml = segArray.length; m < ml; m += 2) {
44461
44496
  let startResi = segArray[m];
44462
44497
  let endResi = segArray[m+1];
44463
44498
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
44464
44499
  let resid = chainid + '_' + pos2resi[n];
44465
44500
  //domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
44466
- ic.resid2domainid[resid] = chainid + '-' + k + '_' + Object.keys(domainAtoms).length;
44501
+ ic.resid2domainid[resid] = chainid + '-' + k + '_' + resiSum;
44467
44502
  }
44468
44503
  }
44469
44504
  }
@@ -44487,7 +44522,7 @@ class LineGraph {
44487
44522
  pdb_query = header + pdb_query;
44488
44523
 
44489
44524
  let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
44490
- let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj, undefined, undefined, undefined, undefined, undefined, true) ;
44525
+ let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
44491
44526
  ajaxArray.push(alignAjax);
44492
44527
 
44493
44528
  domainidpairArray.push(domainid + "|" + ic.refpdbArray[index]);
@@ -44503,8 +44538,9 @@ class LineGraph {
44503
44538
  // dataArray2 = await allPromise;
44504
44539
 
44505
44540
  //split arrays into chunks of 100 jobs
44506
- let n = (me.bNode) ? 16 : 96;
44507
- for(let i = 0, il = (ajaxArray.length - 1) / n + 1; i < il; ++i) {
44541
+ let n = (me.bNode) ? 96 : 96;
44542
+
44543
+ for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
44508
44544
  let currAjaxArray = [];
44509
44545
  if(i == il - 1) { // last one
44510
44546
  currAjaxArray = ajaxArray.slice(i * n, ajaxArray.length);
@@ -44518,7 +44554,6 @@ class LineGraph {
44518
44554
 
44519
44555
  dataArray2 = dataArray2.concat(currDataArray);
44520
44556
  }
44521
-
44522
44557
 
44523
44558
  let bRound1 = true;
44524
44559
  await thisClass.parseAlignData(dataArray2, domainidpairArray, bRound1);
@@ -44628,7 +44663,7 @@ class LineGraph {
44628
44663
 
44629
44664
  //if(!(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand)) continue;
44630
44665
  if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
44631
- if(!me.bNode) console.log("some of the Ig strands B, C, E, F are missing...");
44666
+ if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are missing in the domain " + domainid + "...");
44632
44667
  continue;
44633
44668
  }
44634
44669
 
@@ -44726,6 +44761,8 @@ class LineGraph {
44726
44761
  if(!ic.resid2refnum) ic.resid2refnum = {};
44727
44762
  if(!ic.refnum2residArray) ic.refnum2residArray = {};
44728
44763
  if(!ic.chainsMapping) ic.chainsMapping = {};
44764
+
44765
+ if(!ic.refPdbList) ic.refPdbList = [];
44729
44766
  for(let chainid in chainid2segs) {
44730
44767
  let segArray = chainid2segs[chainid];
44731
44768
 
@@ -44734,7 +44771,8 @@ class LineGraph {
44734
44771
  let chainList = this.getTemplateList(chainid);
44735
44772
 
44736
44773
  //if(!me.bNode) console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
44737
- console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
44774
+ if(!me.bNode) console.log("The reference PDB(s) for chain " + chainid + " are " + chainList);
44775
+ ic.refPdbList.push("The reference PDB(s) for chain " + chainid + " are " + chainList);
44738
44776
 
44739
44777
  let prevStrand;
44740
44778
  let bCd19 = refpdbnameArray.length == 1 && refpdbnameArray[0] == 'CD19_6al5A_human_C2orV-n1';
@@ -44917,9 +44955,121 @@ class LineGraph {
44917
44955
  ic.annotationCls.setAnnoViewAndDisplay('detailed view');
44918
44956
  }
44919
44957
 
44920
- rmStrandFromRefnumlabel(refnumLabel) {
44958
+ rmStrandFromRefnumlabel(refnumLabel) { let ic = this.icn3d; ic.icn3dui;
44921
44959
  return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
44922
44960
  }
44961
+
44962
+ exportRefnum(type) { let ic = this.icn3d, me = ic.icn3dui;
44963
+ let refData = '';
44964
+
44965
+ // 1. show IgStrand ref numbers
44966
+ if(type == 'igstrand' || type == 'IgStrand') {
44967
+ // iGStrand reference numbers were adjusted when showing in sequences
44968
+ if(me.bNode) {
44969
+ for(let chnid in ic.chains) {
44970
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
44971
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
44972
+ let giSeq = [];
44973
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
44974
+ giSeq.push(ic.chainsSeq[chnid][i].name);
44975
+ }
44976
+ ic.showSeqCls.showRefNum(giSeq, chnid);
44977
+ }
44978
+ }
44979
+ }
44980
+
44981
+ let resid2refnum = {};
44982
+ for(let resid in ic.resid2refnum) {
44983
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
44984
+ if(!atom) continue;
44985
+
44986
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
44987
+
44988
+ let domainid = ic.resid2domainid[resid];
44989
+ let refnumLabel = ic.resid2refnum[resid];
44990
+
44991
+ if(refnumLabel) {
44992
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
44993
+ (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
44994
+ }
44995
+
44996
+ if(ic.resid2refnum[resid]) {
44997
+ if(ic.residIgLoop.hasOwnProperty(resid)) { // loop
44998
+ resid2refnum[resid + '_' + resn] = ic.resid2refnum[resid] + '_loop';
44999
+ }
45000
+ else {
45001
+ resid2refnum[resid + '_' + resn] = ic.resid2refnum[resid];
45002
+ }
45003
+ }
45004
+ }
45005
+
45006
+ refData += '{"ref PDB" : ' + JSON.stringify(ic.refPdbList) + ",\n";
45007
+
45008
+ refData += '"data": {\n';
45009
+ for(let chnid in ic.chains) {
45010
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.chains[chnid]);
45011
+ if(ic.proteins.hasOwnProperty(atom.serial)) {
45012
+ for(let i = 0; i < ic.chainsSeq[chnid].length; ++i) {
45013
+ const resid = chnid + '_' + ic.chainsSeq[chnid][i].resi + '_' + ic.chainsSeq[chnid][i].name;
45014
+
45015
+ refData += "'" + resid + "': '" + resid2refnum[resid] + "',\n";
45016
+ }
45017
+ }
45018
+ }
45019
+ refData += '}\n';
45020
+ refData += '}\n';
45021
+ }
45022
+ // 2. show Kabat ref numbers
45023
+ else if(type == 'kabat' || type == 'Kabat') {
45024
+ let resid2kabat = {};
45025
+ for(let resid in ic.resid2refnum) {
45026
+ let domainid = ic.resid2domainid[resid];
45027
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
45028
+
45029
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45030
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45031
+
45032
+ if(refnumLabel) {
45033
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45034
+ refnumStr = (ic.domainid2ig2kabat[domainid]) ? ic.domainid2ig2kabat[domainid][refnumStr_ori] : undefined;
45035
+ }
45036
+
45037
+ resid2kabat[resid + '_' + resn] = refnumStr;
45038
+ }
45039
+
45040
+ refData += JSON.stringify(resid2kabat);
45041
+ }
45042
+ // 3. show IMGT ref numbers
45043
+ else if(type == 'imgt'|| type == 'IMGT') {
45044
+ let resid2imgt = {};
45045
+ for(let resid in ic.resid2refnum) {
45046
+ let domainid = ic.resid2domainid[resid];
45047
+ let refnumStr, refnumLabel = ic.resid2refnum[resid];
45048
+
45049
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
45050
+ let resn = me.utilsCls.residueName2Abbr(atom.resn.substr(0, 3));
45051
+
45052
+ if(refnumLabel) {
45053
+ let refnumStr_ori = ic.refnumCls.rmStrandFromRefnumlabel(refnumLabel);
45054
+ refnumStr = (ic.domainid2ig2imgt[domainid]) ? ic.domainid2ig2imgt[domainid][refnumStr_ori] : undefined;
45055
+ }
45056
+
45057
+ resid2imgt[resid + '_' + resn] = refnumStr;
45058
+ }
45059
+
45060
+ refData += JSON.stringify(resid2imgt);
45061
+ }
45062
+
45063
+
45064
+ if(!me.bNode) {
45065
+ let file_pref = Object.keys(me.utilsCls.getHlStructures()).join(',');
45066
+
45067
+ ic.saveFileCls.saveFile(file_pref + '_refnum_' + type + '.txt', 'text', [refData]);
45068
+ }
45069
+ else {
45070
+ return refData;
45071
+ }
45072
+ }
44923
45073
  }
44924
45074
 
44925
45075
  /**
@@ -57454,6 +57604,11 @@ class ApplyCommand {
57454
57604
  else if(command == 'export pdb hydrogen') {
57455
57605
  await ic.scapCls.exportPdbProfix(true);
57456
57606
  }
57607
+ else if(command.indexOf('export refnum ') != -1) {
57608
+ let type = command.substr(14);
57609
+
57610
+ ic.refnumCls.exportRefnum(type);
57611
+ }
57457
57612
  else if(command == 'export secondary structure') {
57458
57613
  me.htmlCls.setHtmlCls.exportSecondary();
57459
57614
  }