icn3d 3.29.17 → 3.30.1

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 = {};
@@ -38160,6 +38196,7 @@ class AnnoDomain {
38160
38196
 
38161
38197
  let result = ic.domain3dCls.c2b_NewSplitChain(atoms);
38162
38198
  let subdomains = result.subdomains;
38199
+ let pos2resi = result.pos2resi;
38163
38200
  //let substruct = result.substruct;
38164
38201
  //let jsonStr = ic.domain3dCls.getDomainJsonForAlign(atoms);
38165
38202
 
@@ -38174,6 +38211,8 @@ class AnnoDomain {
38174
38211
 
38175
38212
  data.domains[chainid].domains.push(domain);
38176
38213
  }
38214
+
38215
+ data.domains[chainid].pos2resi = pos2resi;
38177
38216
  }
38178
38217
  }
38179
38218
 
@@ -38187,7 +38226,7 @@ class AnnoDomain {
38187
38226
 
38188
38227
  ic.bAjax3ddomain = true;
38189
38228
  ic.bAjaxDoneArray[index] = true;
38190
- }
38229
+ // }
38191
38230
  }
38192
38231
 
38193
38232
  //Show the annotations of 3D domains.
@@ -38210,7 +38249,7 @@ class AnnoDomain {
38210
38249
  let html = '<div id="' + ic.pre + chnid + '_domainseq_sequence" class="icn3d-dl_sequence">';
38211
38250
  let html2 = html;
38212
38251
  let html3 = html;
38213
- let domainArray, proteinname;
38252
+ let domainArray, pos2resi, proteinname;
38214
38253
  let pos = chnid.indexOf('_');
38215
38254
  let chain = chnid.substr(pos + 1);
38216
38255
  // MMDB symmetry chain has the form of 'A1'
@@ -38218,9 +38257,11 @@ class AnnoDomain {
38218
38257
  chain = chain.substr(0, chain.length - 1);
38219
38258
  }
38220
38259
 
38221
- if(bCalcDirect) {
38260
+ // if(bCalcDirect) {
38222
38261
  proteinname = chnid;
38223
38262
  domainArray = (data.domains[chnid]) ? data.domains[chnid].domains : [];
38263
+ pos2resi = data.domains[chnid].pos2resi;
38264
+ /*
38224
38265
  }
38225
38266
  else {
38226
38267
  let molinfo = data.moleculeInfor;
@@ -38239,6 +38280,7 @@ class AnnoDomain {
38239
38280
  domainArray = [];
38240
38281
  }
38241
38282
  }
38283
+ */
38242
38284
 
38243
38285
  for(let index = 0, indexl = domainArray.length; index < indexl; ++index) {
38244
38286
  //var fulltitle = '3D domain ' +(index+1).toString() + ' of ' + proteinname + '(PDB ID: ' + data.pdbId + ')';
@@ -38252,8 +38294,11 @@ class AnnoDomain {
38252
38294
  let resCnt = 0;
38253
38295
 
38254
38296
  for(let i = 0, il = subdomainArray.length; i < il; ++i) {
38255
- let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
38256
- let domainTo = Math.round(subdomainArray[i][1]) - 1;
38297
+ // let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
38298
+ // let domainTo = Math.round(subdomainArray[i][1]) - 1;
38299
+ let domainFrom = Math.round(subdomainArray[i][0]); // convert 1-based to 0-based
38300
+ let domainTo = Math.round(subdomainArray[i][1]);
38301
+
38257
38302
  if(domainFromHash.hasOwnProperty(domainFrom) || domainToHash.hasOwnProperty(domainTo)) {
38258
38303
  continue; // do nothing for duplicated "from" or "to", e.g, PDBID 1ITW, 5FWI
38259
38304
  }
@@ -38264,8 +38309,8 @@ class AnnoDomain {
38264
38309
 
38265
38310
  // use the NCBI residue number, and convert to PDB residue number during selection
38266
38311
  // if(ic.bNCBI || bCalcDirect) {
38267
- fromArray.push(domainFrom);
38268
- toArray.push(domainTo);
38312
+ fromArray.push(pos2resi[domainFrom]);
38313
+ toArray.push(pos2resi[domainTo]);
38269
38314
  // }
38270
38315
  // else {
38271
38316
  // fromArray.push(domainFrom + ic.baseResi[chnid]);
@@ -38274,7 +38319,9 @@ class AnnoDomain {
38274
38319
 
38275
38320
  resCnt += domainTo - domainFrom + 1;
38276
38321
  for(let j = domainFrom; j <= domainTo; ++j) {
38277
- resiHash[j+1] = 1;
38322
+ // resiHash[j+1] = 1;
38323
+ let resi = pos2resi[j];
38324
+ resiHash[resi] = 1;
38278
38325
  }
38279
38326
  }
38280
38327
 
@@ -38290,7 +38337,8 @@ class AnnoDomain {
38290
38337
  for(let j = from; j <= to; ++j) {
38291
38338
  // 0-based
38292
38339
  let obj = {};
38293
- let resi = ic.ParserUtilsCls.getResi(chnid, j);
38340
+ // let resi = ic.ParserUtilsCls.getResi(chnid, j);
38341
+ let resi = pos2resi[j];
38294
38342
  obj[chnid + '_' + resi] = domainName;
38295
38343
  ic.resid2domain[chnid].push(obj);
38296
38344
  }
@@ -38311,7 +38359,8 @@ class AnnoDomain {
38311
38359
  html += ic.showSeqCls.insertGap(chnid, i, '-');
38312
38360
  //if(i >= domainFrom && i <= domainTo) {
38313
38361
  let resi = ic.ParserUtilsCls.getResi(chnid, i);
38314
- if(resiHash.hasOwnProperty(i+1)) {
38362
+ // if(resiHash.hasOwnProperty(i+1)) {
38363
+ if(resiHash.hasOwnProperty(resi)) {
38315
38364
  let cFull = ic.giSeq[chnid][i];
38316
38365
  let c = cFull;
38317
38366
  if(cFull.length > 1) {
@@ -39222,6 +39271,10 @@ class Domain3d {
39222
39271
  constructor(icn3d) {
39223
39272
  this.icn3d = icn3d;
39224
39273
 
39274
+ this.init3ddomain();
39275
+ }
39276
+
39277
+ init3ddomain() { let ic = this.icn3d; ic.icn3dui;
39225
39278
  //this.dcut = 8; // threshold for C-alpha interactions
39226
39279
 
39227
39280
  // It seemed the threshold 7 angstrom works better
@@ -39229,7 +39282,8 @@ class Domain3d {
39229
39282
  this.dcut = 8; // threshold for C-alpha interactions
39230
39283
 
39231
39284
  // added by Jiyao
39232
- this.min_contacts = 5; //3; // minimum number of contacts to be considered as neighbors
39285
+ // pdbid 1CD8 requires a min contact 4, not 5
39286
+ this.min_contacts = 4; //5; //3; // minimum number of contacts to be considered as neighbors
39233
39287
 
39234
39288
  this.MAX_SSE = 512;
39235
39289
 
@@ -39241,6 +39295,7 @@ class Domain3d {
39241
39295
 
39242
39296
  //let this.elt_size[this.MAX_SSE]; // element sizes in residues
39243
39297
  this.elt_size = [];
39298
+
39244
39299
  this.elt_size.length = this.MAX_SSE;
39245
39300
 
39246
39301
  //let this.group_num[this.MAX_SSE]; // indicates required element groupings
@@ -39850,6 +39905,8 @@ class Domain3d {
39850
39905
  // x0, y0, z0: array of x,y,z coordinates of C-alpha atoms
39851
39906
  //c2b_NewSplitChain(chnid, dcut) { let ic = this.icn3d, me = ic.icn3dui;
39852
39907
  c2b_NewSplitChain(atoms, dcut) { let ic = this.icn3d; ic.icn3dui;
39908
+ this.init3ddomain();
39909
+
39853
39910
  let x0 = [], y0 = [], z0 = [], resiArray = [];
39854
39911
 
39855
39912
  //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
@@ -39948,7 +40005,7 @@ class Domain3d {
39948
40005
  // get a list of Calpha-Calpha contacts
39949
40006
  ///list< pair< pair< int, let >, let > >
39950
40007
  let cts = this.c2b_AlphaContacts(seqLen, x0, y0, z0, dcut, resiArray);
39951
-
40008
+
39952
40009
  //
39953
40010
  // Produce a "map" of the SSEs, i.e. vec_sse[i] = 0 means residue i + 1
39954
40011
  // is in a loop, and vec_sse[i] = k means residue i + 1 belongs to SSE
@@ -42383,7 +42440,11 @@ class Annotation {
42383
42440
  this.updateSsbond();
42384
42441
  this.updateCrosslink();
42385
42442
  await this.updateTransmem();
42443
+
42444
+ ic.bRunRefnumAgain = true;
42386
42445
  await this.updateIg();
42446
+ // ic.bRunRefnumAgain = false;
42447
+
42387
42448
  this.updateInteraction();
42388
42449
  }
42389
42450
  hideAnnoTabAll() { let ic = this.icn3d; ic.icn3dui;
@@ -42465,10 +42526,13 @@ class Annotation {
42465
42526
  $("[id^=" + ic.pre + "transmem]").show();
42466
42527
  }
42467
42528
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
42468
- ic.bRunRefnum = false;
42529
+ // ic.bRunRefnumAgain = true;
42530
+
42469
42531
  await this.updateIg();
42470
42532
 
42471
42533
  $("[id^=" + ic.pre + "ig]").show();
42534
+
42535
+ // ic.bRunRefnumAgain = false;
42472
42536
  }
42473
42537
  }
42474
42538
  setAnnoTabCustom() { let ic = this.icn3d; ic.icn3dui;
@@ -42729,12 +42793,15 @@ class Annotation {
42729
42793
 
42730
42794
  me.myEventCls.onIds("#" + ic.pre + "anno_ig", "click", async function(e) {
42731
42795
  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
- }
42796
+ // if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
42797
+ // ic.bRunRefnum = false;
42798
+ // }
42735
42799
 
42800
+ ic.bRunRefnumAgain = true;
42736
42801
  await thisClass.setAnnoTabIg();
42737
42802
  me.htmlCls.clickMenuCls.setLogCmd("set annotation ig", true);
42803
+
42804
+ // ic.bRunRefnumAgain = false;
42738
42805
  }
42739
42806
  else {
42740
42807
  thisClass.hideAnnoTabIg();
@@ -59959,11 +60026,17 @@ class ApplyCommand {
59959
60026
  await ic.annotationCls.setAnnoTabTransmem();
59960
60027
  }
59961
60028
  else if(command == 'set annotation ig') {
60029
+ ic.bRunRefnumAgain = true;
59962
60030
  await ic.annotationCls.setAnnoTabIg();
60031
+ // ic.bRunRefnumAgain = false;
59963
60032
  }
59964
60033
  else if(command == 'ig refnum on') {
60034
+ ic.bRunRefnumAgain = true;
60035
+
59965
60036
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
59966
60037
  await ic.annotationCls.setAnnoTabIg(true);
60038
+
60039
+ // ic.bRunRefnumAgain = false;
59967
60040
  }
59968
60041
  else if(command == 'highlight level up') {
59969
60042
  ic.resid2specCls.switchHighlightLevelUp();
@@ -62451,9 +62524,7 @@ class LoadScript {
62451
62524
  // }
62452
62525
  else if(command.indexOf('ig template') == 0 ) {
62453
62526
  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);
62527
+ await me.htmlCls.clickMenuCls.setIgTemplate(template);
62457
62528
  }
62458
62529
  else if(command.indexOf('set annotation 3ddomain') == 0) { // the command may have "|||{"factor"...
62459
62530
  if(Object.keys(ic.proteins).length > 0) {
@@ -62656,8 +62727,12 @@ class LoadScript {
62656
62727
  }
62657
62728
  else if(lastCommand.indexOf('ig refnum on') == 0) {
62658
62729
  // await ic.refnumCls.showIgRefNum();
62730
+ ic.bRunRefnumAgain = true;
62731
+
62659
62732
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
62660
62733
  await ic.annotationCls.setAnnoTabIg(true);
62734
+
62735
+ // ic.bRunRefnumAgain = false;
62661
62736
  }
62662
62737
  else if(lastCommand.indexOf('set annotation 3ddomain') == 0) {
62663
62738
  thisClass.applyCommand3ddomain(lastCommand);
@@ -65654,7 +65729,7 @@ class Dssp {
65654
65729
 
65655
65730
  async hideIgRefNum() { let ic = this.icn3d; ic.icn3dui;
65656
65731
  ic.bShowRefnum = false;
65657
- ic.bRunRefnum = false;
65732
+ // ic.bRunRefnum = false;
65658
65733
 
65659
65734
  // redo all ref numbers
65660
65735
  ic.resid2refnum = {};
@@ -66257,7 +66332,7 @@ class Dssp {
66257
66332
  strandHash[strand] = 1;
66258
66333
  }
66259
66334
  let score = parseFloat(queryData[0].score);
66260
- //!!!
66335
+
66261
66336
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
66262
66337
  // if(!domainid2segs.hasOwnProperty(domainid) ||
66263
66338
  // (score >= parseFloat(ic.domainid2score[domainid].split('_')[0]) + tmAdjust)
@@ -66299,7 +66374,7 @@ class Dssp {
66299
66374
  refpdbnameList.sort(function(a, b) {
66300
66375
  return refpdbname2score[b] - refpdbname2score[a]
66301
66376
  });
66302
- // top 3 templates
66377
+ // top 4 templates
66303
66378
  ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,4);
66304
66379
  }
66305
66380
  }
@@ -66313,7 +66388,7 @@ class Dssp {
66313
66388
 
66314
66389
  let domainid2segs = this.parseAlignData_part1(dataArray, domainidpairArray, bRound1);
66315
66390
 
66316
- // !!!no more Igs to detect
66391
+ // no more Igs to detect
66317
66392
  if(Object.keys(domainid2segs).length == 0) {
66318
66393
  bNoMoreIg = true;
66319
66394
  return bNoMoreIg;
@@ -67062,7 +67137,7 @@ class Dssp {
67062
67137
  }
67063
67138
 
67064
67139
  // in case A1550 is not found, but A1551 is found
67065
- if(!bFoundAnchor && (lastTwo == 51 || lastTwo == 52 || lastTwo == 53 || lastTwo == 54) ) {
67140
+ if(!bFoundAnchor && (lastTwo >= 46 && lastTwo <= 54) ) {
67066
67141
  let offset = lastTwo - 50;
67067
67142
  strandArray[strandCnt].anchorRefnum = refnum - offset;
67068
67143
  strandArray[strandCnt].resCntBfAnchor = resCntBfAnchor - offset;
@@ -75593,7 +75668,7 @@ class iCn3DUI {
75593
75668
  //even when multiple iCn3D viewers are shown together.
75594
75669
  this.pre = this.cfg.divid + "_";
75595
75670
 
75596
- this.REVISION = '3.29.5';
75671
+ this.REVISION = '3.30.0';
75597
75672
 
75598
75673
  // In nodejs, iCn3D defines "window = {navigator: {}}"
75599
75674
  this.bNode = (Object.keys(window).length < 2) ? true : false;