icn3d 3.29.16 → 3.30.0

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
@@ -6711,6 +6711,26 @@ class ClickMenu {
6711
6711
  $("#" + me.pre + "menulist").html(html);
6712
6712
  }
6713
6713
 
6714
+ async setIgTemplate(template) { let me = this.icn3dui, ic = me.icn3d;
6715
+ ic.bRunRefnumAgain = true;
6716
+
6717
+ // reset for the selection
6718
+ let residueArray = ic.resid2specCls.atoms2residues(Object.keys(ic.hAtoms));
6719
+ for(let i = 0, il = residueArray.length; i < il; ++i) {
6720
+ let resid = residueArray[i];
6721
+
6722
+ if(ic.resid2refnum) delete ic.resid2refnum[resid];
6723
+ if(ic.resid2refnum_ori) delete ic.resid2refnum_ori[resid];
6724
+ if(ic.resid2domainid) delete ic.resid2domainid[resid];
6725
+ }
6726
+
6727
+ let bSelection = true;
6728
+ // await ic.refnumCls.showIgRefNum(template);
6729
+ if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
6730
+ await ic.annotationCls.setAnnoTabIg(bSelection, template);
6731
+
6732
+ // ic.bRunRefnumAgain = false;
6733
+ }
6714
6734
 
6715
6735
  clickMenu1() { let me = this.icn3dui; me.icn3d;
6716
6736
  if(me.bNode) return;
@@ -8276,6 +8296,8 @@ class ClickMenu {
8276
8296
  });
8277
8297
 
8278
8298
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefYes", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
8299
+ ic.bRunRefnumAgain = true;
8300
+
8279
8301
  thisClass.setLogCmd('ig refnum on', true);
8280
8302
  // await ic.refnumCls.showIgRefNum();
8281
8303
  // thisClass.setLogCmd('set annotation ig', true);
@@ -8292,21 +8314,22 @@ class ClickMenu {
8292
8314
  // ic.hlUpdateCls.updateHlAll();
8293
8315
  // ic.drawCls.draw();
8294
8316
  // }
8317
+
8318
+ // ic.bRunRefnumAgain = false;
8295
8319
  });
8296
8320
 
8297
8321
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl", "click", async function(e) { me.icn3d; //e.preventDefault();
8298
8322
  me.htmlCls.dialogCls.openDlg('dl_igrefTpl', 'Choose an Ig template');
8299
8323
  });
8300
8324
 
8301
- me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl_apply", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
8325
+ me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl_apply", "click", async function(e) { me.icn3d; //e.preventDefault();
8302
8326
  if(!me.cfg.notebook) dialog.dialog( "close" );
8303
-
8327
+
8304
8328
  let template = $("#" + me.pre + "refTpl").val();
8329
+
8330
+ await thisClass.setIgTemplate(template);
8331
+
8305
8332
  thisClass.setLogCmd('ig template ' + template, true);
8306
- let bSelection = true;
8307
- // await ic.refnumCls.showIgRefNum(template);
8308
- if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
8309
- await ic.annotationCls.setAnnoTabIg(bSelection, template);
8310
8333
  });
8311
8334
 
