icn3d 3.24.5 → 3.25.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
@@ -10297,8 +10297,8 @@ class SetMenu {
10297
10297
  //}
10298
10298
 
10299
10299
  //!!!
10300
- //html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
10301
- //html += this.getRadio('mn4_clr', 'mn4_clrIgproto', 'Ig Protodomain', undefined, undefined, 2);
10300
+ // html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
10301
+ // html += this.getRadio('mn4_clr', 'mn4_clrIgproto', 'Ig Protodomain', undefined, undefined, 2);
10302
10302
  }
10303
10303
  else {
10304
10304
  //if(!me.cfg.hidelicense) html += this.getRadio('mn4_clr', 'mn1_delphi2', 'DelPhi<br><span style="padding-left:1.5em;">Potential ' + me.htmlCls.licenseStr + '</span>');
@@ -36291,7 +36291,6 @@ class SetOption {
36291
36291
  }
36292
36292
 
36293
36293
  showColorLegend(colorType) { let ic = this.icn3d, me = ic.icn3dui;
36294
- let bClose = false;
36295
36294
 
36296
36295
  let colorLabel = colorType.substr(0, 1).toUpperCase() + colorType.substr(1);
36297
36296
  if(colorType == 'confidence') {
@@ -36403,7 +36402,6 @@ class SetOption {
36403
36402
  }
36404
36403
  else {
36405
36404
  html = '';
36406
- bClose = true;
36407
36405
  }
36408
36406
 
36409
36407
  if(html) {
@@ -36411,9 +36409,9 @@ class SetOption {
36411
36409
  me.htmlCls.dialogCls.openDlg('dl_legend', 'Color Legend');
36412
36410
  }
36413
36411
 
36414
- if(bClose) {
36415
- if(window.dialog && window.dialog.hasClass('ui-dialog-content')) window.dialog.dialog( "close" );
36416
- }
36412
+ // if(bClose) {
36413
+ // if(window.dialog && window.dialog.hasClass('ui-dialog-content')) window.dialog.dialog( "close" );
36414
+ // }
36417
36415
  }
36418
36416
 
36419
36417
  getColorLegendForElem(category, atomHash) { let ic = this.icn3d, me = ic.icn3dui;
@@ -39450,7 +39448,7 @@ class Domain3d {
39450
39448
 
39451
39449
  //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
39452
39450
  let substruct = [];
39453
- // determine residue ranges for each subdomain
39451
+ // determine residue position ranges for each subdomain
39454
39452
  let subdomains = [];
39455
39453
 
39456
39454
  // sheets: array of sheets, each of which has the key: sheet_num (beta sandwich has two sheets, e.g., 0 and 1), adj_strand1 (not used), adj_strand2
@@ -51059,10 +51057,15 @@ class RealignParser {
51059
51057
  //let chainTo = chainidArray[0];
51060
51058
  //let chainFrom = chainidArray[index + 1];
51061
51059
 
51062
- let bChainAlign = true;
51063
-
51060
+ let bChainAlign = true, result;
51064
51061
 
51065
- let result = ic.ParserUtilsCls.alignCoords(coordsFrom, coordsTo, fromStruct, undefined, chainTo, chainFrom, index + 1, bChainAlign);
51062
+ if(ic.bAfMem) { // align to the query (membrane)
51063
+ result = ic.ParserUtilsCls.alignCoords(coordsFrom, coordsTo, toStruct, undefined, chainTo, chainFrom, index + 1, bChainAlign);
51064
+ }
51065
+ else {
51066
+ result = ic.ParserUtilsCls.alignCoords(coordsFrom, coordsTo, fromStruct, undefined, chainTo, chainFrom, index + 1, bChainAlign);
51067
+ }
51068
+
51066
51069
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
51067
51070
 
51068
51071
  // ic.opts['color'] = 'identity';
@@ -51150,13 +51153,13 @@ class RealignParser {
51150
51153
  }
51151
51154
 
51152
51155
  // use the model from Membranome as template
51153
- if(ic.bAfMem && chainidArray.length == 2) {
51154
- if(chainidArray[1].split('_')[0] == pdbidTemplate) {
51155
- let tmp = chainidArray[0];
51156
- chainidArray[0] = chainidArray[1];
51157
- chainidArray[1] = tmp;
51158
- }
51159
- }
51156
+ // if(ic.bAfMem && chainidArray.length == 2) {
51157
+ // if(chainidArray[1].split('_')[0] == pdbidTemplate) {
51158
+ // let tmp = chainidArray[0];
51159
+ // chainidArray[0] = chainidArray[1];
51160
+ // chainidArray[1] = tmp;
51161
+ // }
51162
+ // }
51160
51163
 
51161
51164
  let bRealign = true;
51162
51165
  ic.qt_start_end = []; // reset the alignment
@@ -52635,7 +52638,12 @@ class ParserUtils {
52635
52638
 
52636
52639
  if(n < 4) alert("Please select at least four residues in each structure...");
52637
52640
  if(n >= 4) {
52638
- ic.rmsd_suprTmp = me.rmsdSuprCls.getRmsdSuprCls(coordsFrom, coordsTo, n);
52641
+ if(ic.bAfMem) { // align to the query (membrane)
52642
+ ic.rmsd_suprTmp = me.rmsdSuprCls.getRmsdSuprCls(coordsTo, coordsFrom, n);
52643
+ }
52644
+ else {
52645
+ ic.rmsd_suprTmp = me.rmsdSuprCls.getRmsdSuprCls(coordsFrom, coordsTo, n);
52646
+ }
52639
52647
 
52640
52648
  // apply matrix for each atom
52641
52649
  if(ic.rmsd_suprTmp.rot !== undefined) {
@@ -53274,7 +53282,7 @@ class ParserUtils {
53274
53282
  await ic.showAnnoCls.showAnnotations();
53275
53283
  }
53276
53284
 
53277
- if(me.cfg.closepopup) {
53285
+ if(me.cfg.closepopup || me.cfg.imageonly) {
53278
53286
  ic.resizeCanvasCls.closeDialogs();
53279
53287
  }
53280
53288
  }
@@ -53283,6 +53291,8 @@ class ParserUtils {
53283
53291
  }
53284
53292
  if($("#" + ic.pre + "atomsCustom").length > 0) $("#" + ic.pre + "atomsCustom")[0].blur();
53285
53293
  ic.bInitial = false;
53294
+
53295
+ if(me.cfg.imageonly) ic.saveFileCls.saveFile(undefined, 'png', undefined, true);
53286
53296
  }, 0);
53287
53297
  }
53288
53298
 
@@ -57999,7 +58009,9 @@ class ApplyCommand {
57999
58009
  let msa;
58000
58010
  if(paraArray.length >= 7) msa = paraArray[6].substr(4);
58001
58011
 
58002
- $("#" + ic.pre + "anno_custom")[0].checked = true;
58012
+ if($("#" + ic.pre + "anno_custom")[0]) {
58013
+ $("#" + ic.pre + "anno_custom")[0].checked = true;
58014
+ }
58003
58015
  $("[id^=" + ic.pre + "custom]").show();
58004
58016
 
58005
58017
  if(color == '0') color = undefined;
@@ -60363,7 +60375,7 @@ class LoadScript {
60363
60375
  ic.drawCls.draw();
60364
60376
  }
60365
60377
 
60366
- if(me.cfg.closepopup) {
60378
+ if(me.cfg.closepopup || me.cfg.imageonly) {
60367
60379
  setTimeout(function(){
60368
60380
  ic.resizeCanvasCls.closeDialogs();
60369
60381
  }, 100);
@@ -60374,6 +60386,8 @@ class LoadScript {
60374
60386
  // an extra render to remove artifacts in transparent surface
60375
60387
  if(ic.bTransparentSurface && ic.bRender) ic.drawCls.render();
60376
60388
 
60389
+ if(me.cfg.imageonly) ic.saveFileCls.saveFile(undefined, 'png', undefined, true);
60390
+
60377
60391
  /// if(ic.deferred !== undefined) ic.deferred.resolve(); /// if(ic.deferred2 !== undefined) ic.deferred2.resolve();
60378
60392
  /// if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
60379
60393
  }
@@ -61268,7 +61282,7 @@ class Selection {
61268
61282
 
61269
61283
  ic.reinitAfterLoad();
61270
61284
 
61271
- ic.loadScriptCls.renderFinalStep(1);
61285
+ //ic.loadScriptCls.renderFinalStep(1);
61272
61286
  ic.definedSetsCls.setMode('all');
61273
61287
 
61274
61288
  ic.selectionCls.selectAll();
@@ -61279,6 +61293,8 @@ class Selection {
61279
61293
  ic.hlUpdateCls.removeSeqResidueBkgd();
61280
61294
  ic.hlUpdateCls.removeHl2D();
61281
61295
  ic.hlUpdateCls.removeHlMenus();
61296
+
61297
+ ic.loadScriptCls.renderFinalStep(1);
61282
61298
  }
61283
61299
 
61284
61300
  async loadSelection(dataStr) { let ic = this.icn3d, me = ic.icn3dui;
@@ -61310,16 +61326,18 @@ class Selection {
61310
61326
  if(me.cfg.bSidebyside && structureArray.length == 2) {
61311
61327
  let dividArray = Object.keys(window.icn3duiHash);
61312
61328
  let pos = dividArray.indexOf(ic.divid);
61313
-
61314
61329
  let structure = structureArray[pos];
61315
61330
  let chainArray = ic.structures[structure];
61331
+
61316
61332
  let structAtoms = {};
61317
- for(let i = 0, il = chainArray.length; i < il; ++i) {
61318
- structAtoms = me.hashUtilsCls.unionHash(structAtoms, ic.chains[chainArray[i]]);
61319
- }
61333
+ if(chainArray) {
61334
+ for(let i = 0, il = chainArray.length; i < il; ++i) {
61335
+ structAtoms = me.hashUtilsCls.unionHash(structAtoms, ic.chains[chainArray[i]]);
61336
+ }
61320
61337
 
61321
- ic.dAtoms = me.hashUtilsCls.intHash(structAtoms, ic.dAtoms);
61322
- ic.hAtoms = me.hashUtilsCls.cloneHash(ic.dAtoms);
61338
+ ic.dAtoms = me.hashUtilsCls.intHash(structAtoms, ic.dAtoms);
61339
+ ic.hAtoms = me.hashUtilsCls.cloneHash(ic.dAtoms);
61340
+ }
61323
61341
  }
61324
61342
  }
61325
61343
 
@@ -62841,14 +62859,17 @@ class Dssp {
62841
62859
  async showIgRefNum() { let ic = this.icn3d, me = ic.icn3dui;
62842
62860
  let thisClass = this;
62843
62861
 
62844
- if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
62845
- ic.bShowRefnum = true;
62862
+ // if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
62863
+ // ic.bShowRefnum = true;
62846
62864
 
62847
- // open sequence view
62848
- ic.hAtomsRefnum = {};
62849
- ic.bResetAnno = true;
62850
- await ic.showAnnoCls.showAnnotations();
62851
- ic.annotationCls.setAnnoViewAndDisplay('detailed view');
62865
+ // // open sequence view
62866
+ // ic.hAtomsRefnum = {};
62867
+ // ic.bResetAnno = true;
62868
+ // await ic.showAnnoCls.showAnnotations();
62869
+ // ic.annotationCls.setAnnoViewAndDisplay('detailed view');
62870
+ // }
62871
+ if(ic.pdbDataArray) {
62872
+ await thisClass.parseRefPdbData(ic.pdbDataArray);
62852
62873
  }
62853
62874
  else {
62854
62875
  //ic.refpdbArray = ['1bqu_fn3', '1cd8_igv', '1t6v_vnar', '1wio_c2', '1wio_igv', '2atp_a', '2atp_b', '2dm3_iset', '5esv_vh', '5esv_vl', '6al5_cd19', '7bz5_cl1', '7bz5_vh', '7bz5_vl'];
@@ -62911,6 +62932,7 @@ class Dssp {
62911
62932
 
62912
62933
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
62913
62934
 
62935
+ // if(!ic.resid2domainid) ic.resid2domainid = {};
62914
62936
  ic.resid2domainid = {};
62915
62937
 
62916
62938
  for(let i = 0, il = struArray.length; i < il; ++i) {
@@ -62924,20 +62946,33 @@ class Dssp {
62924
62946
  && !ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getMiddleAtomObj(ic.chains[chainid]).serial)) continue;
62925
62947
  if(ic.chainsSeq[chainid].length < 50) continue; // peptide
62926
62948
 
62949
+ let currAtoms = me.hashUtilsCls.intHash(ic.chains[chainid], ic.hAtoms);
62950
+ if(Object.keys(currAtoms).length == 0) continue;
62951
+
62927
62952
  // align each 3D domain with reference structure
62928
- let result = ic.domain3dCls.c2b_NewSplitChain(ic.chains[chainid]);
62953
+ //let result = ic.domain3dCls.c2b_NewSplitChain(ic.chains[chainid]);
62954
+ // assign ref numbers to selected residues
62955
+ let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms);
62929
62956
  let subdomains = result.subdomains;
62957
+ let pos2resi = result.pos2resi;
62930
62958
 
62931
62959
  let domainAtomsArray = [];
62932
62960
  if(subdomains.length <= 1) {
62933
- domainAtomsArray.push(ic.chains[chainid]);
62961
+ //domainAtomsArray.push(ic.chains[chainid]);
62962
+ domainAtomsArray.push(currAtoms);
62934
62963
 
62935
- for(let n = 0, nl = ic.chainsSeq[chainid].length; n < nl; ++n) {
62936
- let resid = chainid + '_' + ic.chainsSeq[chainid][n].resi;
62964
+ // for(let n = 0, nl = ic.chainsSeq[chainid].length; n < nl; ++n) {
62965
+ // let resid = chainid + '_' + ic.chainsSeq[chainid][n].resi;
62966
+ // ic.resid2domainid[resid] = chainid + '-0';
62967
+ // }
62968
+
62969
+ let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
62970
+ for(let n = 0, nl = residueArray.length; n < nl; ++n) {
62971
+ let resid = residueArray[n];
62937
62972
  ic.resid2domainid[resid] = chainid + '-0';
62938
- }
62973
+ }
62939
62974
  }
62940
- else {
62975
+ else {
62941
62976
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
62942
62977
  let domainAtoms = {};
62943
62978
  let segArray = subdomains[k];
@@ -62946,8 +62981,9 @@ class Dssp {
62946
62981
  let startResi = segArray[m];
62947
62982
  let endResi = segArray[m+1];
62948
62983
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
62949
- let residNCBI = chainid + '_' + n;
62950
- let resid = ic.ncbi2resid[residNCBI];
62984
+ //let residNCBI = chainid + '_' + n;
62985
+ //let resid = ic.ncbi2resid[residNCBI];
62986
+ let resid = chainid + '_' + pos2resi[n];
62951
62987
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
62952
62988
  ic.resid2domainid[resid] = chainid + '-' + k;
62953
62989
  }
@@ -63013,6 +63049,12 @@ class Dssp {
63013
63049
 
63014
63050
  // find the best alignment for each chain
63015
63051
  let domainid2score = {}, domainid2segs = {}, chainid2segs = {};
63052
+
63053
+ // if(!ic.chainid2index) ic.chainid2index = {};
63054
+ // if(!ic.domainid2index) ic.domainid2index = {};
63055
+ // if(!ic.domainid2ig2kabat) ic.domainid2ig2kabat = {};
63056
+ // if(!ic.domainid2ig2imgt) ic.domainid2ig2imgt = {};
63057
+
63016
63058
  ic.chainid2index = {};
63017
63059
  ic.domainid2index = {};
63018
63060
  ic.domainid2ig2kabat = {};
@@ -67122,7 +67164,9 @@ class SaveFile {
67122
67164
  //The type "png" is used to save the current canvas image. The type "html" is used to save html file with the
67123
67165
  //"data". This can be used to save any text. The type "text" is used to save an array of text, where "data" is
67124
67166
  //actually an array. The type "binary" is used to save an array of binary, where "data" is actually an array.
67125
- saveFile(filename, type, text) { let ic = this.icn3d, me = ic.icn3dui;
67167
+ saveFile(filename, type, text, bBlob) { let ic = this.icn3d, me = ic.icn3dui;
67168
+ let thisClass = this;
67169
+
67126
67170
  //Save file
67127
67171
  let blob;
67128
67172
 
@@ -67173,18 +67217,18 @@ class SaveFile {
67173
67217
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
67174
67218
 
67175
67219
  //if(window.navigator.msSaveBlob) navigator.msSaveBlob(blob, filename);
67176
- saveAs(blob, filename);
67220
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67177
67221
 
67178
- return;
67222
+ return blob;
67179
67223
  };
67180
67224
 
67181
67225
  reader.readAsArrayBuffer(blob);
67182
67226
  }
67183
67227
  else {
67184
67228
  //ic.createLinkForBlob(blob, filename);
67185
- saveAs(blob, filename);
67229
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67186
67230
 
67187
- return;
67231
+ return blob;
67188
67232
  }
67189
67233
  }
67190
67234
  else {
@@ -67199,9 +67243,9 @@ class SaveFile {
67199
67243
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
67200
67244
 
67201
67245
  //ic.createLinkForBlob(blob, filename);
67202
- saveAs(blob, filename);
67246
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67203
67247
 
67204
- return;
67248
+ return blob;
67205
67249
  };
67206
67250
 
67207
67251
  reader.readAsArrayBuffer(data);
@@ -67210,9 +67254,9 @@ class SaveFile {
67210
67254
  blob = data;
67211
67255
 
67212
67256
  //ic.createLinkForBlob(blob, filename);
67213
- saveAs(blob, filename);
67257
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67214
67258
 
67215
- return;
67259
+ return blob;
67216
67260
  }
67217
67261
  });
67218
67262
  }
@@ -67250,6 +67294,37 @@ class SaveFile {
67250
67294
  //https://github.com/eligrey/FileSaver.js/
67251
67295
  saveAs(blob, filename);
67252
67296
  }
67297
+
67298
+ return blob;
67299
+ }
67300
+
67301
+ saveBlob(blob, filename, bBlob, width, height) { let ic = this.icn3d; ic.icn3dui;
67302
+ if(bBlob) {
67303
+ let urlCreator = window.URL || window.webkitURL;
67304
+ let imageUrl = urlCreator.createObjectURL(blob);
67305
+
67306
+ let url = ic.shareLinkCls.shareLinkUrl();
67307
+
67308
+ let bTooLong =(url.length > 4000 || url.indexOf('http') !== 0) ? true : false;
67309
+
67310
+ if(bTooLong || (ic.bInputfile && !ic.bInputUrlfile)) {
67311
+ $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
67312
+ }
67313
+ else {
67314
+ $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
67315
+ }
67316
+
67317
+ $("#" + ic.pre + "viewer").height(height);
67318
+ $("#" + ic.pre + "mnlist").hide();
67319
+ $("#" + ic.pre + "cmdlog").hide();
67320
+ $("#" + ic.pre + "title").hide();
67321
+
67322
+ // clear memory
67323
+ ic = {};
67324
+ }
67325
+ else {
67326
+ saveAs(blob, filename);
67327
+ }
67253
67328
  }
67254
67329
 
67255
67330
  saveSvg(id, filename, bContactmap) { let ic = this.icn3d, me = ic.icn3dui;
@@ -67874,7 +67949,9 @@ class SaveFile {
67874
67949
  $("#" + ic.pre + "title").html(title);
67875
67950
  }
67876
67951
  else if(structureArray.length == 1) {
67877
- let url = this.getLinkToStructureSummary();
67952
+ //let url = this.getLinkToStructureSummary();
67953
+ let url = (isNaN(ic.inputid) && ic.inputid.length > 5) ? 'https://alphafold.ebi.ac.uk/entry/' + ic.inputid : 'https://www.ncbi.nlm.nih.gov/structure/?term=' + ic.inputid;
67954
+
67878
67955
  this.setStructureTitle(url, title, titlelinkColor);
67879
67956
  }
67880
67957
  }
@@ -68302,6 +68379,7 @@ class ShareLink {
68302
68379
  if(ic.structures !== undefined && Object.keys(ic.structures).length == 1 && ic.inputid !== undefined) {
68303
68380
  id = Object.keys(ic.structures)[0];
68304
68381
  url = url.replace(new RegExp(id + '_','g'), '!');
68382
+ outputCmd = outputCmd.replace(new RegExp(id + '_','g'), '!');
68305
68383
  }
68306
68384
 
68307
68385
  if(me.cfg.blast_rep_id !== undefined) {
@@ -71167,7 +71245,7 @@ class iCn3DUI {
71167
71245
  //even when multiple iCn3D viewers are shown together.
71168
71246
  this.pre = this.cfg.divid + "_";
71169
71247
 
71170
- this.REVISION = '3.24.2';
71248
+ this.REVISION = '3.25.0';
71171
71249
 
71172
71250
  // In nodejs, iCn3D defines "window = {navigator: {}}"
71173
71251
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -71181,6 +71259,7 @@ class iCn3DUI {
71181
71259
  if(this.cfg.showcommand === undefined) this.cfg.showcommand = true;
71182
71260
  //if(this.cfg.simplemenu === undefined) this.cfg.simplemenu = false;
71183
71261
  if(this.cfg.mobilemenu === undefined) this.cfg.mobilemenu = false;
71262
+ if(this.cfg.imageonly === undefined) this.cfg.imageonly = false;
71184
71263
  if(this.cfg.closepopup === undefined) this.cfg.closepopup = false;
71185
71264
  if(this.cfg.showanno === undefined) this.cfg.showanno = false;
71186
71265
  if(this.cfg.showseq === undefined) this.cfg.showseq = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icn3d",
3
- "version": "3.24.5",
3
+ "version": "3.25.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {