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.js CHANGED
@@ -9396,8 +9396,8 @@ class SetMenu {
9396
9396
  //}
9397
9397
 
9398
9398
  //!!!
9399
- //html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
9400
- //html += this.getRadio('mn4_clr', 'mn4_clrIgproto', 'Ig Protodomain', undefined, undefined, 2);
9399
+ // html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
9400
+ // html += this.getRadio('mn4_clr', 'mn4_clrIgproto', 'Ig Protodomain', undefined, undefined, 2);
9401
9401
  }
9402
9402
  else {
9403
9403
  //if(!me.cfg.hidelicense) html += this.getRadio('mn4_clr', 'mn1_delphi2', 'DelPhi<br><span style="padding-left:1.5em;">Potential ' + me.htmlCls.licenseStr + '</span>');
@@ -38547,7 +38547,7 @@ class Domain3d {
38547
38547
 
38548
38548
  //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
38549
38549
  let substruct = [];
38550
- // determine residue ranges for each subdomain
38550
+ // determine residue position ranges for each subdomain
38551
38551
  let subdomains = [];
38552
38552
 
38553
38553
  // 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
@@ -50156,10 +50156,15 @@ class RealignParser {
50156
50156
  //let chainTo = chainidArray[0];
50157
50157
  //let chainFrom = chainidArray[index + 1];
50158
50158
 
50159
- let bChainAlign = true;
50159
+ let bChainAlign = true, result;
50160
50160
 
50161
-
50162
- let result = ic.ParserUtilsCls.alignCoords(coordsFrom, coordsTo, fromStruct, undefined, chainTo, chainFrom, index + 1, bChainAlign);
50161
+ if(ic.bAfMem) { // align to the query (membrane)
50162
+ result = ic.ParserUtilsCls.alignCoords(coordsFrom, coordsTo, toStruct, undefined, chainTo, chainFrom, index + 1, bChainAlign);
50163
+ }
50164
+ else {
50165
+ result = ic.ParserUtilsCls.alignCoords(coordsFrom, coordsTo, fromStruct, undefined, chainTo, chainFrom, index + 1, bChainAlign);
50166
+ }
50167
+
50163
50168
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
50164
50169
 
50165
50170
  // ic.opts['color'] = 'identity';
@@ -50247,13 +50252,13 @@ class RealignParser {
50247
50252
  }
50248
50253
 
50249
50254
  // use the model from Membranome as template
50250
- if(ic.bAfMem && chainidArray.length == 2) {
50251
- if(chainidArray[1].split('_')[0] == pdbidTemplate) {
50252
- let tmp = chainidArray[0];
50253
- chainidArray[0] = chainidArray[1];
50254
- chainidArray[1] = tmp;
50255
- }
50256
- }
50255
+ // if(ic.bAfMem && chainidArray.length == 2) {
50256
+ // if(chainidArray[1].split('_')[0] == pdbidTemplate) {
50257
+ // let tmp = chainidArray[0];
50258
+ // chainidArray[0] = chainidArray[1];
50259
+ // chainidArray[1] = tmp;
50260
+ // }
50261
+ // }
50257
50262
 
50258
50263
  let bRealign = true;
50259
50264
  ic.qt_start_end = []; // reset the alignment
@@ -51732,7 +51737,12 @@ class ParserUtils {
51732
51737
 
51733
51738
  if(n < 4) var aaa = 1; //alert("Please select at least four residues in each structure...");
51734
51739
  if(n >= 4) {
51735
- ic.rmsd_suprTmp = me.rmsdSuprCls.getRmsdSuprCls(coordsFrom, coordsTo, n);
51740
+ if(ic.bAfMem) { // align to the query (membrane)
51741
+ ic.rmsd_suprTmp = me.rmsdSuprCls.getRmsdSuprCls(coordsTo, coordsFrom, n);
51742
+ }
51743
+ else {
51744
+ ic.rmsd_suprTmp = me.rmsdSuprCls.getRmsdSuprCls(coordsFrom, coordsTo, n);
51745
+ }
51736
51746
 
51737
51747
  // apply matrix for each atom
51738
51748
  if(ic.rmsd_suprTmp.rot !== undefined) {
@@ -52371,7 +52381,7 @@ class ParserUtils {
52371
52381
  await ic.showAnnoCls.showAnnotations();
52372
52382
  }
52373
52383
 
52374
- if(me.cfg.closepopup) {
52384
+ if(me.cfg.closepopup || me.cfg.imageonly) {
52375
52385
  ic.resizeCanvasCls.closeDialogs();
52376
52386
  }
52377
52387
  }
@@ -52380,6 +52390,8 @@ class ParserUtils {
52380
52390
  }
52381
52391
  if($("#" + ic.pre + "atomsCustom").length > 0) $("#" + ic.pre + "atomsCustom")[0].blur();
52382
52392
  ic.bInitial = false;
52393
+
52394
+ if(me.cfg.imageonly) ic.saveFileCls.saveFile(undefined, 'png', undefined, true);
52383
52395
  }, 0);
52384
52396
  }
52385
52397
 
@@ -59462,7 +59474,7 @@ class LoadScript {
59462
59474
  ic.drawCls.draw();
59463
59475
  }
59464
59476
 
59465
- if(me.cfg.closepopup) {
59477
+ if(me.cfg.closepopup || me.cfg.imageonly) {
59466
59478
  setTimeout(function(){
59467
59479
  ic.resizeCanvasCls.closeDialogs();
59468
59480
  }, 100);
@@ -59473,6 +59485,8 @@ class LoadScript {
59473
59485
  // an extra render to remove artifacts in transparent surface
59474
59486
  if(ic.bTransparentSurface && ic.bRender) ic.drawCls.render();
59475
59487
 
59488
+ if(me.cfg.imageonly) ic.saveFileCls.saveFile(undefined, 'png', undefined, true);
59489
+
59476
59490
  /// if(ic.deferred !== undefined) ic.deferred.resolve(); /// if(ic.deferred2 !== undefined) ic.deferred2.resolve();
59477
59491
  /// if(ic.deferredMmdbaf !== undefined) ic.deferredMmdbaf.resolve();
59478
59492
  }
@@ -60367,7 +60381,7 @@ class Selection {
60367
60381
 
60368
60382
  ic.reinitAfterLoad();
60369
60383
 
60370
- ic.loadScriptCls.renderFinalStep(1);
60384
+ //ic.loadScriptCls.renderFinalStep(1);
60371
60385
  ic.definedSetsCls.setMode('all');
60372
60386
 
60373
60387
  ic.selectionCls.selectAll();
@@ -60378,6 +60392,8 @@ class Selection {
60378
60392
  ic.hlUpdateCls.removeSeqResidueBkgd();
60379
60393
  ic.hlUpdateCls.removeHl2D();
60380
60394
  ic.hlUpdateCls.removeHlMenus();
60395
+
60396
+ ic.loadScriptCls.renderFinalStep(1);
60381
60397
  }
60382
60398
 
60383
60399
  async loadSelection(dataStr) { let ic = this.icn3d, me = ic.icn3dui;
@@ -61942,14 +61958,17 @@ class Dssp {
61942
61958
  async showIgRefNum() { let ic = this.icn3d, me = ic.icn3dui;
61943
61959
  let thisClass = this;
61944
61960
 
61945
- if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
61946
- ic.bShowRefnum = true;
61961
+ // if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
61962
+ // ic.bShowRefnum = true;
61947
61963
 
61948
- // open sequence view
61949
- ic.hAtomsRefnum = {};
61950
- ic.bResetAnno = true;
61951
- await ic.showAnnoCls.showAnnotations();
61952
- ic.annotationCls.setAnnoViewAndDisplay('detailed view');
61964
+ // // open sequence view
61965
+ // ic.hAtomsRefnum = {};
61966
+ // ic.bResetAnno = true;
61967
+ // await ic.showAnnoCls.showAnnotations();
61968
+ // ic.annotationCls.setAnnoViewAndDisplay('detailed view');
61969
+ // }
61970
+ if(ic.pdbDataArray) {
61971
+ await thisClass.parseRefPdbData(ic.pdbDataArray);
61953
61972
  }
61954
61973
  else {
61955
61974
  //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'];
@@ -62012,6 +62031,7 @@ class Dssp {
62012
62031
 
62013
62032
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
62014
62033
 
62034
+ // if(!ic.resid2domainid) ic.resid2domainid = {};
62015
62035
  ic.resid2domainid = {};
62016
62036
 
62017
62037
  for(let i = 0, il = struArray.length; i < il; ++i) {
@@ -62025,20 +62045,33 @@ class Dssp {
62025
62045
  && !ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getMiddleAtomObj(ic.chains[chainid]).serial)) continue;
62026
62046
  if(ic.chainsSeq[chainid].length < 50) continue; // peptide
62027
62047
 
62048
+ let currAtoms = me.hashUtilsCls.intHash(ic.chains[chainid], ic.hAtoms);
62049
+ if(Object.keys(currAtoms).length == 0) continue;
62050
+
62028
62051
  // align each 3D domain with reference structure
62029
- let result = ic.domain3dCls.c2b_NewSplitChain(ic.chains[chainid]);
62052
+ //let result = ic.domain3dCls.c2b_NewSplitChain(ic.chains[chainid]);
62053
+ // assign ref numbers to selected residues
62054
+ let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms);
62030
62055
  let subdomains = result.subdomains;
62056
+ let pos2resi = result.pos2resi;
62031
62057
 
62032
62058
  let domainAtomsArray = [];
62033
62059
  if(subdomains.length <= 1) {
62034
- domainAtomsArray.push(ic.chains[chainid]);
62060
+ //domainAtomsArray.push(ic.chains[chainid]);
62061
+ domainAtomsArray.push(currAtoms);
62035
62062
 
62036
- for(let n = 0, nl = ic.chainsSeq[chainid].length; n < nl; ++n) {
62037
- let resid = chainid + '_' + ic.chainsSeq[chainid][n].resi;
62063
+ // for(let n = 0, nl = ic.chainsSeq[chainid].length; n < nl; ++n) {
62064
+ // let resid = chainid + '_' + ic.chainsSeq[chainid][n].resi;
62065
+ // ic.resid2domainid[resid] = chainid + '-0';
62066
+ // }
62067
+
62068
+ let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
62069
+ for(let n = 0, nl = residueArray.length; n < nl; ++n) {
62070
+ let resid = residueArray[n];
62038
62071
  ic.resid2domainid[resid] = chainid + '-0';
62039
- }
62072
+ }
62040
62073
  }
62041
- else {
62074
+ else {
62042
62075
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
62043
62076
  let domainAtoms = {};
62044
62077
  let segArray = subdomains[k];
@@ -62047,8 +62080,9 @@ class Dssp {
62047
62080
  let startResi = segArray[m];
62048
62081
  let endResi = segArray[m+1];
62049
62082
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
62050
- let residNCBI = chainid + '_' + n;
62051
- let resid = ic.ncbi2resid[residNCBI];
62083
+ //let residNCBI = chainid + '_' + n;
62084
+ //let resid = ic.ncbi2resid[residNCBI];
62085
+ let resid = chainid + '_' + pos2resi[n];
62052
62086
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
62053
62087
  ic.resid2domainid[resid] = chainid + '-' + k;
62054
62088
  }
@@ -62114,6 +62148,12 @@ class Dssp {
62114
62148
 
62115
62149
  // find the best alignment for each chain
62116
62150
  let domainid2score = {}, domainid2segs = {}, chainid2segs = {};
62151
+
62152
+ // if(!ic.chainid2index) ic.chainid2index = {};
62153
+ // if(!ic.domainid2index) ic.domainid2index = {};
62154
+ // if(!ic.domainid2ig2kabat) ic.domainid2ig2kabat = {};
62155
+ // if(!ic.domainid2ig2imgt) ic.domainid2ig2imgt = {};
62156
+
62117
62157
  ic.chainid2index = {};
62118
62158
  ic.domainid2index = {};
62119
62159
  ic.domainid2ig2kabat = {};
@@ -66223,7 +66263,9 @@ class SaveFile {
66223
66263
  //The type "png" is used to save the current canvas image. The type "html" is used to save html file with the
66224
66264
  //"data". This can be used to save any text. The type "text" is used to save an array of text, where "data" is
66225
66265
  //actually an array. The type "binary" is used to save an array of binary, where "data" is actually an array.
66226
- saveFile(filename, type, text) { let ic = this.icn3d, me = ic.icn3dui;
66266
+ saveFile(filename, type, text, bBlob) { let ic = this.icn3d, me = ic.icn3dui;
66267
+ let thisClass = this;
66268
+
66227
66269
  //Save file
66228
66270
  let blob;
66229
66271
 
@@ -66274,18 +66316,18 @@ class SaveFile {
66274
66316
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
66275
66317
 
66276
66318
  //if(window.navigator.msSaveBlob) navigator.msSaveBlob(blob, filename);
66277
- saveAs(blob, filename);
66319
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66278
66320
 
66279
- return;
66321
+ return blob;
66280
66322
  };
66281
66323
 
66282
66324
  reader.readAsArrayBuffer(blob);
66283
66325
  }
66284
66326
  else {
66285
66327
  //ic.createLinkForBlob(blob, filename);
66286
- saveAs(blob, filename);
66328
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66287
66329
 
66288
- return;
66330
+ return blob;
66289
66331
  }
66290
66332
  }
66291
66333
  else {
@@ -66300,9 +66342,9 @@ class SaveFile {
66300
66342
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
66301
66343
 
66302
66344
  //ic.createLinkForBlob(blob, filename);
66303
- saveAs(blob, filename);
66345
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66304
66346
 
66305
- return;
66347
+ return blob;
66306
66348
  };
66307
66349
 
66308
66350
  reader.readAsArrayBuffer(data);
@@ -66311,9 +66353,9 @@ class SaveFile {
66311
66353
  blob = data;
66312
66354
 
66313
66355
  //ic.createLinkForBlob(blob, filename);
66314
- saveAs(blob, filename);
66356
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66315
66357
 
66316
- return;
66358
+ return blob;
66317
66359
  }
66318
66360
  });
66319
66361
  }
@@ -66351,6 +66393,37 @@ class SaveFile {
66351
66393
  //https://github.com/eligrey/FileSaver.js/
66352
66394
  saveAs(blob, filename);
66353
66395
  }
66396
+
66397
+ return blob;
66398
+ }
66399
+
66400
+ saveBlob(blob, filename, bBlob, width, height) { let ic = this.icn3d; ic.icn3dui;
66401
+ if(bBlob) {
66402
+ let urlCreator = window.URL || window.webkitURL;
66403
+ let imageUrl = urlCreator.createObjectURL(blob);
66404
+
66405
+ let url = ic.shareLinkCls.shareLinkUrl();
66406
+
66407
+ let bTooLong =(url.length > 4000 || url.indexOf('http') !== 0) ? true : false;
66408
+
66409
+ if(bTooLong || (ic.bInputfile && !ic.bInputUrlfile)) {
66410
+ $("#" + ic.pre + "viewer").html("<img src='" + imageUrl + "'/>");
66411
+ }
66412
+ else {
66413
+ $("#" + ic.pre + "viewer").html("<a href='" + url + "' target='_blank'><img src='" + imageUrl + "'/></a>");
66414
+ }
66415
+
66416
+ $("#" + ic.pre + "viewer").height(height);
66417
+ $("#" + ic.pre + "mnlist").hide();
66418
+ $("#" + ic.pre + "cmdlog").hide();
66419
+ $("#" + ic.pre + "title").hide();
66420
+
66421
+ // clear memory
66422
+ ic = {};
66423
+ }
66424
+ else {
66425
+ saveAs(blob, filename);
66426
+ }
66354
66427
  }
66355
66428
 
66356
66429
  saveSvg(id, filename, bContactmap) { let ic = this.icn3d, me = ic.icn3dui;
@@ -66975,7 +67048,9 @@ class SaveFile {
66975
67048
  $("#" + ic.pre + "title").html(title);
66976
67049
  }
66977
67050
  else if(structureArray.length == 1) {
66978
- let url = this.getLinkToStructureSummary();
67051
+ //let url = this.getLinkToStructureSummary();
67052
+ 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;
67053
+
66979
67054
  this.setStructureTitle(url, title, titlelinkColor);
66980
67055
  }
66981
67056
  }
@@ -67403,6 +67478,7 @@ class ShareLink {
67403
67478
  if(ic.structures !== undefined && Object.keys(ic.structures).length == 1 && ic.inputid !== undefined) {
67404
67479
  id = Object.keys(ic.structures)[0];
67405
67480
  url = url.replace(new RegExp(id + '_','g'), '!');
67481
+ outputCmd = outputCmd.replace(new RegExp(id + '_','g'), '!');
67406
67482
  }
67407
67483
 
67408
67484
  if(me.cfg.blast_rep_id !== undefined) {
@@ -70268,7 +70344,7 @@ class iCn3DUI {
70268
70344
  //even when multiple iCn3D viewers are shown together.
70269
70345
  this.pre = this.cfg.divid + "_";
70270
70346
 
70271
- this.REVISION = '3.24.2';
70347
+ this.REVISION = '3.25.0';
70272
70348
 
70273
70349
  // In nodejs, iCn3D defines "window = {navigator: {}}"
70274
70350
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -70282,6 +70358,7 @@ class iCn3DUI {
70282
70358
  if(this.cfg.showcommand === undefined) this.cfg.showcommand = true;
70283
70359
  //if(this.cfg.simplemenu === undefined) this.cfg.simplemenu = false;
70284
70360
  if(this.cfg.mobilemenu === undefined) this.cfg.mobilemenu = false;
70361
+ if(this.cfg.imageonly === undefined) this.cfg.imageonly = false;
70285
70362
  if(this.cfg.closepopup === undefined) this.cfg.closepopup = false;
70286
70363
  if(this.cfg.showanno === undefined) this.cfg.showanno = false;
70287
70364
  if(this.cfg.showseq === undefined) this.cfg.showseq = false;