8312
8335
  me.myEventCls.onIds("#" + me.pre + "mn6_alignrefTpl", "click", async function(e) { me.icn3d; //e.preventDefault();
@@ -8315,18 +8338,26 @@ class ClickMenu {
8315
8338
 
8316
8339
  me.myEventCls.onIds("#" + me.pre + "mn6_alignrefTpl_apply", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
8317
8340
  if(!me.cfg.notebook) dialog.dialog( "close" );
8318
-
8341
+
8319
8342
  let template = $("#" + me.pre + "refTpl2").val();
8320
8343
 
8344
+ let selAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
8345
+
8321
8346
  // load the template
8322
8347
  let url = me.htmlCls.baseUrl + "icn3d/refpdb/" + template + ".pdb";
8323
8348
  await ic.pdbParserCls.downloadUrl(url, 'pdb', undefined, template);
8324
8349
  thisClass.setLogCmd('load url ' + url + ' | type pdb', true);
8350
+
8351
+ let structure = template.replace(/_/g, '').substr(0,4);
8352
+
8353
+ let chainid = ic.structures[structure][0];
8354
+
8355
+ ic.hAtoms = me.hashUtilsCls.unionHash(selAtoms, ic.chains[chainid]);
8325
8356
 
8326
8357
  // align the template with the selection
8327
8358
  me.cfg.aligntool = 'tmalign';
8328
8359
  await ic.realignParserCls.realignOnStructAlign();
8329
- thisClass.setLogCmd('realign on tmalign', true);
8360
+ thisClass.setLogCmd('realign on tmalign', true);
8330
8361
  });
8331
8362
 
8332
8363
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefNo", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
@@ -37782,8 +37813,9 @@ class AnnoCddSite {
37782
37813
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
37783
37814
 
37784
37815
  if(me.cfg.blast_rep_id != chnid) { // regular
37816
+ let color;
37785
37817
  for(let i = 0, il = fromArray.length; i < il; ++i) {
37786
- let color = this.getColorFromPos(chnid, fromArray[i], titleArray);
37818
+ if(i == 0) color = this.getColorFromPos(chnid, fromArray[i], titleArray);
37787
37819
 
37788
37820
  let emptyWidth;
37789
37821
  // if(titleArray) {
@@ -38509,9 +38541,10 @@ class AnnoIg {
38509
38541
 
38510
38542
  //Show the annotations of CDD domains and binding sites.
38511
38543
  async showIg(chnid, template) { let ic = this.icn3d; ic.icn3dui;
38512
- if(!ic.bRunRefnum || Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
38544
+ // if(!ic.bRunRefnum || Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
38545
+ if(ic.bRunRefnumAgain) {
38513
38546
  await ic.refnumCls.showIgRefNum(template);
38514
- ic.bRunRefnum = true;
38547
+ // ic.bRunRefnum = true;
38515
38548
  }
38516
38549
 
38517
38550
  let type = 'ig';
@@ -38529,6 +38562,8 @@ class AnnoIg {
38529
38562
  $("#" + ic.pre + "dt_" + type + "_" + chnid).html(html);
38530
38563
  $("#" + ic.pre + "ov_" + type + "_" + chnid).html(html2);
38531
38564
  $("#" + ic.pre + "tt_" + type + "_" + chnid).html(html3);
38565
+
38566
+ ic.bRunRefnumAgain = false;
38532
38567
  }
38533
38568
 
38534
38569
  showAllRefNum(giSeq, chnid) { let ic = this.icn3d; ic.icn3dui;
@@ -38820,19 +38855,24 @@ class AnnoIg {
38820
38855
  html2 += htmlTitle;
38821
38856
  html2 += htmlCnt + '<span class="icn3d-seqLine">';
38822
38857
 
38858
+ let prevDomainindex, color;
38823
38859
  for(let i = 0, il = fromArray.length; i < il; ++i) {
38824
38860
  let resi = ic.ParserUtilsCls.getResi(chnid, fromArray[i]);
38825
38861
  let resid = chnid + "_" + resi;
38826
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
38827
- let colorStr =(!atom || atom.color === undefined || atom.color.getHexString() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
38828
- let color =(atom && atom.color !== undefined) ? colorStr : "CCCCCC";
38829
38862
 
38830
38863
  let domainindex = posindex2domainindex[fromArray[i]];
38864
+ if(domainindex != prevDomainindex) {
38865
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
38866
+ let colorStr =(!atom || atom.color === undefined || atom.color.getHexString() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
38867
+ color =(atom && atom.color !== undefined) ? colorStr : "CCCCCC";
38868
+ }
38831
38869
 
38832
38870
  let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i]) / ic.maxAnnoLength) :
38833
38871
  Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
38834
38872
  html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
38835
38873
  html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(toArray[i] - fromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle ' + linkStr + '" ig="0" from="' + fromArray + '" to="' + toArray + '" shorttitle="' + domainArray[domainindex] + '" index="0" setname="' + chnid + '_igs" id="' + chnid + '_igs" anno="sequence" chain="' + chnid + '" title="' + domainArray[domainindex] + '">' + domainArray[domainindex] + ' </div>';
38874
+
38875
+ prevDomainindex = domainindex;
38836
38876
  }
38837
38877
 
38838
38878
  html2 += htmlCnt;
@@ -39026,6 +39066,7 @@ class AnnoDomain {
39026
39066
  let pdbid = pdbArray[index];
39027
39067
  //let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
39028
39068
 
39069
+ /*
39029
39070
  if(!ic.bResetAnno && index == 0 && ic.mmdb_data !== undefined) {
39030
39071
  for(let chnid in ic.protein_chainid) {
39031
39072
  if(chnid.indexOf(pdbid) !== -1) {
@@ -39041,6 +39082,7 @@ class AnnoDomain {
39041
39082
  }
39042
39083
  }
39043
39084
  else {
39085
+ */
39044
39086
  // calculate 3D domains on-the-fly
39045
39087
  //ic.protein_chainid[chainArray[i]]
39046
39088
  let data = {};
@@ -39082,7 +39124,7 @@ class AnnoDomain {
39082
39124
 
39083
39125
  ic.bAjax3ddomain = true;
39084
39126
  ic.bAjaxDoneArray[index] = true;
39085
- }
39127
+ // }
39086
39128
  }
39087
39129
 
39088
39130
  //Show the annotations of 3D domains.
@@ -40117,6 +40159,10 @@ class Domain3d {
40117
40159
  constructor(icn3d) {
40118
40160
  this.icn3d = icn3d;
40119
40161
 
40162
+ this.init3ddomain();
40163
+ }
40164
+
40165
+ init3ddomain() { let ic = this.icn3d; ic.icn3dui;
40120
40166
  //this.dcut = 8; // threshold for C-alpha interactions
40121
40167
 
40122
40168
  // It seemed the threshold 7 angstrom works better
@@ -40124,7 +40170,8 @@ class Domain3d {
40124
40170
  this.dcut = 8; // threshold for C-alpha interactions
40125
40171
 
40126
40172
  // added by Jiyao
40127
- this.min_contacts = 5; //3; // minimum number of contacts to be considered as neighbors
40173
+ // pdbid 1CD8 requires a min contact 4, not 5
40174
+ this.min_contacts = 4; //5; //3; // minimum number of contacts to be considered as neighbors
40128
40175
 
40129
40176
  this.MAX_SSE = 512;
40130
40177
 
@@ -40136,6 +40183,7 @@ class Domain3d {
40136
40183
 
40137
40184
  //let this.elt_size[this.MAX_SSE]; // element sizes in residues
40138
40185
  this.elt_size = [];
40186
+
40139
40187
  this.elt_size.length = this.MAX_SSE;
40140
40188
 
40141
40189
  //let this.group_num[this.MAX_SSE]; // indicates required element groupings
@@ -40745,6 +40793,8 @@ class Domain3d {
40745
40793
  // x0, y0, z0: array of x,y,z coordinates of C-alpha atoms
40746
40794
  //c2b_NewSplitChain(chnid, dcut) { let ic = this.icn3d, me = ic.icn3dui;
40747
40795
  c2b_NewSplitChain(atoms, dcut) { let ic = this.icn3d; ic.icn3dui;
40796
+ this.init3ddomain();
40797
+
40748
40798
  let x0 = [], y0 = [], z0 = [], resiArray = [];
40749
40799
 
40750
40800
  //substruct: array of secondary structures, each of which has the keys: From (1-based), To (1-based), Sheet (0 or 1), also add these paras: x1, y1, z1, x2, y2, z2
@@ -43278,7 +43328,11 @@ class Annotation {
43278
43328
  this.updateSsbond();
43279
43329
  this.updateCrosslink();
43280
43330
  await this.updateTransmem();
43331
+
43332
+ ic.bRunRefnumAgain = true;
43281
43333
  await this.updateIg();
43334
+ // ic.bRunRefnumAgain = false;
43335
+
43282
43336
  this.updateInteraction();
43283
43337
  }
43284
43338
  hideAnnoTabAll() { let ic = this.icn3d; ic.icn3dui;
@@ -43360,10 +43414,13 @@ class Annotation {
43360
43414
  $("[id^=" + ic.pre + "transmem]").show();
43361
43415
  }
43362
43416
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
43363
- ic.bRunRefnum = false;
43417
+ // ic.bRunRefnumAgain = true;
43418
+
43364
43419
  await this.updateIg();
43365
43420
 
43366
43421
  $("[id^=" + ic.pre + "ig]").show();
43422
+
43423
+ // ic.bRunRefnumAgain = false;
43367
43424
  }
43368
43425
  }
43369
43426
  setAnnoTabCustom() { let ic = this.icn3d; ic.icn3dui;
@@ -43624,12 +43681,15 @@ class Annotation {
43624
43681
 
43625
43682
  me.myEventCls.onIds("#" + ic.pre + "anno_ig", "click", async function(e) {
43626
43683
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
43627
- if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
43628
- ic.bRunRefnum = false;
43629
- }
43684
+ // if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
43685
+ // ic.bRunRefnum = false;
43686
+ // }
43630
43687
 
43688
+ ic.bRunRefnumAgain = true;
43631
43689
  await thisClass.setAnnoTabIg();
43632
43690
  me.htmlCls.clickMenuCls.setLogCmd("set annotation ig", true);
43691
+
43692
+ // ic.bRunRefnumAgain = false;
43633
43693
  }
43634
43694
  else {
43635
43695
  thisClass.hideAnnoTabIg();
@@ -60854,11 +60914,17 @@ class ApplyCommand {
60854
60914
  await ic.annotationCls.setAnnoTabTransmem();
60855
60915
  }
60856
60916
  else if(command == 'set annotation ig') {
60917
+ ic.bRunRefnumAgain = true;
60857
60918
  await ic.annotationCls.setAnnoTabIg();
60919
+ // ic.bRunRefnumAgain = false;
60858
60920
  }
60859
60921
  else if(command == 'ig refnum on') {
60922
+ ic.bRunRefnumAgain = true;
60923
+
60860
60924
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
60861
60925
  await ic.annotationCls.setAnnoTabIg(true);
60926
+
60927
+ // ic.bRunRefnumAgain = false;
60862
60928
  }
60863
60929
  else if(command == 'highlight level up') {
60864
60930
  ic.resid2specCls.switchHighlightLevelUp();
@@ -63346,9 +63412,7 @@ class LoadScript {
63346
63412
  // }
63347
63413
  else if(command.indexOf('ig template') == 0 ) {
63348
63414
  let template = command.substr(command.lastIndexOf(' ') + 1);
63349
- // await ic.refnumCls.showIgRefNum(template);
63350
- if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
63351
- await ic.annotationCls.setAnnoTabIg(true, template);
63415
+ await me.htmlCls.clickMenuCls.setIgTemplate(template);
63352
63416
  }
63353
63417
  else if(command.indexOf('set annotation 3ddomain') == 0) { // the command may have "|||{"factor"...
63354
63418
  if(Object.keys(ic.proteins).length > 0) {
@@ -63551,8 +63615,12 @@ class LoadScript {
63551
63615
  }
63552
63616
  else if(lastCommand.indexOf('ig refnum on') == 0) {
63553
63617
  // await ic.refnumCls.showIgRefNum();
63618
+ ic.bRunRefnumAgain = true;
63619
+
63554
63620
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
63555
63621
  await ic.annotationCls.setAnnoTabIg(true);
63622
+
63623
+ // ic.bRunRefnumAgain = false;
63556
63624
  }
63557
63625
  else if(lastCommand.indexOf('set annotation 3ddomain') == 0) {
63558
63626
  thisClass.applyCommand3ddomain(lastCommand);
@@ -66549,7 +66617,7 @@ class Dssp {
66549
66617
 
66550
66618
  async hideIgRefNum() { let ic = this.icn3d; ic.icn3dui;
66551
66619
  ic.bShowRefnum = false;
66552
- ic.bRunRefnum = false;
66620
+ // ic.bRunRefnum = false;
66553
66621
 
66554
66622
  // redo all ref numbers
66555
66623
  ic.resid2refnum = {};
@@ -66925,9 +66993,9 @@ class Dssp {
66925
66993
 
66926
66994
  if(bRerunDomain) {
66927
66995
  let atomsAssigned = {};
66928
- //ic.resid2refnum_ori should be used
66929
- for(let resid in ic.resid2refnum_ori) {
66930
- atomsAssigned = me.hashUtilsCls.unionHash(atomsAssigned, ic.residues[resid]);
66996
+ // for(let resid in ic.resid2refnum_ori) {
66997
+ for(let resid in ic.resid2domainid) {
66998
+ if(ic.resid2domainid[resid]) atomsAssigned = me.hashUtilsCls.unionHash(atomsAssigned, ic.residues[resid]);
66931
66999
  }
66932
67000
 
66933
67001
  currAtoms = me.hashUtilsCls.exclHash(currAtoms, atomsAssigned);
@@ -67152,7 +67220,7 @@ class Dssp {
67152
67220
  strandHash[strand] = 1;
67153
67221
  }
67154
67222
  let score = parseFloat(queryData[0].score);
67155
- //!!!
67223
+
67156
67224
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
67157
67225
  // if(!domainid2segs.hasOwnProperty(domainid) ||
67158
67226
  // (score >= parseFloat(ic.domainid2score[domainid].split('_')[0]) + tmAdjust)
@@ -67184,24 +67252,22 @@ class Dssp {
67184
67252
  }
67185
67253
 
67186
67254
  //!!!
67187
- /*
67188
- // combine the top three clusters for the 2nd round alignment
67255
+
67256
+ // combine the top four clusters for the 2nd round alignment
67189
67257
  if(bRound1) {
67190
67258
  for(let domainid in domainid2refpdbnamelist) {
67191
- if(!me.bNode) console.log("###score " + ic.domainid2score[domainid].split('_')[0] + " ic.domainid2refpdbname[domainid][0] " + ic.domainid2refpdbname[domainid][0])
67192
67259
  if(!me.bNode && ic.domainid2refpdbname[domainid][0] == 'all_templates') {
67193
67260
  let refpdbname2score = domainid2refpdbnamelist[domainid];
67194
67261
  let refpdbnameList = Object.keys(refpdbname2score);
67195
67262
  refpdbnameList.sort(function(a, b) {
67196
67263
  return refpdbname2score[b] - refpdbname2score[a]
67197
67264
  });
67198
- // top 3 templates
67199
- ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,3);
67265
+ // top 4 templates
67266
+ ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,4);
67200
67267
  }
67201
- if(!me.bNode) console.log("###bb ic.domainid2refpdbname[domainid] " + ic.domainid2refpdbname[domainid])
67202
67268
  }
67203
67269
  }
67204
- */
67270
+
67205
67271
  return domainid2segs; // only used in round 2
67206
67272
  }
67207
67273
 
@@ -67210,7 +67276,7 @@ class Dssp {
67210
67276
 
67211
67277
  let domainid2segs = this.parseAlignData_part1(dataArray, domainidpairArray, bRound1);
67212
67278
 
67213
- // !!!no more Igs to detect
67279
+ // no more Igs to detect
67214
67280
  if(Object.keys(domainid2segs).length == 0) {
67215
67281
  bNoMoreIg = true;
67216
67282
  return bNoMoreIg;
@@ -67959,7 +68025,7 @@ class Dssp {
67959
68025
  }
67960
68026
 
67961
68027
  // in case A1550 is not found, but A1551 is found
67962
- if(!bFoundAnchor && (lastTwo == 51 || lastTwo == 52 || lastTwo == 53 || lastTwo == 54) ) {
68028
+ if(!bFoundAnchor && (lastTwo >= 46 && lastTwo <= 54) ) {
67963
68029
  let offset = lastTwo - 50;
67964
68030
  strandArray[strandCnt].anchorRefnum = refnum - offset;
67965
68031
  strandArray[strandCnt].resCntBfAnchor = resCntBfAnchor - offset;
@@ -68068,6 +68134,7 @@ class Dssp {
68068
68134
  let currResid = chnid + '_' + currResi;
68069
68135
  delete ic.residIgLoop[currResid];
68070
68136
  ic.resid2domainid[currResid] = domainid;
68137
+ ic.resid2refnum_ori[currResid] = 1; // a hash to check which residues were assigned
68071
68138
  }
68072
68139
 
68073
68140
  break;
@@ -68101,6 +68168,7 @@ class Dssp {
68101
68168
  let currResid = chnid + '_' + currResi;
68102
68169
  delete ic.residIgLoop[currResid];
68103
68170
  ic.resid2domainid[currResid] = domainid;
68171
+ ic.resid2refnum_ori[currResid] = 1; // a hash to check which residues were assigned
68104
68172
  }
68105
68173
 
68106
68174
  break;
@@ -76488,7 +76556,7 @@ class iCn3DUI {
76488
76556
  //even when multiple iCn3D viewers are shown together.
76489
76557
  this.pre = this.cfg.divid + "_";
76490
76558
 
76491
- this.REVISION = '3.29.5';
76559
+ this.REVISION = '3.30.0';
76492
76560
 
76493
76561
  // In nodejs, iCn3D defines "window = {navigator: {}}"
76494
76562
  this.bNode = (Object.keys(window).length < 2) ? true : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.29.16",
3
+ "version": "3.30.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {