icn3d 3.29.17 → 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.js CHANGED
@@ -5810,6 +5810,26 @@ class ClickMenu {
5810
5810
  $("#" + me.pre + "menulist").html(html);
5811
5811
  }
5812
5812
 
5813
+ async setIgTemplate(template) { let me = this.icn3dui, ic = me.icn3d;
5814
+ ic.bRunRefnumAgain = true;
5815
+
5816
+ // reset for the selection
5817
+ let residueArray = ic.resid2specCls.atoms2residues(Object.keys(ic.hAtoms));
5818
+ for(let i = 0, il = residueArray.length; i < il; ++i) {
5819
+ let resid = residueArray[i];
5820
+
5821
+ if(ic.resid2refnum) delete ic.resid2refnum[resid];
5822
+ if(ic.resid2refnum_ori) delete ic.resid2refnum_ori[resid];
5823
+ if(ic.resid2domainid) delete ic.resid2domainid[resid];
5824
+ }
5825
+
5826
+ let bSelection = true;
5827
+ // await ic.refnumCls.showIgRefNum(template);
5828
+ if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
5829
+ await ic.annotationCls.setAnnoTabIg(bSelection, template);
5830
+
5831
+ // ic.bRunRefnumAgain = false;
5832
+ }
5813
5833
 
5814
5834
  clickMenu1() { let me = this.icn3dui; me.icn3d;
5815
5835
  if(me.bNode) return;
@@ -7375,6 +7395,8 @@ class ClickMenu {
7375
7395
  });
7376
7396
 
7377
7397
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefYes", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
7398
+ ic.bRunRefnumAgain = true;
7399
+
7378
7400
  thisClass.setLogCmd('ig refnum on', true);
7379
7401
  // await ic.refnumCls.showIgRefNum();
7380
7402
  // thisClass.setLogCmd('set annotation ig', true);
@@ -7391,21 +7413,22 @@ class ClickMenu {
7391
7413
  // ic.hlUpdateCls.updateHlAll();
7392
7414
  // ic.drawCls.draw();
7393
7415
  // }
7416
+
7417
+ // ic.bRunRefnumAgain = false;
7394
7418
  });
7395
7419
 
7396
7420
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl", "click", async function(e) { me.icn3d; //e.preventDefault();
7397
7421
  me.htmlCls.dialogCls.openDlg('dl_igrefTpl', 'Choose an Ig template');
7398
7422
  });
7399
7423
 
7400
- me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl_apply", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
7424
+ me.myEventCls.onIds("#" + me.pre + "mn6_igrefTpl_apply", "click", async function(e) { me.icn3d; //e.preventDefault();
7401
7425
  if(!me.cfg.notebook) dialog.dialog( "close" );
7402
-
7426
+
7403
7427
  let template = $("#" + me.pre + "refTpl").val();
7428
+
7429
+ await thisClass.setIgTemplate(template);
7430
+
7404
7431
  thisClass.setLogCmd('ig template ' + template, true);
7405
- let bSelection = true;
7406
- // await ic.refnumCls.showIgRefNum(template);
7407
- if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
7408
- await ic.annotationCls.setAnnoTabIg(bSelection, template);
7409
7432
  });
7410
7433
 
