icn3d 3.24.6 → 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>');
@@ -39448,7 +39448,7 @@ class Domain3d {
39448
39448
 
39449
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
39450
39450
  let substruct = [];
39451
- // determine residue ranges for each subdomain
39451
+ // determine residue position ranges for each subdomain
39452
39452
  let subdomains = [];
39453
39453
 
39454
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
@@ -51057,10 +51057,15 @@ class RealignParser {
51057
51057
  //let chainTo = chainidArray[0];
51058
51058
  //let chainFrom = chainidArray[index + 1];
51059
51059
 
51060
- let bChainAlign = true;
51060
+ let bChainAlign = true, result;
51061
51061
 
51062
-
51063
- 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
+
51064
51069
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
51065
51070
 
51066
51071
  // ic.opts['color'] = 'identity';
@@ -51148,13 +51153,13 @@ class RealignParser {
51148
51153
  }
51149
51154
 
51150
51155
  // use the model from Membranome as template
51151
- if(ic.bAfMem && chainidArray.length == 2) {
51152
- if(chainidArray[1].split('_')[0] == pdbidTemplate) {
51153
- let tmp = chainidArray[0];
51154
- chainidArray[0] = chainidArray[1];
51155
- chainidArray[1] = tmp;
51156
- }
51157
- }
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
+ // }
51158
51163
 
51159
51164
  let bRealign = true;
51160
51165
  ic.qt_start_end = []; // reset the alignment
@@ -52633,7 +52638,12 @@ class ParserUtils {
52633
52638
 
52634
52639
  if(n < 4) alert("Please select at least four residues in each structure...");
52635
52640
  if(n >= 4) {
52636
- 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
+ }
52637
52647
 
52638
52648
  // apply matrix for each atom
52639
52649
  if(ic.rmsd_suprTmp.rot !== undefined) {
@@ -53272,7 +53282,7 @@ class ParserUtils {
53272
53282
  await ic.showAnnoCls.showAnnotations();
53273
53283
  }
53274
53284
 
53275
- if(me.cfg.closepopup) {
53285
+ if(me.cfg.closepopup || me.cfg.imageonly) {
53276
53286
  ic.resizeCanvasCls.closeDialogs();
53277
53287
  }
53278
53288
  }
@@ -53281,6 +53291,8 @@ class ParserUtils {
53281
53291
  }
53282
53292
  if($("#" + ic.pre + "atomsCustom").length > 0) $("#" + ic.pre + "atomsCustom")[0].blur();
53283
53293
  ic.bInitial = false;
53294
+
53295
+ if(me.cfg.imageonly) ic.saveFileCls.saveFile(undefined, 'png', undefined, true);
53284
53296
  }, 0);
53285
53297
  }
53286
53298
 
@@ -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;
@@ -62843,14 +62859,17 @@ class Dssp {
62843
62859
  async showIgRefNum() { let ic = this.icn3d, me = ic.icn3dui;
62844
62860
  let thisClass = this;
62845
62861
 
62846
- if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
62847
- ic.bShowRefnum = true;
62862
+ // if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
62863
+ // ic.bShowRefnum = true;
62848
62864
 
62849
- // open sequence view
62850
- ic.hAtomsRefnum = {};
62851
- ic.bResetAnno = true;
62852
- await ic.showAnnoCls.showAnnotations();
62853
- 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);
62854
62873
  }
62855
62874
  else {
62856
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'];
@@ -62913,6 +62932,7 @@ class Dssp {
62913
62932
 
62914
62933
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
62915
62934
 
62935
+ // if(!ic.resid2domainid) ic.resid2domainid = {};
62916
62936
  ic.resid2domainid = {};
62917
62937
 
62918
62938
  for(let i = 0, il = struArray.length; i < il; ++i) {
@@ -62926,20 +62946,33 @@ class Dssp {
62926
62946
  && !ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getMiddleAtomObj(ic.chains[chainid]).serial)) continue;
62927
62947
  if(ic.chainsSeq[chainid].length < 50) continue; // peptide
62928
62948
 
62949
+ let currAtoms = me.hashUtilsCls.intHash(ic.chains[chainid], ic.hAtoms);
62950
+ if(Object.keys(currAtoms).length == 0) continue;
62951
+
62929
62952
  // align each 3D domain with reference structure
62930
- 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);
62931
62956
  let subdomains = result.subdomains;
62957
+ let pos2resi = result.pos2resi;
62932
62958
 
62933
62959
  let domainAtomsArray = [];
62934
62960
  if(subdomains.length <= 1) {
62935
- domainAtomsArray.push(ic.chains[chainid]);
62961
+ //domainAtomsArray.push(ic.chains[chainid]);
62962
+ domainAtomsArray.push(currAtoms);
62936
62963
 
62937
- for(let n = 0, nl = ic.chainsSeq[chainid].length; n < nl; ++n) {
62938
- 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];
62939
62972
  ic.resid2domainid[resid] = chainid + '-0';
62940
- }
62973
+ }
62941
62974
  }
