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.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();
@@ -38510,9 +38541,10 @@ class AnnoIg {
38510
38541
 
38511
38542
  //Show the annotations of CDD domains and binding sites.
38512
38543
  async showIg(chnid, template) { let ic = this.icn3d; ic.icn3dui;
38513
- 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) {
38514
38546
  await ic.refnumCls.showIgRefNum(template);
38515
- ic.bRunRefnum = true;
38547
+ // ic.bRunRefnum = true;
38516
38548
  }
38517
38549
 
38518
38550
  let type = 'ig';
@@ -38530,6 +38562,8 @@ class AnnoIg {
38530
38562
  $("#" + ic.pre + "dt_" + type + "_" + chnid).html(html);
38531
38563
  $("#" + ic.pre + "ov_" + type + "_" + chnid).html(html2);
38532
38564
  $("#" + ic.pre + "tt_" + type + "_" + chnid).html(html3);
38565
+
38566
+ ic.bRunRefnumAgain = false;
38533
38567
  }
38534
38568
 
38535
38569
  showAllRefNum(giSeq, chnid) { let ic = this.icn3d; ic.icn3dui;
@@ -39032,6 +39066,7 @@ class AnnoDomain {
39032
39066
  let pdbid = pdbArray[index];
39033
39067
  //let url = me.htmlCls.baseUrl + "mmdb/mmdb_strview.cgi?v=2&program=icn3d&domain&molinfor&uid=" + pdbid;
39034
39068
 
39069
+ /*
39035
39070
  if(!ic.bResetAnno && index == 0 && ic.mmdb_data !== undefined) {
39036
39071
  for(let chnid in ic.protein_chainid) {
39037
39072
  if(chnid.indexOf(pdbid) !== -1) {
@@ -39047,6 +39082,7 @@ class AnnoDomain {
39047
39082
  }
39048
39083
  }
39049
39084
  else {
39085
+ */
39050
39086
  // calculate 3D domains on-the-fly
39051
39087
  //ic.protein_chainid[chainArray[i]]
39052
39088
  let data = {};
@@ -39061,6 +39097,7 @@ class AnnoDomain {
39061
39097
 
39062
39098
  let result = ic.domain3dCls.c2b_NewSplitChain(atoms);
39063
39099
  let subdomains = result.subdomains;
39100
+ let pos2resi = result.pos2resi;
39064
39101
  //let substruct = result.substruct;
39065
39102
  //let jsonStr = ic.domain3dCls.getDomainJsonForAlign(atoms);
39066
39103
 
@@ -39075,6 +39112,8 @@ class AnnoDomain {
39075
39112
 
39076
39113
  data.domains[chainid].domains.push(domain);
39077
39114
  }
39115
+
39116
+ data.domains[chainid].pos2resi = pos2resi;
39078
39117
  }
39079
39118
  }
39080
39119
 
@@ -39088,7 +39127,7 @@ class AnnoDomain {
39088
39127
 
39089
39128
  ic.bAjax3ddomain = true;
39090
39129
  ic.bAjaxDoneArray[index] = true;
39091
- }
39130
+ // }
39092
39131
  }
39093
39132
 
39094
39133
  //Show the annotations of 3D domains.
@@ -39111,7 +39150,7 @@ class AnnoDomain {
39111
39150
  let html = '<div id="' + ic.pre + chnid + '_domainseq_sequence" class="icn3d-dl_sequence">';
39112
39151
  let html2 = html;
39113
39152
  let html3 = html;
39114
- let domainArray, proteinname;
39153
+ let domainArray, pos2resi, proteinname;
39115
39154
  let pos = chnid.indexOf('_');
39116
39155
  let chain = chnid.substr(pos + 1);
39117
39156
  // MMDB symmetry chain has the form of 'A1'
@@ -39119,9 +39158,11 @@ class AnnoDomain {
39119
39158
  chain = chain.substr(0, chain.length - 1);
39120
39159
  }
39121
39160
 
39122
- if(bCalcDirect) {
39161
+ // if(bCalcDirect) {
39123
39162
  proteinname = chnid;
39124
39163
  domainArray = (data.domains[chnid]) ? data.domains[chnid].domains : [];
39164
+ pos2resi = data.domains[chnid].pos2resi;
39165
+ /*
39125
39166
  }
39126
39167
  else {
39127
39168
  let molinfo = data.moleculeInfor;
@@ -39140,6 +39181,7 @@ class AnnoDomain {
39140
39181
  domainArray = [];
39141
39182
  }
39142
39183
  }
39184
+ */
39143
39185
 
39144
39186
  for(let index = 0, indexl = domainArray.length; index < indexl; ++index) {
39145
39187
  //var fulltitle = '3D domain ' +(index+1).toString() + ' of ' + proteinname + '(PDB ID: ' + data.pdbId + ')';
@@ -39153,8 +39195,11 @@ class AnnoDomain {
39153
39195
  let resCnt = 0;
39154
39196
 
39155
39197
  for(let i = 0, il = subdomainArray.length; i < il; ++i) {
39156
- let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
39157
- let domainTo = Math.round(subdomainArray[i][1]) - 1;
39198
+ // let domainFrom = Math.round(subdomainArray[i][0]) - 1; // convert 1-based to 0-based
39199
+ // let domainTo = Math.round(subdomainArray[i][1]) - 1;
39200
+ let domainFrom = Math.round(subdomainArray[i][0]); // convert 1-based to 0-based
39201
+ let domainTo = Math.round(subdomainArray[i][1]);
39202
+
39158
39203
  if(domainFromHash.hasOwnProperty(domainFrom) || domainToHash.hasOwnProperty(domainTo)) {
39159
39204
  continue; // do nothing for duplicated "from" or "to", e.g, PDBID 1ITW, 5FWI
39160
39205
  }
@@ -39165,8 +39210,8 @@ class AnnoDomain {
39165
39210
 
39166
39211
  // use the NCBI residue number, and convert to PDB residue number during selection
39167
39212
  // if(ic.bNCBI || bCalcDirect) {
39168
- fromArray.push(domainFrom);
39169
- toArray.push(domainTo);
39213
+ fromArray.push(pos2resi[domainFrom]);
39214
+ toArray.push(pos2resi[domainTo]);
39170
39215
  // }
39171
39216
  // else {
39172
39217
  // fromArray.push(domainFrom + ic.baseResi[chnid]);
@@ -39175,7 +39220,9 @@ class AnnoDomain {
39175
39220
 
39176
39221
  resCnt += domainTo - domainFrom + 1;
39177
39222
  for(let j = domainFrom; j <= domainTo; ++j) {
39178
- resiHash[j+1] = 1;
39223
+ // resiHash[j+1] = 1;
39224
+ let resi = pos2resi[j];
39225
+ resiHash[resi] = 1;
39179
39226
  }
39180
39227
  }
39181
39228
 
@@ -39191,7 +39238,8 @@ class AnnoDomain {
39191
39238
  for(let j = from; j <= to; ++j) {
39192
39239
  // 0-based
39193
39240
  let obj = {};
39194
- let resi = ic.ParserUtilsCls.getResi(chnid, j);
39241
+ // let resi = ic.ParserUtilsCls.getResi(chnid, j);
39242
+ let resi = pos2resi[j];
39195
39243
  obj[chnid + '_' + resi] = domainName;
39196
39244
  ic.resid2domain[chnid].push(obj);
39197
39245
  }
@@ -39212,7 +39260,8 @@ class AnnoDomain {
39212
39260
  html += ic.showSeqCls.insertGap(chnid, i, '-');
39213
39261
  //if(i >= domainFrom && i <= domainTo) {
39214
39262
  let resi = ic.ParserUtilsCls.getResi(chnid, i);
39215
- if(resiHash.hasOwnProperty(i+1)) {
39263
+ // if(resiHash.hasOwnProperty(i+1)) {
39264
+ if(resiHash.hasOwnProperty(resi)) {
39216
39265
  let cFull = ic.giSeq[chnid][i];
39217
39266
  let c = cFull;
39218
39267
  if(cFull.length > 1) {
@@ -40123,6 +40172,10 @@ class Domain3d {
40123
40172
  constructor(icn3d) {
40124
40173
  this.icn3d = icn3d;
40125
40174
 
40175
+ this.init3ddomain();
40176
+ }
40177
+
40178
+ init3ddomain() { let ic = this.icn3d; ic.icn3dui;
40126
40179
  //this.dcut = 8; // threshold for C-alpha interactions
40127
40180
 
40128
40181
  // It seemed the threshold 7 angstrom works better
@@ -40130,7 +40183,8 @@ class Domain3d {
40130
40183
  this.dcut = 8; // threshold for C-alpha interactions
40131
40184
 
40132
40185
  // added by Jiyao
40133
- this.min_contacts = 5; //3; // minimum number of contacts to be considered as neighbors
40186
+ // pdbid 1CD8 requires a min contact 4, not 5
40187
+ this.min_contacts = 4; //5; //3; // minimum number of contacts to be considered as neighbors
40134
40188
 
40135
40189
  this.MAX_SSE = 512;
40136
40190
 
@@ -40142,6 +40196,7 @@ class Domain3d {
40142
40196
 
40143
40197
  //let this.elt_size[this.MAX_SSE]; // element sizes in residues
40144
40198
  this.elt_size = [];
40199
+
40145
40200
  this.elt_size.length = this.MAX_SSE;
40146
40201
 
40147
40202
  //let this.group_num[this.MAX_SSE]; // indicates required element groupings
@@ -40751,6 +40806,8 @@ class Domain3d {
40751
40806
  // x0, y0, z0: array of x,y,z coordinates of C-alpha atoms
40752
40807
  //c2b_NewSplitChain(chnid, dcut) { let ic = this.icn3d, me = ic.icn3dui;
40753
40808
  c2b_NewSplitChain(atoms, dcut) { let ic = this.icn3d; ic.icn3dui;
40809
+ this.init3ddomain();
40810
+
40754
40811
  let x0 = [], y0 = [], z0 = [], resiArray = [];
40755
40812
 
40756
40813
  //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
@@ -40849,7 +40906,7 @@ class Domain3d {
40849
40906
  // get a list of Calpha-Calpha contacts
40850
40907
  ///list< pair< pair< int, let >, let > >
40851
40908
  let cts = this.c2b_AlphaContacts(seqLen, x0, y0, z0, dcut, resiArray);
40852
-
40909
+
40853
40910
  //
40854
40911
  // Produce a "map" of the SSEs, i.e. vec_sse[i] = 0 means residue i + 1
40855
40912
  // is in a loop, and vec_sse[i] = k means residue i + 1 belongs to SSE
@@ -43284,7 +43341,11 @@ class Annotation {
43284
43341
  this.updateSsbond();
43285
43342
  this.updateCrosslink();
43286
43343
  await this.updateTransmem();
43344
+
43345
+ ic.bRunRefnumAgain = true;
43287
43346
  await this.updateIg();
43347
+ // ic.bRunRefnumAgain = false;
43348
+
43288
43349
  this.updateInteraction();
43289
43350
  }
43290
43351
  hideAnnoTabAll() { let ic = this.icn3d; ic.icn3dui;
@@ -43366,10 +43427,13 @@ class Annotation {
43366
43427
  $("[id^=" + ic.pre + "transmem]").show();
43367
43428
  }
43368
43429
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
43369
- ic.bRunRefnum = false;
43430
+ // ic.bRunRefnumAgain = true;
43431
+
43370
43432
  await this.updateIg();
43371
43433
 
43372
43434
  $("[id^=" + ic.pre + "ig]").show();
43435
+
43436
+ // ic.bRunRefnumAgain = false;
43373
43437
  }
43374
43438
  }
43375
43439
  setAnnoTabCustom() { let ic = this.icn3d; ic.icn3dui;
@@ -43630,12 +43694,15 @@ class Annotation {
43630
43694
 
43631
43695
  me.myEventCls.onIds("#" + ic.pre + "anno_ig", "click", async function(e) {
43632
43696
  if($("#" + ic.pre + "anno_ig").length && $("#" + ic.pre + "anno_ig")[0].checked) {
43633
- if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
43634
- ic.bRunRefnum = false;
43635
- }
43697
+ // if(Object.keys(ic.atoms).length > Object.keys(ic.hAtoms).length) {
43698
+ // ic.bRunRefnum = false;
43699
+ // }
43636
43700
 
43701
+ ic.bRunRefnumAgain = true;
43637
43702
  await thisClass.setAnnoTabIg();
43638
43703
  me.htmlCls.clickMenuCls.setLogCmd("set annotation ig", true);
43704
+
43705
+ // ic.bRunRefnumAgain = false;
43639
43706
  }
43640
43707
  else {
43641
43708
  thisClass.hideAnnoTabIg();
@@ -60860,11 +60927,17 @@ class ApplyCommand {
60860
60927
  await ic.annotationCls.setAnnoTabTransmem();
60861
60928
  }
60862
60929
  else if(command == 'set annotation ig') {
60930
+ ic.bRunRefnumAgain = true;
60863
60931
  await ic.annotationCls.setAnnoTabIg();
60932
+ // ic.bRunRefnumAgain = false;
60864
60933
  }
60865
60934
  else if(command == 'ig refnum on') {
60935
+ ic.bRunRefnumAgain = true;
60936
+
60866
60937
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
60867
60938
  await ic.annotationCls.setAnnoTabIg(true);
60939
+
60940
+ // ic.bRunRefnumAgain = false;
60868
60941
  }
60869
60942
  else if(command == 'highlight level up') {
60870
60943
  ic.resid2specCls.switchHighlightLevelUp();
@@ -63352,9 +63425,7 @@ class LoadScript {
63352
63425
  // }
63353
63426
  else if(command.indexOf('ig template') == 0 ) {
63354
63427
  let template = command.substr(command.lastIndexOf(' ') + 1);
63355
- // await ic.refnumCls.showIgRefNum(template);
63356
- if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
63357
- await ic.annotationCls.setAnnoTabIg(true, template);
63428
+ await me.htmlCls.clickMenuCls.setIgTemplate(template);
63358
63429
  }
63359
63430
  else if(command.indexOf('set annotation 3ddomain') == 0) { // the command may have "|||{"factor"...
63360
63431
  if(Object.keys(ic.proteins).length > 0) {
@@ -63557,8 +63628,12 @@ class LoadScript {
63557
63628
  }
63558
63629
  else if(lastCommand.indexOf('ig refnum on') == 0) {
63559
63630
  // await ic.refnumCls.showIgRefNum();
63631
+ ic.bRunRefnumAgain = true;
63632
+
63560
63633
  if(!ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
63561
63634
  await ic.annotationCls.setAnnoTabIg(true);
63635
+
63636
+ // ic.bRunRefnumAgain = false;
63562
63637
  }
63563
63638
  else if(lastCommand.indexOf('set annotation 3ddomain') == 0) {
63564
63639
  thisClass.applyCommand3ddomain(lastCommand);
@@ -66555,7 +66630,7 @@ class Dssp {
66555
66630
 
66556
66631
  async hideIgRefNum() { let ic = this.icn3d; ic.icn3dui;
66557
66632
  ic.bShowRefnum = false;
66558
- ic.bRunRefnum = false;
66633
+ // ic.bRunRefnum = false;
66559
66634
 
66560
66635
  // redo all ref numbers
66561
66636
  ic.resid2refnum = {};
@@ -67158,7 +67233,7 @@ class Dssp {
67158
67233
  strandHash[strand] = 1;
67159
67234
  }
67160
67235
  let score = parseFloat(queryData[0].score);
67161
- //!!!
67236
+
67162
67237
  // if the TM score difference is within 0.1 and more strands are found, use the template with more strands
67163
67238
  // if(!domainid2segs.hasOwnProperty(domainid) ||
67164
67239
  // (score >= parseFloat(ic.domainid2score[domainid].split('_')[0]) + tmAdjust)
@@ -67200,7 +67275,7 @@ class Dssp {
67200
67275
  refpdbnameList.sort(function(a, b) {
67201
67276
  return refpdbname2score[b] - refpdbname2score[a]
67202
67277
  });
67203
- // top 3 templates
67278
+ // top 4 templates
67204
67279
  ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,4);
67205
67280
  }
67206
67281
  }
@@ -67214,7 +67289,7 @@ class Dssp {
67214
67289
 
67215
67290
  let domainid2segs = this.parseAlignData_part1(dataArray, domainidpairArray, bRound1);
67216
67291
 
67217
- // !!!no more Igs to detect
67292
+ // no more Igs to detect
67218
67293
  if(Object.keys(domainid2segs).length == 0) {
67219
67294
  bNoMoreIg = true;
67220
67295
  return bNoMoreIg;
@@ -67963,7 +68038,7 @@ class Dssp {
67963
68038
  }
67964
68039
 
67965
68040
  // in case A1550 is not found, but A1551 is found
67966
- if(!bFoundAnchor && (lastTwo == 51 || lastTwo == 52 || lastTwo == 53 || lastTwo == 54) ) {
68041
+ if(!bFoundAnchor && (lastTwo >= 46 && lastTwo <= 54) ) {
67967
68042
  let offset = lastTwo - 50;
67968
68043
  strandArray[strandCnt].anchorRefnum = refnum - offset;
67969
68044
  strandArray[strandCnt].resCntBfAnchor = resCntBfAnchor - offset;
@@ -76494,7 +76569,7 @@ class iCn3DUI {
76494
76569
  //even when multiple iCn3D viewers are shown together.
76495
76570
  this.pre = this.cfg.divid + "_";
76496
76571
 
76497
- this.REVISION = '3.29.5';
76572
+ this.REVISION = '3.30.0';
76498
76573
 
76499
76574
  // In nodejs, iCn3D defines "window = {navigator: {}}"
76500
76575
  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.17",
3
+ "version": "3.30.1",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {