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.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>');
@@ -35390,7 +35390,6 @@ class SetOption {
35390
35390
  }
35391
35391
 
35392
35392
  showColorLegend(colorType) { let ic = this.icn3d, me = ic.icn3dui;
35393
- let bClose = false;
35394
35393
 
35395
35394
  let colorLabel = colorType.substr(0, 1).toUpperCase() + colorType.substr(1);
35396
35395
  if(colorType == 'confidence') {
@@ -35502,7 +35501,6 @@ class SetOption {
35502
35501
  }
35503
35502
  else {
35504
35503
  html = '';
35505
- bClose = true;
35506
35504
  }
35507
35505
 
35508
35506
  if(html) {
@@ -35510,9 +35508,9 @@ class SetOption {
35510
35508
  me.htmlCls.dialogCls.openDlg('dl_legend', 'Color Legend');
35511
35509
  }
35512
35510
 
35513
- if(bClose) {
35514
- if(window.dialog && window.dialog.hasClass('ui-dialog-content')) window.dialog.dialog( "close" );
35515
- }
35511
+ // if(bClose) {
35512
+ // if(window.dialog && window.dialog.hasClass('ui-dialog-content')) window.dialog.dialog( "close" );
35513
+ // }
35516
35514
  }
35517
35515
 
35518
35516
  getColorLegendForElem(category, atomHash) { let ic = this.icn3d, me = ic.icn3dui;
@@ -38549,7 +38547,7 @@ class Domain3d {
38549
38547
 
38550
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
38551
38549
  let substruct = [];
38552
- // determine residue ranges for each subdomain
38550
+ // determine residue position ranges for each subdomain
38553
38551
  let subdomains = [];
38554
38552
 
38555
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
@@ -50158,10 +50156,15 @@ class RealignParser {
50158
50156
  //let chainTo = chainidArray[0];
50159
50157
  //let chainFrom = chainidArray[index + 1];
50160
50158
 
50161
- let bChainAlign = true;
50162
-
50159
+ let bChainAlign = true, result;
50163
50160
 
50164
- 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
+
50165
50168
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, result.hAtoms);
50166
50169
 
50167
50170
  // ic.opts['color'] = 'identity';
@@ -50249,13 +50252,13 @@ class RealignParser {
50249
50252
  }
50250
50253
 
50251
50254
  // use the model from Membranome as template
50252
- if(ic.bAfMem && chainidArray.length == 2) {
50253
- if(chainidArray[1].split('_')[0] == pdbidTemplate) {
50254
- let tmp = chainidArray[0];
50255
- chainidArray[0] = chainidArray[1];
50256
- chainidArray[1] = tmp;
50257
- }
50258
- }
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
+ // }
50259
50262
 
50260
50263
  let bRealign = true;
50261
50264
  ic.qt_start_end = []; // reset the alignment
@@ -51734,7 +51737,12 @@ class ParserUtils {
51734
51737
 
51735
51738
  if(n < 4) var aaa = 1; //alert("Please select at least four residues in each structure...");
51736
51739
  if(n >= 4) {
51737
- 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
+ }
51738
51746
 
51739
51747
  // apply matrix for each atom
51740
51748
  if(ic.rmsd_suprTmp.rot !== undefined) {
@@ -52373,7 +52381,7 @@ class ParserUtils {
52373
52381
  await ic.showAnnoCls.showAnnotations();
52374
52382
  }
52375
52383
 
52376
- if(me.cfg.closepopup) {
52384
+ if(me.cfg.closepopup || me.cfg.imageonly) {
52377
52385
  ic.resizeCanvasCls.closeDialogs();
52378
52386
  }
52379
52387
  }
@@ -52382,6 +52390,8 @@ class ParserUtils {
52382
52390
  }
52383
52391
  if($("#" + ic.pre + "atomsCustom").length > 0) $("#" + ic.pre + "atomsCustom")[0].blur();
52384
52392
  ic.bInitial = false;
52393
+
52394
+ if(me.cfg.imageonly) ic.saveFileCls.saveFile(undefined, 'png', undefined, true);
52385
52395
  }, 0);
52386
52396
  }
52387
52397
 
@@ -57098,7 +57108,9 @@ class ApplyCommand {
57098
57108
  let msa;
57099
57109
  if(paraArray.length >= 7) msa = paraArray[6].substr(4);
57100
57110
 
57101
- $("#" + ic.pre + "anno_custom")[0].checked = true;
57111
+ if($("#" + ic.pre + "anno_custom")[0]) {
57112
+ $("#" + ic.pre + "anno_custom")[0].checked = true;
57113
+ }
57102
57114
  $("[id^=" + ic.pre + "custom]").show();
57103
57115
 
57104
57116
  if(color == '0') color = undefined;
@@ -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;
@@ -60409,16 +60425,18 @@ class Selection {
60409
60425
  if(me.cfg.bSidebyside && structureArray.length == 2) {
60410
60426
  let dividArray = Object.keys(window.icn3duiHash);
60411
60427
  let pos = dividArray.indexOf(ic.divid);
60412
-
60413
60428
  let structure = structureArray[pos];
60414
60429
  let chainArray = ic.structures[structure];
60430
+
60415
60431
  let structAtoms = {};
60416
- for(let i = 0, il = chainArray.length; i < il; ++i) {
60417
- structAtoms = me.hashUtilsCls.unionHash(structAtoms, ic.chains[chainArray[i]]);
60418
- }
60432
+ if(chainArray) {
60433
+ for(let i = 0, il = chainArray.length; i < il; ++i) {
60434
+ structAtoms = me.hashUtilsCls.unionHash(structAtoms, ic.chains[chainArray[i]]);
60435
+ }
60419
60436
 
60420
- ic.dAtoms = me.hashUtilsCls.intHash(structAtoms, ic.dAtoms);
60421
- ic.hAtoms = me.hashUtilsCls.cloneHash(ic.dAtoms);
60437
+ ic.dAtoms = me.hashUtilsCls.intHash(structAtoms, ic.dAtoms);
60438
+ ic.hAtoms = me.hashUtilsCls.cloneHash(ic.dAtoms);
60439
+ }
60422
60440
  }
60423
60441
  }
60424
60442
 
@@ -61940,14 +61958,17 @@ class Dssp {
61940
61958
  async showIgRefNum() { let ic = this.icn3d, me = ic.icn3dui;
61941
61959
  let thisClass = this;
61942
61960
 
61943
- if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
61944
- ic.bShowRefnum = true;
61961
+ // if(ic.resid2refnum && Object.keys(ic.resid2refnum).length > 0) {
61962
+ // ic.bShowRefnum = true;
61945
61963
 
61946
- // open sequence view
61947
- ic.hAtomsRefnum = {};
61948
- ic.bResetAnno = true;
61949
- await ic.showAnnoCls.showAnnotations();
61950
- 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);
61951
61972
  }
61952
61973
  else {
61953
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'];
@@ -62010,6 +62031,7 @@ class Dssp {
62010
62031
 
62011
62032
  let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
62012
62033
 
62034
+ // if(!ic.resid2domainid) ic.resid2domainid = {};
62013
62035
  ic.resid2domainid = {};
62014
62036
 
62015
62037
  for(let i = 0, il = struArray.length; i < il; ++i) {
@@ -62023,20 +62045,33 @@ class Dssp {
62023
62045
  && !ic.proteins.hasOwnProperty(ic.firstAtomObjCls.getMiddleAtomObj(ic.chains[chainid]).serial)) continue;
62024
62046
  if(ic.chainsSeq[chainid].length < 50) continue; // peptide
62025
62047
 
62048
+ let currAtoms = me.hashUtilsCls.intHash(ic.chains[chainid], ic.hAtoms);
62049
+ if(Object.keys(currAtoms).length == 0) continue;
62050
+
62026
62051
  // align each 3D domain with reference structure
62027
- 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);
62028
62055
  let subdomains = result.subdomains;
62056
+ let pos2resi = result.pos2resi;
62029
62057
 
62030
62058
  let domainAtomsArray = [];
62031
62059
  if(subdomains.length <= 1) {
62032
- domainAtomsArray.push(ic.chains[chainid]);
62060
+ //domainAtomsArray.push(ic.chains[chainid]);
62061
+ domainAtomsArray.push(currAtoms);
62033
62062
 
62034
- for(let n = 0, nl = ic.chainsSeq[chainid].length; n < nl; ++n) {
62035
- 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];
62036
62071
  ic.resid2domainid[resid] = chainid + '-0';
62037
- }
62072
+ }
62038
62073
  }
62039
- else {
62074
+ else {
62040
62075
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
62041
62076
  let domainAtoms = {};
62042
62077
  let segArray = subdomains[k];
@@ -62045,8 +62080,9 @@ class Dssp {
62045
62080
  let startResi = segArray[m];
62046
62081
  let endResi = segArray[m+1];
62047
62082
  for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
62048
- let residNCBI = chainid + '_' + n;
62049
- let resid = ic.ncbi2resid[residNCBI];
62083
+ //let residNCBI = chainid + '_' + n;
62084
+ //let resid = ic.ncbi2resid[residNCBI];
62085
+ let resid = chainid + '_' + pos2resi[n];
62050
62086
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
62051
62087
  ic.resid2domainid[resid] = chainid + '-' + k;
62052
62088
  }
@@ -62112,6 +62148,12 @@ class Dssp {
62112
62148
 
62113
62149
  // find the best alignment for each chain
62114
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
+
62115
62157
  ic.chainid2index = {};
62116
62158
  ic.domainid2index = {};
62117
62159
  ic.domainid2ig2kabat = {};
@@ -66221,7 +66263,9 @@ class SaveFile {
66221
66263
  //The type "png" is used to save the current canvas image. The type "html" is used to save html file with the
66222
66264
  //"data". This can be used to save any text. The type "text" is used to save an array of text, where "data" is
66223
66265
  //actually an array. The type "binary" is used to save an array of binary, where "data" is actually an array.
66224
- 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
+
66225
66269
  //Save file
66226
66270
  let blob;
66227
66271
 
@@ -66272,18 +66316,18 @@ class SaveFile {
66272
66316
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
66273
66317
 
66274
66318
  //if(window.navigator.msSaveBlob) navigator.msSaveBlob(blob, filename);
66275
- saveAs(blob, filename);
66319
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66276
66320
 
66277
- return;
66321
+ return blob;
66278
66322
  };
66279
66323
 
66280
66324
  reader.readAsArrayBuffer(blob);
66281
66325
  }
66282
66326
  else {
66283
66327
  //ic.createLinkForBlob(blob, filename);
66284
- saveAs(blob, filename);
66328
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66285
66329
 
66286
- return;
66330
+ return blob;
66287
66331
  }
66288
66332
  }
66289
66333
  else {
@@ -66298,9 +66342,9 @@ class SaveFile {
66298
66342
  blob = me.convertTypeCls.getBlobFromBufferAndText(arrayBuffer, text);
66299
66343
 
66300
66344
  //ic.createLinkForBlob(blob, filename);
66301
- saveAs(blob, filename);
66345
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66302
66346
 
66303
- return;
66347
+ return blob;
66304
66348
  };
66305
66349
 
66306
66350
  reader.readAsArrayBuffer(data);
@@ -66309,9 +66353,9 @@ class SaveFile {
66309
66353
  blob = data;
66310
66354
 
66311
66355
  //ic.createLinkForBlob(blob, filename);
66312
- saveAs(blob, filename);
66356
+ thisClass.saveBlob(blob, filename, bBlob, width, height);
66313
66357
 
66314
- return;
66358
+ return blob;
66315
66359
  }
66316
66360
  });
66317
66361
  }
@@ -66349,6 +66393,37 @@ class SaveFile {
66349
66393
  //https://github.com/eligrey/FileSaver.js/
66350
66394
  saveAs(blob, filename);
66351
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
+ }
66352
66427
  }
66353
66428
 
66354
66429
  saveSvg(id, filename, bContactmap) { let ic = this.icn3d, me = ic.icn3dui;
@@ -66973,7 +67048,9 @@ class SaveFile {
66973
67048
  $("#" + ic.pre + "title").html(title);
66974
67049
  }
66975
67050
  else if(structureArray.length == 1) {
66976
- 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
+
66977
67054
  this.setStructureTitle(url, title, titlelinkColor);
66978
67055
  }
66979
67056
  }
@@ -67401,6 +67478,7 @@ class ShareLink {
67401
67478
  if(ic.structures !== undefined && Object.keys(ic.structures).length == 1 && ic.inputid !== undefined) {
67402
67479
  id = Object.keys(ic.structures)[0];
67403
67480
  url = url.replace(new RegExp(id + '_','g'), '!');
67481
+ outputCmd = outputCmd.replace(new RegExp(id + '_','g'), '!');
67404
67482
  }
67405
67483
 
67406
67484
  if(me.cfg.blast_rep_id !== undefined) {
@@ -70266,7 +70344,7 @@ class iCn3DUI {
70266
70344
  //even when multiple iCn3D viewers are shown together.
70267
70345
  this.pre = this.cfg.divid + "_";
70268
70346
 
70269
- this.REVISION = '3.24.2';
70347
+ this.REVISION = '3.25.0';
70270
70348
 
70271
70349
  // In nodejs, iCn3D defines "window = {navigator: {}}"
70272
70350
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -70280,6 +70358,7 @@ class iCn3DUI {
70280
70358
  if(this.cfg.showcommand === undefined) this.cfg.showcommand = true;
70281
70359
  //if(this.cfg.simplemenu === undefined) this.cfg.simplemenu = false;
70282
70360
  if(this.cfg.mobilemenu === undefined) this.cfg.mobilemenu = false;
70361
+ if(this.cfg.imageonly === undefined) this.cfg.imageonly = false;
70283
70362
  if(this.cfg.closepopup === undefined) this.cfg.closepopup = false;
70284
70363
  if(this.cfg.showanno === undefined) this.cfg.showanno = false;
70285
70364
  if(this.cfg.showseq === undefined) this.cfg.showseq = false;