62942
- else {
62975
+ else {
62943
62976
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
62944
62977
  let domainAtoms = {};
62945
62978
  let segArray = subdomains[k];
@@ -62948,8 +62981,9 @@ class Dssp {
62948
62981
  let startResi = segArray[m];
62949
62982
  let endResi = segArray[m+1];
62950
62983
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
62951
- let residNCBI = chainid + '_' + n;
62952
- let resid = ic.ncbi2resid[residNCBI];
62984
+ //let residNCBI = chainid + '_' + n;
62985
+ //let resid = ic.ncbi2resid[residNCBI];
62986
+ let resid = chainid + '_' + pos2resi[n];
62953
62987
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
62954
62988
  ic.resid2domainid[resid] = chainid + '-' + k;
62955
62989
  }
@@ -63015,6 +63049,12 @@ class Dssp {
63015
63049
 
63016
63050
  // find the best alignment for each chain
63017
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
+
63018
63058
  ic.chainid2index = {};
63019
63059
  ic.domainid2index = {};
63020
63060
  ic.domainid2ig2kabat = {};
@@ -67124,7 +67164,9 @@ class SaveFile {
67124
67164
  //The type "png" is used to save the current canvas image. The type "html" is used to save html file with the
67125
67165
  //"data". This can be used to save any text. The type "text" is used to save an array of text, where "data" is
67126
67166
  //actually an array. The type "binary" is used to save an array of binary, where "data" is actually an array.
67127
- 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
+
67128
67170
  //Save file
67129
67171
  let blob;
67130
67172
 
@@ -67175,18 +67217,18 @@ class SaveFile {
67175
67217
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
67176
67218
 
67177
67219
  //if(window.navigator.msSaveBlob) navigator.msSaveBlob(blob, filename);
67178
- saveAs(blob, filename);
67220
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67179
67221
 
67180
- return;
67222
+ return blob;
67181
67223
  };
67182
67224
 
67183
67225
  reader.readAsArrayBuffer(blob);
67184
67226
  }
67185
67227
  else {
67186
67228
  //ic.createLinkForBlob(blob, filename);
67187
- saveAs(blob, filename);
67229
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67188
67230
 
67189
- return;
67231
+ return blob;
67190
67232
  }
67191
67233
  }
67192
67234
  else {
@@ -67201,9 +67243,9 @@ class SaveFile {
67201
67243
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
67202
67244
 
67203
67245
  //ic.createLinkForBlob(blob, filename);
67204
- saveAs(blob, filename);
67246
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67205
67247
 
67206
- return;
67248
+ return blob;
67207
67249
  };
67208
67250
 
67209
67251
  reader.readAsArrayBuffer(data);
@@ -67212,9 +67254,9 @@ class SaveFile {
67212
67254
  blob = data;
67213
67255
 
67214
67256
  //ic.createLinkForBlob(blob, filename);
67215
- saveAs(blob, filename);
67257
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
67216
67258
 
67217
- return;
67259
+ return blob;
67218
67260
  }
67219
67261
  });
67220
67262
  }
@@ -67252,6 +67294,37 @@ class SaveFile {
67252
67294
  //https://github.com/eligrey/FileSaver.js/
67253
67295
  saveAs(blob, filename);
67254
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
+ }
67255
67328
  }
67256
67329
 
67257
67330
  saveSvg(id, filename, bContactmap) { let ic = this.icn3d, me = ic.icn3dui;
@@ -67876,7 +67949,9 @@ class SaveFile {
67876
67949
  $("#" + ic.pre + "title").html(title);
67877
67950
  }
67878
67951
  else if(structureArray.length == 1) {
67879
- 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
+
67880
67955
  this.setStructureTitle(url, title, titlelinkColor);
67881
67956
  }
67882
67957
  }
@@ -68304,6 +68379,7 @@ class ShareLink {
68304
68379
  if(ic.structures !== undefined && Object.keys(ic.structures).length == 1 && ic.inputid !== undefined) {
68305
68380
  id = Object.keys(ic.structures)[0];
68306
68381
  url = url.replace(new RegExp(id + '_','g'), '!');
68382
+ outputCmd = outputCmd.replace(new RegExp(id + '_','g'), '!');
68307
68383
  }
68308
68384
 
68309
68385
  if(me.cfg.blast_rep_id !== undefined) {
@@ -71169,7 +71245,7 @@ class iCn3DUI {
71169
71245
  //even when multiple iCn3D viewers are shown together.
71170
71246
  this.pre = this.cfg.divid + "_";
71171
71247
 
71172
- this.REVISION = '3.24.2';
71248
+ this.REVISION = '3.25.0';
71173
71249
 
71174
71250
  // In nodejs, iCn3D defines "window = {navigator: {}}"
71175
71251
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -71183,6 +71259,7 @@ class iCn3DUI {
71183
71259
  if(this.cfg.showcommand === undefined) this.cfg.showcommand = true;
71184
71260
  //if(this.cfg.simplemenu === undefined) this.cfg.simplemenu = false;
71185
71261
  if(this.cfg.mobilemenu === undefined) this.cfg.mobilemenu = false;
71262
+ if(this.cfg.imageonly === undefined) this.cfg.imageonly = false;
71186
71263
  if(this.cfg.closepopup === undefined) this.cfg.closepopup = false;
71187
71264
  if(this.cfg.showanno === undefined) this.cfg.showanno = false;
71188
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.6",
3
+ "version": "3.25.0",
4
4
  "main": "./icn3d.js",
5
5
  "exports": {
6
6
  ".": {