7411
7434
  me.myEventCls.onIds("#" + me.pre + "mn6_alignrefTpl", "click", async function(e) { me.icn3d; //e.preventDefault();
@@ -7414,18 +7437,26 @@ class ClickMenu {
7414
7437
 
7415
7438
  me.myEventCls.onIds("#" + me.pre + "mn6_alignrefTpl_apply", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
7416
7439
  if(!me.cfg.notebook) dialog.dialog( "close" );
7417
-
7440
+
7418
7441
  let template = $("#" + me.pre + "refTpl2").val();
7419
7442
 
7443
+ let selAtoms = me.hashUtilsCls.cloneHash(ic.hAtoms);
7444
+
7420
7445
  // load the template
7421
7446
  let url = me.htmlCls.baseUrl + "icn3d/refpdb/" + template + ".pdb";
7422
7447
  await ic.pdbParserCls.downloadUrl(url, 'pdb', undefined, template);
7423
7448
  thisClass.setLogCmd('load url ' + url + ' | type pdb', true);
7449
+
7450
+ let structure = template.replace(/_/g, '').substr(0,4);
7451
+
7452
+ let chainid = ic.structures[structure][0];
7453
+
7454
+ ic.hAtoms = me.hashUtilsCls.unionHash(selAtoms, ic.chains[chainid]);
7424
7455
 
7425
7456
  // align the template with the selection
7426
7457
  me.cfg.aligntool = 'tmalign';
7427
7458
  await ic.realignParserCls.realignOnStructAlign();
7428
- thisClass.setLogCmd('realign on tmalign', true);
7459
+ thisClass.setLogCmd('realign on tmalign', true);
7429
7460
  });
7430
7461
 
7431
7462
  me.myEventCls.onIds("#" + me.pre + "mn6_igrefNo", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
@@ -37609,9 +37640,10 @@ class AnnoIg {
37609
37640
 
37610
37641
  //Show the annotations of CDD domains and binding sites.
37611
37642
  async showIg(chnid, template) { let ic = this.icn3d; ic.icn3dui;
37612
- if(!ic.bRunRefnum || Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
37643
+ // if(!ic.bRunRefnum || Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
37644
+ if(ic.bRunRefnumAgain) {
37613
37645
  await ic.refnumCls.showIgRefNum(template);
37614
- ic.bRunRefnum = true;
37646
+ // ic.bRunRefnum = true;
37615
37647
  }
37616
37648
 
37617
37649
  let type = 'ig';
@@ -37629,6 +37661,8 @@ class AnnoIg {
37629
37661
  $("#" + ic.pre + "dt_" + type + "_" + chnid).html(html);
37630
37662
  $("#" + ic.pre + "ov_" + type + "_" + chnid).html(html2);
37631
37663
  $("#" + ic.pre + "tt_" + type + "_" + chnid).html(html3);
37664
+
37665
+ ic.bRunRefnumAgain = false;
37632
37666
  }
37633
37667
 
37634
37668
  showAllRefNum(giSeq, chnid) { let ic = this.icn3d; ic.icn3dui;
@@ -38131,6 +38165,7 @@ class AnnoDomain {
38131
38165
  let pdbid = pdbArray[index];
38132
38166
  //let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
38133
38167
 
38168
+ /*
38134
38169
  if(!ic.bResetAnno && index == 0 && ic.mmdb_data !== undefined) {
38135
38170
  for(let chnid in ic.protein_chainid) {
38136
38171
  if(chnid.indexOf(pdbid) !== -1) {
@@ -38146,6 +38181,7 @@ class AnnoDomain {
38146
38181
  }
38147
38182
  }
38148
38183
  else {
38184
+ */
38149
38185
  // calculate 3D domains on-the-fly
38150
38186
  //ic.protein_chainid[chainArray[i]]
38151
38187
  let data = {};
@@ -38187,7 +38223,7 @@ class AnnoDomain {
38187
38223
 
38188
38224
  ic.bAjax3ddomain = true;
38189
38225
  ic.bAjaxDoneArray[index] = true;
38190
- }
38226
+ // }
38191
38227
  }
38192
38228
 
38193
38229
  //Show the annotations of 3D domains.
@@ -39222,6 +39258,10 @@ class Domain3d {
39222
39258
  constructor(icn3d) {
39223
39259
  this.icn3d = icn3d;
39224
39260
 
39261
+ this.init3ddomain();
39262
+ }
39263
+
39264
+ init3ddomain() { let ic = this.icn3d; ic.icn3dui;
39225
39265
  //this.dcut = 8; // threshold for C-alpha interactions
39226
39266
 
39227
39267
  // It seemed the threshold 7 angstrom works better
@@ -39229,7 +39269,8 @@ class Domain3d {
39229
39269
  this.dcut = 8; // threshold for C-alpha interactions
39230
39270
 
39231
39271
  // added by Jiyao
39232
- this.min_contacts = 5; //3; // minimum number of contacts to be considered as neighbors
39272
+ // pdbid 1CD8 requires a min contact 4, not 5
39273
+ this.min_contacts = 4; //5; //3; // minimum number of contacts to be considered as neighbors
39233
39274
 
39234
39275
  this.MAX_SSE = 512;
39235
39276
 
@@ -39241,6 +39282,7 @@ class Domain3d {
39241
39282
 
39242
39283
  //let this.elt_size[this.MAX_SSE]; // element sizes in residues
39243
39284
  this.elt_size = [];
39285
+
39244
39286
  this.elt_size.length = this.MAX_SSE;
39245
39287
 
39246
39288
  //let this.group_num[this.MAX_SSE]; // indicates required element groupings
@@ -39850,6 +39892,8 @@ class Domain3d {
39850
39892
  // x0, y0, z0: array of x,y,z coordinates of C-alpha atoms
39851
39893
  //c2b_NewSplitChain(chnid, dcut) { let ic = this.icn3d, me = ic.icn3dui;
39852
39894
  c2b_NewSplitChain(atoms, dcut) { let ic = this.icn3d; ic.icn3dui;
39895
+ this.init3ddomain();
39896
+
39853
39897
  let x0 = [], y0 = [], z0 = [], resiArray = [];
39854
39898
 
39855
39899
  //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
@@ -42383,7 +42427,11 @@ class Annotation {
42383
42427
  this.updateSsbond();
42384
42428
  this.updateCrosslink();
42385
42429
  await this.updateTransmem();
42430
+
42431
+ ic.bRunRefnumAgain = true;
42386
42432
  await this.updateIg();
42433
+ // ic.bRunRefnumAgain = false;
42434
+
42387
42435
  this.updateInteraction();
42388
42436
  }
42389
42437
  hideAnnoTabAll() { let ic = this.icn3d; ic.icn3dui;
@@ -42465,10 +42513,13 @@ class Annotation {
42465
42513
  $("[id^=" + ic.pre + "transmem]").show();
42466
42514
  }
42467
42515
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
42468
- ic.bRunRefnum = false;
42516
+ // ic.bRunRefnumAgain = true;
42517
+
42469
42518
  await this.updateIg();
42470
42519
 
42471
42520
  $("[id^=" + ic.pre + "ig]").show();
42521
+
42522
+ // ic.bRunRefnumAgain = false;
42472
42523
  }
42473
42524
  }
42474
42525
  setAnnoTabCustom() { let ic = this.icn3d; ic.icn3dui;
@@ -42729,12 +42780,15 @@ class Annotation {
42729
42780
 
42730
42781
  me.myEventCls.onIds("#" + ic.pre + "anno_ig", "click", async function(e) {
42731
42782
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
42732
- if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
42733
- ic.bRunRefnum = false;
42734
- }
42783
+ // if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
42784
+ // ic.bRunRefnum = false;
42785
+ // }
42735
42786
 
42787
+ ic.bRunRefnumAgain = true;
42736
42788
  await thisClass.setAnnoTabIg();
42737
42789
  me.htmlCls.clickMenuCls.setLogCmd("set annotation ig", true);
42790
+
42791
+ // ic.bRunRefnumAgain = false;
42738
42792
  }
42739
42793
  else {
42740
42794
  thisClass.hideAnnoTabIg();
@@ -59959,11 +60013,17 @@ class ApplyCommand {
59959
60013
  await ic.annotationCls.setAnnoTabTransmem();
59960
60014
  }
59961
60015
  else if(command == 'set annotation ig') {
60016
+ ic.bRunRefnumAgain = true;
59962
60017
  await ic.annotationCls.setAnnoTabIg();
60018
+ // ic.bRunRefnumAgain = false;
59963
60019
  }
59964
60020
  else if(command == 'ig refnum on') {
60021
+ ic.bRunRefnumAgain = true;
60022
+
59965
60023
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
59966
60024
  await ic.annotationCls.setAnnoTabIg(true);
60025
+
60026
+ // ic.bRunRefnumAgain = false;
59967
60027
  }
59968
60028
  else if(command == 'highlight level up') {
59969
60029
  ic.resid2specCls.switchHighlightLevelUp();
@@ -62451,9 +62511,7 @@ class LoadScript {
62451
62511
  // }
62452
62512
  else if(command.indexOf('ig template') == 0 ) {
62453
62513
  let template = command.substr(command.lastIndexOf(' ') + 1);
62454
- // await ic.refnumCls.showIgRefNum(template);
62455
- if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
62456
- await ic.annotationCls.setAnnoTabIg(true, template);
62514
+ await me.htmlCls.clickMenuCls.setIgTemplate(template);
62457
62515
  }
62458
62516
  else if(command.indexOf('set annotation 3ddomain') == 0) { // the command may have "|||{"factor"...
62459
62517
  if(Object.keys(ic.proteins).length > 0) {
@@ -62656,8 +62714,12 @@ class LoadScript {
62656
62714
  }
62657
62715
  else if(lastCommand.indexOf('ig refnum on') == 0) {
62658
62716
  // await ic.refnumCls.showIgRefNum();
62717
+ ic.bRunRefnumAgain = true;
62718
+
62659
62719
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
62660
62720
  await ic.annotationCls.setAnnoTabIg(true);
62721
+
62722
+ // ic.bRunRefnumAgain = false;
62661
62723
  }
62662
62724
  else if(lastCommand.indexOf('set annotation 3ddomain') == 0) {
62663
62725
  thisClass.applyCommand3ddomain(lastCommand);
@@ -65654,7 +65716,7 @@ class Dssp {
65654
65716
 
65655
65717
  async hideIgRefNum() { let ic = this.icn3d; ic.icn3dui;
65656
65718
  ic.bShowRefnum = false;
65657
- ic.bRunRefnum = false;
65719
+ // ic.bRunRefnum = false;
65658
65720
 
65659
65721
  // redo all ref numbers
65660
65722
  ic.resid2refnum = {};
@@ -66257,7 +66319,7 @@ class Dssp {
66257
66319
  strandHash[strand] = 1;
66258
66320
  }
66259
66321
  let score = parseFloat(queryData[0].score);
66260
- //!!!
66322
+
66261
66323
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
66262
66324
  // if(!domainid2segs.hasOwnProperty(domainid) ||
66263
66325
  // (score >= parseFloat(ic.domainid2score[domainid].split('_')[0]) + tmAdjust)
@@ -66299,7 +66361,7 @@ class Dssp {
66299
66361
  refpdbnameList.sort(function(a, b) {
66300
66362
  return refpdbname2score[b] - refpdbname2score[a]
66301
66363
  });
66302
- // top 3 templates
66364
+ // top 4 templates
66303
66365
  ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,4);
66304
66366
  }
66305
66367
  }
@@ -66313,7 +66375,7 @@ class Dssp {
66313
66375
 
66314
66376
  let domainid2segs = this.parseAlignData_part1(dataArray, domainidpairArray, bRound1);
66315
66377
 
66316
- // !!!no more Igs to detect
66378
+ // no more Igs to detect
66317
66379
  if(Object.keys(domainid2segs).length == 0) {
66318
66380
  bNoMoreIg = true;
66319
66381
  return bNoMoreIg;
@@ -67062,7 +67124,7 @@ class Dssp {
67062
67124
  }
67063
67125
 
67064
67126
  // in case A1550 is not found, but A1551 is found
67065
- if(!bFoundAnchor && (lastTwo == 51 || lastTwo == 52 || lastTwo == 53 || lastTwo == 54) ) {
67127
+ if(!bFoundAnchor && (lastTwo >= 46 && lastTwo <= 54) ) {
67066
67128
  let offset = lastTwo - 50;
67067
67129
  strandArray[strandCnt].anchorRefnum = refnum - offset;
67068
67130
  strandArray[strandCnt].resCntBfAnchor = resCntBfAnchor - offset;
@@ -75593,7 +75655,7 @@ class iCn3DUI {
75593
75655
  //even when multiple iCn3D viewers are shown together.
75594
75656
  this.pre = this.cfg.divid + "_";
75595
75657
 
75596
- this.REVISION = '3.29.5';
75658
+ this.REVISION = '3.30.0';
75597
75659
 
75598
75660
  // In nodejs, iCn3D defines "window = {navigator: {}}"
75599
75661
  this.bNode = (Object.keys(window).length < 2) ? true : false;