icn3d 3.31.5 → 3.31.6

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
@@ -36179,7 +36179,7 @@ class Alternate {
36179
36179
 
36180
36180
  ic.drawCls.draw();
36181
36181
 
36182
- ic.bShowHighlight = true;
36182
+ ic.bShowHighlight = true; //reset
36183
36183
  }
36184
36184
 
36185
36185
  async alternateWrapper() { let ic = this.icn3d; ic.icn3dui;
@@ -41169,7 +41169,7 @@ class AnnoIg {
41169
41169
 
41170
41170
  let tmscore = info.score;
41171
41171
 
41172
- let igType = (parseFloat(tmscore) < ic.refnumCls.TMThreshold ) ? 'Ig' : ic.ref2igtype[info.refpdbname];
41172
+ let igType = (parseFloat(tmscore) < ic.refnumCls.TMThresholdIgType ) ? 'Ig' : ic.ref2igtype[info.refpdbname];
41173
41173
  titleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + ')');
41174
41174
  fullTitleArray.push(igType + ' (TM:' + parseFloat(tmscore).toFixed(2) + '), template: ' + info.refpdbname + ', type: ' + ic.ref2igtype[info.refpdbname] + ', Seq. identity: ' + parseFloat(info.seqid).toFixed(2) + ', aligned residues: ' + info.nresAlign);
41175
41175
 
@@ -46218,36 +46218,32 @@ class Annotation {
46218
46218
  }
46219
46219
 
46220
46220
  async updateIg(bSelection, template) { let ic = this.icn3d, me = ic.icn3dui;
46221
- if(bSelection) { // clear previous refnum
46222
- let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.hAtoms);
46223
- for(let resid in residueHash) {
46224
- if(ic.resid2refnum) delete ic.resid2refnum[resid];
46225
- if(ic.residIgLoop) delete ic.residIgLoop[resid];
46226
- if(ic.resid2domainid) delete ic.resid2domainid[resid];
46221
+ ic.opts['color'] = 'ig strand';
46222
+
46223
+ // if(!bSelection && !template) {
46224
+ if(!bSelection) {
46225
+ // select all protein chains
46226
+ ic.hAtoms = {};
46227
+ for(let chainid in ic.protein_chainid) {
46228
+ ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.chains[chainid]);
46227
46229
  }
46228
46230
  }
46229
46231
 
46230
- // if(!ic.bIgShown) {
46231
- if(!bSelection && !template) {
46232
- // select all protein chains
46233
- ic.hAtoms = {};
46234
- for(let chainid in ic.protein_chainid) {
46235
- ic.hAtoms = me.hashUtilsCls.unionHash(ic.hAtoms, ic.chains[chainid]);
46236
- }
46237
- }
46232
+ // clear previous refnum
46233
+ let residueHash = ic.firstAtomObjCls.getResiduesFromAtoms(ic.hAtoms);
46234
+ for(let resid in residueHash) {
46235
+ if(ic.resid2refnum) delete ic.resid2refnum[resid];
46236
+ if(ic.residIgLoop) delete ic.residIgLoop[resid];
46237
+ if(ic.resid2domainid) delete ic.resid2domainid[resid];
46238
+ }
46238
46239
 
46239
- ic.bRunRefnumAgain = true;
46240
- for(let chainid in ic.protein_chainid) {
46241
- await ic.annoIgCls.showIg(chainid, template);
46242
- ic.bRunRefnumAgain = false; // run it once for all chains
46243
- }
46244
- // }
46245
- // ic.bIgShown = true;
46240
+ ic.bRunRefnumAgain = true;
46241
+ for(let chainid in ic.protein_chainid) {
46242
+ await ic.annoIgCls.showIg(chainid, template);
46243
+ ic.bRunRefnumAgain = false; // run it once for all chains
46244
+ }
46246
46245
 
46247
46246
  if(ic.bShowRefnum) {
46248
- // ic.opts.color = 'ig strand';
46249
- // ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
46250
-
46251
46247
  ic.hlUpdateCls.updateHlAll();
46252
46248
  ic.drawCls.draw();
46253
46249
  }
@@ -47982,10 +47978,14 @@ class HlSeq {
47982
47978
  }
47983
47979
  */
47984
47980
 
47985
- if(($(that).attr('domain') !== undefined || $(that).attr('feat') !== undefined) || $(that).attr('3ddomain') !== undefined || $(that).attr('ig') !== undefined) {
47981
+ if(($(that).attr('domain') !== undefined || $(that).attr('feat') !== undefined) || $(that).attr('ig') !== undefined) {
47986
47982
  let residNCBI = chainid + '_' + (j+1).toString();
47987
47983
  residueid = ic.ncbi2resid[residNCBI];
47988
47984
  }
47985
+ else if($(that).attr('3ddomain') !== undefined) {
47986
+ // the position of residues with coordinates
47987
+ residueid = ic.posid2resid[chainid + '_' + (j+1).toString()];
47988
+ }
47989
47989
  else {
47990
47990
  residueid = chainid + '_' + (j+1).toString();
47991
47991
  }
@@ -49961,7 +49961,7 @@ class ShowInter {
49961
49961
  }
49962
49962
  }
49963
49963
 
49964
- ic.bShowHighlight = false;
49964
+ //!!!ic.bShowHighlight = false;
49965
49965
  }
49966
49966
 
49967
49967
  hideHydrogens() { let ic = this.icn3d; ic.icn3dui;
@@ -51541,8 +51541,10 @@ class ContactMap {
51541
51541
  // json format: [{"residue1": [1, ..., 1, ..., n, ..., n], "residue2": [1, 2, ..., n, ..., 1, 2, ..., n],
51542
51542
  // "distance": [n*n matrix],"max_predicted_aligned_error":31.75}]
51543
51543
  //let distMatrix = dataJson[0].distance; // version 2, one dimension
51544
- let distMatrix = dataJson[0].predicted_aligned_error; // version 3, two dimensions
51545
- let max = dataJson[0].max_predicted_aligned_error;
51544
+ let data = (dataJson[0]) ? dataJson[0] : dataJson; // dataJson[0] is from AlphaFold UniProt database
51545
+ let distMatrix = data.predicted_aligned_error || data.pae; // version 3, two dimensions
51546
+ let max = data.max_predicted_aligned_error || data.max_pae; // max_predicted_aligned_error is from AlphaFold UniProt database
51547
+
51546
51548
  if(!distMatrix || !max) {
51547
51549
  var aaa = 1; //alert("The PAE file didn't have the right format...");
51548
51550
  return;
@@ -52943,7 +52945,7 @@ class ChainalignParser {
52943
52945
  ic.init();
52944
52946
  }
52945
52947
  else {
52946
- ic.resetConfig();
52948
+ //ic.resetConfig();
52947
52949
 
52948
52950
  ic.bResetAnno = true;
52949
52951
  ic.bResetSets = true;
@@ -53039,7 +53041,9 @@ class ChainalignParser {
53039
53041
  let hAtoms = {}, hAtomsTmp = {};
53040
53042
  let bLastQuery = false;
53041
53043
 
53042
- ic.opts['color'] = (ic.structArray.length > 1) ? 'structure' : ((structArray[0].length > 5) ? 'confidence' : 'chain');
53044
+ let opts = {};
53045
+
53046
+ opts['color'] = (structArray.length > 1) ? 'structure' : ((structArray[0].length > 5) ? 'confidence' : 'chain');
53043
53047
 
53044
53048
  for(let i = 0, il = structArray.length; i < il; ++i) {
53045
53049
  if(i == structArray.length - 1) bLastQuery = true;
@@ -53071,11 +53075,22 @@ class ChainalignParser {
53071
53075
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
53072
53076
  }
53073
53077
 
53074
- // parseMmdbData() didn't render structures for mmdbafid input
53075
- if(ic.structArray.length > 1) ic.opts['color'] = 'structure';
53076
- ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
53078
+ // add color only for the newly loaded structures
53079
+ ic.setColorCls.setColorByOptions(opts, hAtoms);
53077
53080
 
53078
- await ic.ParserUtilsCls.renderStructure();
53081
+ if(ic.bAnnoShown) {
53082
+ await ic.showAnnoCls.showAnnotations();
53083
+ ic.annotationCls.resetAnnoTabAll();
53084
+ }
53085
+
53086
+ // await ic.ParserUtilsCls.renderStructure();
53087
+ // ic.drawCls.draw();
53088
+
53089
+ // if(ic.bAnnoShown) {
53090
+ // await ic.showAnnoCls.showAnnotations();
53091
+ // ic.annotationCls.resetAnnoTabAll();
53092
+ // }
53093
+
53079
53094
  if(me.cfg.rotate !== undefined) ic.resizeCanvasCls.rotStruc(me.cfg.rotate, true);
53080
53095
 
53081
53096
  if(bQuery && me.cfg.matchedchains) {
@@ -64728,7 +64743,7 @@ class ApplyCommand {
64728
64743
  else if(command == 'clear selection') {
64729
64744
  ic.hlObjectsCls.removeHlObjects();
64730
64745
  ic.hlUpdateCls.removeHl2D();
64731
- ic.bShowHighlight = false;
64746
+ // !!!ic.bShowHighlight = false;
64732
64747
 
64733
64748
  ic.bSelectResidue = false;
64734
64749
  }
@@ -66885,6 +66900,8 @@ class SelectCollections {
66885
66900
  true
66886
66901
  );
66887
66902
  ic.bSelectResidue = false;
66903
+
66904
+ ic.bShowHighlight = true; // reset
66888
66905
  }
66889
66906
  });
66890
66907
 
@@ -70313,7 +70330,8 @@ class Dssp {
70313
70330
  class Refnum {
70314
70331
  constructor(icn3d) {
70315
70332
  this.icn3d = icn3d;
70316
- this.TMThreshold = 0.85;
70333
+ this.TMThresholdIgType = 0.85;
70334
+ this.TMThresholdTemplate = 0.4;
70317
70335
  this.topClusters = 5;
70318
70336
  }
70319
70337
 
@@ -70783,9 +70801,6 @@ class Dssp {
70783
70801
 
70784
70802
  parseAlignData_part1(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
70785
70803
  // async parseAlignData(dataArray, domainidpairArray, bRound1) { let ic = this.icn3d, me = ic.icn3dui;
70786
- let tmscoreThreshold = 0.45; // 0.4; //0.5;
70787
- //let rmsdThreshold = 10;
70788
-
70789
70804
  // find the best alignment for each chain
70790
70805
  let domainid2segs = {};
70791
70806
  let domainid2refpdbnamelist = {};
@@ -70809,6 +70824,7 @@ class Dssp {
70809
70824
  }
70810
70825
 
70811
70826
  if(queryData[0].score === undefined) continue;
70827
+ let score = parseFloat(queryData[0].score);
70812
70828
 
70813
70829
  //let domainid_index = domainidpairArray[i].split(',');
70814
70830
  //let domainid = domainid_index[0];
@@ -70817,13 +70833,13 @@ class Dssp {
70817
70833
  //let chainid = domainid.split('-')[0];
70818
70834
 
70819
70835
  if(!bRound1) {
70820
- if(queryData[0].score < tmscoreThreshold || queryData[0].num_res < minResidues) {
70821
- if(!me.bNode) console.log("bRound1: " + bRound1 + ": domainid " + domainid + " and refpdbname " + refpdbname + " were skipped due to a TM-score less than " + tmscoreThreshold);
70836
+ if(queryData[0].score < this.TMThresholdTemplate || queryData[0].num_res < minResidues) {
70837
+ if(!me.bNode) console.log("bRound1: " + bRound1 + ": domainid " + domainid + " and refpdbname " + refpdbname + " were skipped due to a TM-score less than " + this.TMThresholdTemplate);
70822
70838
  continue;
70823
70839
  }
70824
70840
  }
70825
70841
  else {
70826
- if(queryData[0].score < tmscoreThreshold || queryData[0].num_res < minResidues / 2) {
70842
+ if(queryData[0].score < this.TMThresholdTemplate || queryData[0].num_res < minResidues / 2) {
70827
70843
  continue;
70828
70844
  }
70829
70845
  }
@@ -70834,6 +70850,9 @@ class Dssp {
70834
70850
  else {
70835
70851
  // if(!me.bNode) console.log("domainid: " + domainid + " refpdbname " + refpdbname + " RMSD: " + queryData[0].super_rmsd + ", num_seg: " + queryData[0].num_seg + ", 10/RMSD + num_seg/5: " + (10 / queryData[0].super_rmsd + queryData[0].num_seg / 5).toFixed(1));
70836
70852
  if(!me.bNode) console.log("domainid: " + domainid + " refpdbname " + refpdbname + " TM-score: " + queryData[0].score);
70853
+
70854
+ if(!domainid2refpdbnamelist[domainid]) domainid2refpdbnamelist[domainid] = {};
70855
+ domainid2refpdbnamelist[domainid][refpdbname] = score;
70837
70856
  }
70838
70857
 
70839
70858
  // Ig-like domains: B (2150, 2150a, 2150b), C (3150, 3250), E (7150, 7250), F (8150, 8250) strands
@@ -70893,8 +70912,7 @@ class Dssp {
70893
70912
  delete ic.domainid2refpdbname[domainid];
70894
70913
  delete ic.domainid2score[domainid];
70895
70914
  }
70896
- continue;
70897
- }
70915
+ continue; }
70898
70916
  // }
70899
70917
 
70900
70918
  }
@@ -70914,7 +70932,6 @@ class Dssp {
70914
70932
  // }
70915
70933
 
70916
70934
  // let tmAdjust = 0.1;
70917
- let score = parseFloat(queryData[0].score);
70918
70935
 
70919
70936
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
70920
70937
  // if(!domainid2segs.hasOwnProperty(domainid) ||
@@ -70927,9 +70944,7 @@ class Dssp {
70927
70944
  ic.domainid2score[domainid] = queryData[0].score + '_' + queryData[0].frac_identical + '_' + queryData[0].num_res ;
70928
70945
 
70929
70946
  if(bRound1) {
70930
- // ic.domainid2refpdbname[domainid] = score > 0.75 ? [refpdbname] : ['all_templates'];
70931
- ic.domainid2refpdbname[domainid] = score >= this.TMThreshold ? [refpdbname] : ['all_templates'];
70932
- // if(me.bNode) ic.domainid2refpdbname[domainid] = ['all_templates'];
70947
+ ic.domainid2refpdbname[domainid] = score >= this.TMThresholdIgType ? [refpdbname] : ['all_templates'];
70933
70948
  }
70934
70949
  else {
70935
70950
  ic.domainid2refpdbname[domainid] = [refpdbname];
@@ -70941,11 +70956,6 @@ class Dssp {
70941
70956
  ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
70942
70957
  ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
70943
70958
  }
70944
-
70945
- if(bRound1) {
70946
- if(!domainid2refpdbnamelist[domainid]) domainid2refpdbnamelist[domainid] = {};
70947
- domainid2refpdbnamelist[domainid][refpdbname] = score;
70948
- }
70949
70959
  }
70950
70960
 
70951
70961
  // combine the top clusters for the 2nd round alignment
@@ -71506,50 +71516,55 @@ class Dssp {
71506
71516
  }
71507
71517
  }
71508
71518
 
71509
- let bIgDomain = (ic.domainid2info && Object.keys(ic.domainid2info).length > 0) ? 1 : 0;
71519
+ // let bIgDomain = (ic.domainid2info && Object.keys(ic.domainid2info).length > 0) ? 1 : 0;
71520
+ let stru2bIgDomain = {};
71521
+ for(let domainid in ic.domainid2info) {
71522
+ let stru = domainid.split('_')[0];
71523
+ stru2bIgDomain[stru] = 1;
71524
+ }
71510
71525
 
71511
-
71526
+ // if(bIgDomain) {
71527
+ for(let structure in ic.structures) {
71528
+ let bIgDomain = stru2bIgDomain.hasOwnProperty(structure) ? 1 : 0;
71512
71529
 
71513
- if(bIgDomain) {
71514
- for(let structure in ic.structures) {
71515
- refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
71516
- for(let m = 0, ml = ic.structures[structure].length; m < ml; ++m) {
71517
- let chnid = ic.structures[structure][m];
71518
- let igArray = ic.chain2igArray[chnid];
71519
-
71520
- if(igArray && igArray.length > 0) {
71521
- refData += '{"' + chnid + '": {\n';
71522
-
71523
- for(let i = 0, il = igArray.length; i < il; ++i) {
71524
- let startPosArray = igArray[i].startPosArray;
71525
- let endPosArray = igArray[i].endPosArray;
71526
- let domainid = igArray[i].domainid;
71527
- let info = ic.domainid2info[domainid];
71528
- if(!info) continue;
71529
-
71530
- refData += '"' + domainid + '": {\n';
71531
-
71532
- refData += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
71533
- for(let j = 0, jl = startPosArray.length; j < jl; ++j) {
71534
- let startPos = startPosArray[j];
71535
- let endPos = endPosArray[j];
71536
- for(let k = startPos; k <= endPos; ++k) {
71537
- const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi + '_' + ic.chainsSeq[chnid][k].name;
71538
- refData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
71539
- }
71540
- }
71541
- refData += '],\n';
71530
+ refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
71531
+ for(let m = 0, ml = ic.structures[structure].length; m < ml; ++m) {
71532
+ let chnid = ic.structures[structure][m];
71533
+ let igArray = ic.chain2igArray[chnid];
71534
+
71535
+ if(igArray && igArray.length > 0) {
71536
+ refData += '{"' + chnid + '": {\n';
71537
+
71538
+ for(let i = 0, il = igArray.length; i < il; ++i) {
71539
+ let startPosArray = igArray[i].startPosArray;
71540
+ let endPosArray = igArray[i].endPosArray;
71541
+ let domainid = igArray[i].domainid;
71542
+ let info = ic.domainid2info[domainid];
71543
+ if(!info) continue;
71542
71544
 
71543
- refData += '},\n';
71545
+ refData += '"' + domainid + '": {\n';
71546
+
71547
+ refData += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
71548
+ for(let j = 0, jl = startPosArray.length; j < jl; ++j) {
71549
+ let startPos = startPosArray[j];
71550
+ let endPos = endPosArray[j];
71551
+ for(let k = startPos; k <= endPos; ++k) {
71552
+ const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi + '_' + ic.chainsSeq[chnid][k].name;
71553
+ refData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
71554
+ }
71544
71555
  }
71556
+ refData += '],\n';
71545
71557
 
71546
- refData += '}},\n';
71558
+ refData += '},\n';
71547
71559
  }
71548
- }
71549
71560
 
71550
- refData += ']}},\n';
71561
+ refData += '}},\n';
71562
+ }
71551
71563
  }
71564
+
71565
+ refData += ']}},\n';
71552
71566
  }
71567
+ // }
71553
71568
  }
71554
71569
  // 2. show Kabat ref numbers
71555
71570
  else if(type == 'kabat' || type == 'Kabat') {
@@ -77528,6 +77543,8 @@ class ThreeDPrint {
77528
77543
  }
77529
77544
 
77530
77545
  ic.drawCls.draw();
77546
+
77547
+ ic.bShowHighlight = true; // reset
77531
77548
  }
77532
77549
 
77533
77550
  //Reset the hydrogen bonds, distance lines to dashed lines. Reset the thickness to the default values.