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.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();
@@ -36881,8 +36912,9 @@ class AnnoCddSite {
36881
36912
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
36882
36913
 
36883
36914
  if(me.cfg.blast_rep_id != chnid) { // regular
36915
+ let color;
36884
36916
  for(let i = 0, il = fromArray.length; i < il; ++i) {
36885
- let color = this.getColorFromPos(chnid, fromArray[i], titleArray);
36917
+ if(i == 0) color = this.getColorFromPos(chnid, fromArray[i], titleArray);
36886
36918
 
36887
36919
  let emptyWidth;
36888
36920
  // if(titleArray) {
@@ -37608,9 +37640,10 @@ class AnnoIg {
37608
37640
 
37609
37641
  //Show the annotations of CDD domains and binding sites.
37610
37642
  async showIg(chnid, template) { let ic = this.icn3d; ic.icn3dui;
37611
- 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) {
37612
37645
  await ic.refnumCls.showIgRefNum(template);
37613
- ic.bRunRefnum = true;
37646
+ // ic.bRunRefnum = true;
37614
37647
  }
37615
37648
 
37616
37649
  let type = 'ig';
@@ -37628,6 +37661,8 @@ class AnnoIg {
37628
37661
  $("#" + ic.pre + "dt_" + type + "_" + chnid).html(html);
37629
37662
  $("#" + ic.pre + "ov_" + type + "_" + chnid).html(html2);
37630
37663
  $("#" + ic.pre + "tt_" + type + "_" + chnid).html(html3);
37664
+
37665
+ ic.bRunRefnumAgain = false;
37631
37666
  }
37632
37667
 
37633
37668
  showAllRefNum(giSeq, chnid) { let ic = this.icn3d; ic.icn3dui;
@@ -37919,19 +37954,24 @@ class AnnoIg {
37919
37954
  html2 += htmlTitle;
37920
37955
  html2 += htmlCnt + '<span class="icn3d-seqLine">';
37921
37956
 
37957
+ let prevDomainindex, color;
37922
37958
  for(let i = 0, il = fromArray.length; i < il; ++i) {
37923
37959
  let resi = ic.ParserUtilsCls.getResi(chnid, fromArray[i]);
37924
37960
  let resid = chnid + "_" + resi;
37925
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
37926
- let colorStr =(!atom || atom.color === undefined || atom.color.getHexString() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
37927
- let color =(atom && atom.color !== undefined) ? colorStr : "CCCCCC";
37928
37961
 
37929
37962
  let domainindex = posindex2domainindex[fromArray[i]];
37963
+ if(domainindex != prevDomainindex) {
37964
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
37965
+ let colorStr =(!atom || atom.color === undefined || atom.color.getHexString() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
37966
+ color =(atom && atom.color !== undefined) ? colorStr : "CCCCCC";
37967
+ }
37930
37968
 
37931
37969
  let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i]) / ic.maxAnnoLength) :
37932
37970
  Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
37933
37971
  html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
37934
37972
  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>';
37973
+
37974
+ prevDomainindex = domainindex;
37935
37975
  }
37936
37976
 
37937
37977
  html2 += htmlCnt;
@@ -38125,6 +38165,7 @@ class AnnoDomain {
38125
38165
  let pdbid = pdbArray[index];
38126
38166
  //let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
38127
38167
 
38168
+ /*
38128
38169
  if(!ic.bResetAnno && index == 0 && ic.mmdb_data !== undefined) {
38129
38170
  for(let chnid in ic.protein_chainid) {
38130
38171
  if(chnid.indexOf(pdbid) !== -1) {
@@ -38140,6 +38181,7 @@ class AnnoDomain {
38140
38181
  }
38141
38182
  }
38142
38183
  else {
38184
+ */
38143
38185
  // calculate 3D domains on-the-fly
38144
38186
  //ic.protein_chainid[chainArray[i]]
38145
38187
  let data = {};
@@ -38181,7 +38223,7 @@ class AnnoDomain {
38181
38223
 
38182
38224
  ic.bAjax3ddomain = true;
38183
38225
  ic.bAjaxDoneArray[index] = true;
38184
- }
38226
+ // }
38185
38227
  }
38186
38228
 
38187
38229
  //Show the annotations of 3D domains.
@@ -39216,6 +39258,10 @@ class Domain3d {
39216
39258
  constructor(icn3d) {
39217
39259
  this.icn3d = icn3d;
39218
39260
 
39261
+ this.init3ddomain();
39262
+ }
39263
+
39264
+ init3ddomain() { let ic = this.icn3d; ic.icn3dui;
39219
39265
  //this.dcut = 8; // threshold for C-alpha interactions
39220
39266
 
39221
39267
  // It seemed the threshold 7 angstrom works better
@@ -39223,7 +39269,8 @@ class Domain3d {
39223
39269
  this.dcut = 8; // threshold for C-alpha interactions
39224
39270
 
39225
39271
  // added by Jiyao
39226
- 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
39227
39274
 
39228
39275
  this.MAX_SSE = 512;
39229
39276
 
@@ -39235,6 +39282,7 @@ class Domain3d {
39235
39282
 
39236
39283
  //let this.elt_size[this.MAX_SSE]; // element sizes in residues
39237
39284
  this.elt_size = [];
39285
+
39238
39286
  this.elt_size.length = this.MAX_SSE;
39239
39287
 
39240
39288
  //let this.group_num[this.MAX_SSE]; // indicates required element groupings
@@ -39844,6 +39892,8 @@ class Domain3d {
39844
39892
  // x0, y0, z0: array of x,y,z coordinates of C-alpha atoms
39845
39893
  //c2b_NewSplitChain(chnid, dcut) { let ic = this.icn3d, me = ic.icn3dui;
39846
39894
  c2b_NewSplitChain(atoms, dcut) { let ic = this.icn3d; ic.icn3dui;
39895
+ this.init3ddomain();
39896
+
39847
39897
  let x0 = [], y0 = [], z0 = [], resiArray = [];
39848
39898
 
39849
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
@@ -42377,7 +42427,11 @@ class Annotation {
42377
42427
  this.updateSsbond();
42378
42428
  this.updateCrosslink();
42379
42429
  await this.updateTransmem();
42430
+
42431
+ ic.bRunRefnumAgain = true;
42380
42432
  await this.updateIg();
42433
+ // ic.bRunRefnumAgain = false;
42434
+
42381
42435
  this.updateInteraction();
42382
42436
  }
42383
42437
  hideAnnoTabAll() { let ic = this.icn3d; ic.icn3dui;
@@ -42459,10 +42513,13 @@ class Annotation {
42459
42513
  $("[id^=" + ic.pre + "transmem]").show();
42460
42514
  }
42461
42515
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
42462
- ic.bRunRefnum = false;
42516
+ // ic.bRunRefnumAgain = true;
42517
+
42463
42518
  await this.updateIg();
42464
42519
 
42465
42520
  $("[id^=" + ic.pre + "ig]").show();
42521
+
42522
+ // ic.bRunRefnumAgain = false;
42466
42523
  }
42467
42524
  }
42468
42525
  setAnnoTabCustom() { let ic = this.icn3d; ic.icn3dui;
@@ -42723,12 +42780,15 @@ class Annotation {
42723
42780
 
42724
42781
  me.myEventCls.onIds("#" + ic.pre + "anno_ig", "click", async function(e) {
42725
42782
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
42726
- if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
42727
- ic.bRunRefnum = false;
42728
- }
42783
+ // if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
42784
+ // ic.bRunRefnum = false;
42785
+ // }
42729
42786
 
42787
+ ic.bRunRefnumAgain = true;
42730
42788
  await thisClass.setAnnoTabIg();
42731
42789
  me.htmlCls.clickMenuCls.setLogCmd("set annotation ig", true);
42790
+
42791
+ // ic.bRunRefnumAgain = false;
42732
42792
  }
42733
42793
  else {
42734
42794
  thisClass.hideAnnoTabIg();
@@ -59953,11 +60013,17 @@ class ApplyCommand {
59953
60013
  await ic.annotationCls.setAnnoTabTransmem();
59954
60014
  }
59955
60015
  else if(command == 'set annotation ig') {
60016
+ ic.bRunRefnumAgain = true;
59956
60017
  await ic.annotationCls.setAnnoTabIg();
60018
+ // ic.bRunRefnumAgain = false;
59957
60019
  }
59958
60020
  else if(command == 'ig refnum on') {
60021
+ ic.bRunRefnumAgain = true;
60022
+
59959
60023
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
59960
60024
  await ic.annotationCls.setAnnoTabIg(true);
60025
+
60026
+ // ic.bRunRefnumAgain = false;
59961
60027
  }
59962
60028
  else if(command == 'highlight level up') {
59963
60029
  ic.resid2specCls.switchHighlightLevelUp();
@@ -62445,9 +62511,7 @@ class LoadScript {
62445
62511
  // }
62446
62512
  else if(command.indexOf('ig template') == 0 ) {
62447
62513
  let template = command.substr(command.lastIndexOf(' ') + 1);
62448
- // await ic.refnumCls.showIgRefNum(template);
62449
- if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
62450
- await ic.annotationCls.setAnnoTabIg(true, template);
62514
+ await me.htmlCls.clickMenuCls.setIgTemplate(template);
62451
62515
  }
62452
62516
  else if(command.indexOf('set annotation 3ddomain') == 0) { // the command may have "|||{"factor"...
62453
62517
  if(Object.keys(ic.proteins).length > 0) {
@@ -62650,8 +62714,12 @@ class LoadScript {
62650
62714
  }
62651
62715
  else if(lastCommand.indexOf('ig refnum on') == 0) {
62652
62716
  // await ic.refnumCls.showIgRefNum();
62717
+ ic.bRunRefnumAgain = true;
62718
+
62653
62719
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
62654
62720
  await ic.annotationCls.setAnnoTabIg(true);
62721
+
62722
+ // ic.bRunRefnumAgain = false;
62655
62723
  }
62656
62724
  else if(lastCommand.indexOf('set annotation 3ddomain') == 0) {
62657
62725
  thisClass.applyCommand3ddomain(lastCommand);
@@ -65648,7 +65716,7 @@ class Dssp {
65648
65716
 
65649
65717
  async hideIgRefNum() { let ic = this.icn3d; ic.icn3dui;
65650
65718
  ic.bShowRefnum = false;
65651
- ic.bRunRefnum = false;
65719
+ // ic.bRunRefnum = false;
65652
65720
 
65653
65721
  // redo all ref numbers
65654
65722
  ic.resid2refnum = {};
@@ -66024,9 +66092,9 @@ class Dssp {
66024
66092
 
66025
66093
  if(bRerunDomain) {
66026
66094
  let atomsAssigned = {};
66027
- //ic.resid2refnum_ori should be used
66028
- for(let resid in ic.resid2refnum_ori) {
66029
- atomsAssigned = me.hashUtilsCls.unionHash(atomsAssigned, ic.residues[resid]);
66095
+ // for(let resid in ic.resid2refnum_ori) {
66096
+ for(let resid in ic.resid2domainid) {
66097
+ if(ic.resid2domainid[resid]) atomsAssigned = me.hashUtilsCls.unionHash(atomsAssigned, ic.residues[resid]);
66030
66098
  }
66031
66099
 
66032
66100
  currAtoms = me.hashUtilsCls.exclHash(currAtoms, atomsAssigned);
@@ -66251,7 +66319,7 @@ class Dssp {
66251
66319
  strandHash[strand] = 1;
66252
66320
  }
66253
66321
  let score = parseFloat(queryData[0].score);
66254
- //!!!
66322
+
66255
66323
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
66256
66324
  // if(!domainid2segs.hasOwnProperty(domainid) ||
66257
66325
  // (score >= parseFloat(ic.domainid2score[domainid].split('_')[0]) + tmAdjust)
@@ -66283,24 +66351,22 @@ class Dssp {
66283
66351
  }
66284
66352
 
66285
66353
  //!!!
66286
- /*
66287
- // combine the top three clusters for the 2nd round alignment
66354
+
66355
+ // combine the top four clusters for the 2nd round alignment
66288
66356
  if(bRound1) {
66289
66357
  for(let domainid in domainid2refpdbnamelist) {
66290
- if(!me.bNode) console.log("###score " + ic.domainid2score[domainid].split('_')[0] + " ic.domainid2refpdbname[domainid][0] " + ic.domainid2refpdbname[domainid][0])
66291
66358
  if(!me.bNode && ic.domainid2refpdbname[domainid][0] == 'all_templates') {
66292
66359
  let refpdbname2score = domainid2refpdbnamelist[domainid];
66293
66360
  let refpdbnameList = Object.keys(refpdbname2score);
66294
66361
  refpdbnameList.sort(function(a, b) {
66295
66362
  return refpdbname2score[b] - refpdbname2score[a]
66296
66363
  });
66297
- // top 3 templates
66298
- ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,3);
66364
+ // top 4 templates
66365
+ ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,4);
66299
66366
  }
66300
- if(!me.bNode) console.log("###bb ic.domainid2refpdbname[domainid] " + ic.domainid2refpdbname[domainid])
66301
66367
  }
66302
66368
  }
66303
- */
66369
+
66304
66370
  return domainid2segs; // only used in round 2
66305
66371
  }
66306
66372
 
@@ -66309,7 +66375,7 @@ class Dssp {
66309
66375
 
66310
66376
  let domainid2segs = this.parseAlignData_part1(dataArray, domainidpairArray, bRound1);
66311
66377
 
66312
- // !!!no more Igs to detect
66378
+ // no more Igs to detect
66313
66379
  if(Object.keys(domainid2segs).length == 0) {
66314
66380
  bNoMoreIg = true;
66315
66381
  return bNoMoreIg;
@@ -67058,7 +67124,7 @@ class Dssp {
67058
67124
  }
67059
67125
 
67060
67126
  // in case A1550 is not found, but A1551 is found
67061
- if(!bFoundAnchor && (lastTwo == 51 || lastTwo == 52 || lastTwo == 53 || lastTwo == 54) ) {
67127
+ if(!bFoundAnchor && (lastTwo >= 46 && lastTwo <= 54) ) {
67062
67128
  let offset = lastTwo - 50;
67063
67129
  strandArray[strandCnt].anchorRefnum = refnum - offset;
67064
67130
  strandArray[strandCnt].resCntBfAnchor = resCntBfAnchor - offset;
@@ -67167,6 +67233,7 @@ class Dssp {
67167
67233
  let currResid = chnid + '_' + currResi;
67168
67234
  delete ic.residIgLoop[currResid];
67169
67235
  ic.resid2domainid[currResid] = domainid;
67236
+ ic.resid2refnum_ori[currResid] = 1; // a hash to check which residues were assigned
67170
67237
  }
67171
67238
 
67172
67239
  break;
@@ -67200,6 +67267,7 @@ class Dssp {
67200
67267
  let currResid = chnid + '_' + currResi;
67201
67268
  delete ic.residIgLoop[currResid];
67202
67269
  ic.resid2domainid[currResid] = domainid;
67270
+ ic.resid2refnum_ori[currResid] = 1; // a hash to check which residues were assigned
67203
67271
  }
67204
67272
 
67205
67273
  break;
@@ -75587,7 +75655,7 @@ class iCn3DUI {
75587
75655
  //even when multiple iCn3D viewers are shown together.
75588
75656
  this.pre = this.cfg.divid + "_";
75589
75657
 
75590
- this.REVISION = '3.29.5';
75658
+ this.REVISION = '3.30.0';
75591
75659
 
75592
75660
  // In nodejs, iCn3D defines "window = {navigator: {}}"
75593
75661
  this.bNode = (Object.keys(window).length < 2) ? true : false;