icn3d 3.8.0 → 3.8.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.
Files changed (2) hide show
  1. package/icn3d.js +174 -68
  2. package/package.json +2 -2
package/icn3d.js CHANGED
@@ -7658,7 +7658,6 @@ class Strand {
7658
7658
  }
7659
7659
 
7660
7660
  currentChain = atom.chain;
7661
- atom.resi;
7662
7661
  ss = atom.ss;
7663
7662
  ssend = atom.ssend;
7664
7663
  prevAtomid = atom.serial;
@@ -12045,7 +12044,6 @@ class HlObjects {
12045
12044
 
12046
12045
  //Show the highlight for the selected atoms: hAtoms.
12047
12046
  addHlObjects(color, bRender, atomsHash) { let ic = this.icn3d, me = ic.icn3dui;
12048
- if(color === undefined) color = ic.hColor;
12049
12047
  //if(atomsHash === undefined) atomsHash = ic.hAtoms;
12050
12048
  let atomsHashDisplay = (atomsHash) ? me.hashUtilsCls.intHash(atomsHash, ic.dAtoms) : me.hashUtilsCls.intHash(ic.hAtoms, ic.dAtoms);
12051
12049
 
@@ -13356,13 +13354,14 @@ class DefinedSets {
13356
13354
  dAtoms = me.hashUtilsCls.unionHash(dAtoms, ic.alnChains[alignChain]);
13357
13355
  }
13358
13356
 
13359
- let residuesHash = {};
13357
+ let residuesHash = {}, chains = {};
13360
13358
  for(let i in dAtoms) {
13361
13359
  let atom = ic.atoms[i];
13362
13360
 
13363
13361
  let chainid = atom.structure + '_' + atom.chain;
13364
13362
  let resid = chainid + '_' + atom.resi;
13365
13363
  residuesHash[resid] = 1;
13364
+ chains[chainid] = 1;
13366
13365
  }
13367
13366
 
13368
13367
  let commandname = 'protein_aligned';
@@ -16081,11 +16080,9 @@ class LineGraph {
16081
16080
  let id;
16082
16081
  if(bScatterplot) {
16083
16082
  ic.scatterplotWidth = 2 * width;
16084
- ic.scatterplotWidth;
16085
16083
  id = me.scatterplotid;
16086
16084
  } else {
16087
16085
  ic.linegraphWidth = 2 * width;
16088
- ic.linegraphWidth;
16089
16086
  id = me.linegraphid;
16090
16087
  }
16091
16088
  html =(strucArray.length == 0) ? "No interactions found for each structure<br><br>" :
@@ -20996,6 +20993,7 @@ class LoadAtomData {
20996
20993
  let serial = serialBase;
20997
20994
 
20998
20995
  let serial2structure = {}; // for "align" only
20996
+ let mmdbid2pdbid = {}; // for "align" only
20999
20997
 
21000
20998
  if(alignType === undefined || alignType === 'target') {
21001
20999
  ic.pmid = data.pubmedId;
@@ -21024,10 +21022,11 @@ class LoadAtomData {
21024
21022
  }
21025
21023
 
21026
21024
  let pdbidTmp = structure.pdbId;
21027
- structure.mmdbId;
21025
+ let mmdbidTmp = structure.mmdbId;
21028
21026
 
21029
21027
  for(let j = structure.serialInterval[0], jl = structure.serialInterval[1]; j <= jl; ++j) {
21030
21028
  serial2structure[j] = pdbidTmp.toString();
21029
+ mmdbid2pdbid[mmdbidTmp] = pdbidTmp;
21031
21030
  }
21032
21031
 
21033
21032
  for(let j = 0, jl = structure.molecules.length; j < jl; ++j) {
@@ -23827,7 +23826,7 @@ class MmdbParser {
23827
23826
  }
23828
23827
 
23829
23828
  let molid2rescount = data.moleculeInfor;
23830
- let molid2chain = {};
23829
+ let molid2color = {}, chain2molid = {}, molid2chain = {};
23831
23830
  let chainNameHash = {};
23832
23831
  for(let i in molid2rescount) {
23833
23832
  if(Object.keys(molid2rescount[i]).length === 0) continue;
@@ -23843,6 +23842,9 @@ class MmdbParser {
23843
23842
 
23844
23843
  let chainNameFinal =(chainNameHash[chainName] === 1) ? chainName : chainName + chainNameHash[chainName].toString();
23845
23844
  let chain = id + '_' + chainNameFinal;
23845
+
23846
+ molid2color[i] = color;
23847
+ chain2molid[chain] = i;
23846
23848
  molid2chain[i] = chain;
23847
23849
 
23848
23850
  ic.chainsColor[chain] =(type !== undefined) ? me.parasCls.thr(me.htmlCls.GREY8) : me.parasCls.thr(color);
@@ -24005,13 +24007,13 @@ class MmdbParser {
24005
24007
  }
24006
24008
 
24007
24009
  downloadMmdbPart2(type) { let ic = this.icn3d, me = ic.icn3dui;
24008
- if(ic.bAssemblyUseAsu) { // set up symmetric matrices
24010
+ if(ic.bAssemblyUseAsu) {
24009
24011
  $("#" + ic.pre + "assemblyWrapper").show();
24010
- ic.bAssembly = true;
24012
+ //ic.bAssembly = true;
24011
24013
  }
24012
24014
  else {
24013
24015
  $("#" + ic.pre + "assemblyWrapper").hide();
24014
- ic.bAssembly = false;
24016
+ //ic.bAssembly = false;
24015
24017
  }
24016
24018
 
24017
24019
  if(ic.emd !== undefined) {
@@ -26695,7 +26697,7 @@ class LoadScript {
26695
26697
 
26696
26698
  return;
26697
26699
  }
26698
- else if(ic.commands[i].trim().indexOf('set af align error map') == 0) {
26700
+ else if(ic.commands[i].trim().indexOf('set half pae map') == 0) {
26699
26701
  let strArray = ic.commands[i].split("|||");
26700
26702
  let command = strArray[0].trim();
26701
26703
 
@@ -26708,6 +26710,19 @@ class LoadScript {
26708
26710
 
26709
26711
  return;
26710
26712
  }
26713
+ else if(ic.commands[i].trim().indexOf('set full pae map') == 0) {
26714
+ let strArray = ic.commands[i].split("|||");
26715
+ let command = strArray[0].trim();
26716
+
26717
+ $.when(thisClass.applyCommandAfmap(command, true)).then(function() {
26718
+ //if(!me.cfg.notebook && dialog && dialog.hasClass("ui-dialog-content")) dialog.dialog( "close" );
26719
+
26720
+ //ic.drawCls.draw();
26721
+ thisClass.execCommandsBase(i + 1, end, steps);
26722
+ });
26723
+
26724
+ return;
26725
+ }
26711
26726
  else {
26712
26727
  ic.applyCommandCls.applyCommand(ic.commands[i]);
26713
26728
  }
@@ -27041,18 +27056,18 @@ class LoadScript {
27041
27056
  return ic.deferredRealign.promise();
27042
27057
  }
27043
27058
 
27044
- applyCommandAfmapBase(command) { let ic = this.icn3d; ic.icn3dui;
27059
+ applyCommandAfmapBase(command, bFull) { let ic = this.icn3d; ic.icn3dui;
27045
27060
  let afid = command.substr(command.lastIndexOf(' ') + 1);
27046
27061
 
27047
- ic.contactMapCls.afErrorMap(afid);
27062
+ ic.contactMapCls.afErrorMap(afid, bFull);
27048
27063
  }
27049
27064
 
27050
- applyCommandAfmap(command) { let ic = this.icn3d; ic.icn3dui;
27065
+ applyCommandAfmap(command, bFull) { let ic = this.icn3d; ic.icn3dui;
27051
27066
  let thisClass = this;
27052
27067
 
27053
27068
  // chain functions together
27054
27069
  ic.deferredAfmap = new $.Deferred(function() {
27055
- thisClass.applyCommandAfmapBase(command);
27070
+ thisClass.applyCommandAfmapBase(command, bFull);
27056
27071
  }); // end of me.deferred = $.Deferred(function() {
27057
27072
 
27058
27073
  return ic.deferredAfmap.promise();
@@ -28332,14 +28347,14 @@ class AddTrack {
28332
28347
 
28333
28348
  let strand, itemRgb;
28334
28349
 
28335
- if(fieldArray.length > 4) fieldArray[4];
28350
+ if(fieldArray.length > 4) ;
28336
28351
  if(fieldArray.length > 5) strand = fieldArray[5]; // ., +, or -
28337
- if(fieldArray.length > 6) fieldArray[6];
28338
- if(fieldArray.length > 7) fieldArray[7];
28352
+ if(fieldArray.length > 6) ;
28353
+ if(fieldArray.length > 7) ;
28339
28354
  if(fieldArray.length > 8) itemRgb = fieldArray[8];
28340
- if(fieldArray.length > 9) fieldArray[9];
28341
- if(fieldArray.length > 10) fieldArray[10];
28342
- if(fieldArray.length > 11) fieldArray[11];
28355
+ if(fieldArray.length > 9) ;
28356
+ if(fieldArray.length > 10) ;
28357
+ if(fieldArray.length > 11) ;
28343
28358
 
28344
28359
  let title = trackName;
28345
28360
 
@@ -34077,7 +34092,7 @@ class MmcifParser {
34077
34092
  }
34078
34093
  }
34079
34094
 
34080
- loadMmcifSymmetry(assembly) { let ic = this.icn3d; ic.icn3dui;
34095
+ loadMmcifSymmetry(assembly) { let ic = this.icn3d, me = ic.icn3dui;
34081
34096
  // load assembly info
34082
34097
  //var assembly = data.assembly;
34083
34098
  //var pmatrix = data.pmatrix;
@@ -34090,6 +34105,11 @@ class MmcifParser {
34090
34105
  }
34091
34106
 
34092
34107
  ic.asuCnt = ic.biomtMatrices.length;
34108
+
34109
+ // show bioassembly
34110
+ if(me.cfg.bu == 1 && Object.keys(ic.atoms).length * ic.asuCnt > ic.maxatomcnt) {
34111
+ ic.bAssembly = true;
34112
+ }
34093
34113
  }
34094
34114
 
34095
34115
  loadMmcifOpmDataPart2(data, pdbid) { let ic = this.icn3d, me = ic.icn3dui;
@@ -39995,7 +40015,6 @@ class ApplyDisplay {
39995
40015
 
39996
40016
  //Apply style and label options to a certain set of atoms.
39997
40017
  applyDisplayOptions(options, atoms, bHighlight) { let ic = this.icn3d, me = ic.icn3dui;
39998
- if(options === undefined) options = ic.opts;
39999
40018
 
40000
40019
  // get parameters from cookies
40001
40020
  if(!me.bNode && me.htmlCls.setHtmlCls.getCookie('lineRadius') != '') {
@@ -42497,7 +42516,12 @@ class Draw {
42497
42516
  ic.setColorCls.applyPrevColor();
42498
42517
 
42499
42518
  if(ic.biomtMatrices !== undefined && ic.biomtMatrices.length > 1) {
42500
- if(ic.bAssembly && Object.keys(ic.structures).length == 1) {
42519
+ // show bioassembly in two cases
42520
+ // 1. asymmetric unit: me.cfg.bu == 0
42521
+ // 2. biological unit with less than ic.maxatomcnt atom:
42522
+ // me.cfg.bu == 1 && Object.keys(ic.atoms).length * ic.biomtMatrices.length < ic.maxatomcnt
42523
+ if(ic.bAssembly && Object.keys(ic.structures).length == 1 && (me.cfg.bu == 0
42524
+ || (me.cfg.bu == 1 && Object.keys(ic.atoms).length * ic.biomtMatrices.length > ic.maxatomcnt)) ) {
42501
42525
  ic.instancingCls.drawSymmetryMates();
42502
42526
  }
42503
42527
  else {
@@ -43798,7 +43822,7 @@ class ClickMenu {
43798
43822
  });
43799
43823
 
43800
43824
  me.myEventCls.onIds("#" + me.pre + "mn1_afmapfile", "click", function(e) { me.icn3d;
43801
- me.htmlCls.dialogCls.openDlg('dl_afmapfile', 'Please input AlphaFold aligned error File');
43825
+ me.htmlCls.dialogCls.openDlg('dl_afmapfile', 'Please input AlphaFold PAE File');
43802
43826
  });
43803
43827
  // },
43804
43828
  // clkMn1_urlfile: function() {
@@ -46173,7 +46197,8 @@ class SetMenu {
46173
46197
  html += me.htmlCls.setHtmlCls.getLink('mn1_mol2file', 'Mol2 File');
46174
46198
  html += me.htmlCls.setHtmlCls.getLink('mn1_sdffile', 'SDF File');
46175
46199
  html += me.htmlCls.setHtmlCls.getLink('mn1_xyzfile', 'XYZ File');
46176
- html += me.htmlCls.setHtmlCls.getLink('mn1_afmapfile', 'AlphaFold Aligned Error File');
46200
+ html += me.htmlCls.setHtmlCls.getLink('mn1_afmapfile', 'AlphaFold PAE File');
46201
+
46177
46202
  if(!me.cfg.simplemenu) html += me.htmlCls.setHtmlCls.getLink('mn1_urlfile', 'URL(Same Host) ' + me.htmlCls.wifiStr);
46178
46203
  html += "<li>-</li>";
46179
46204
  html += me.htmlCls.setHtmlCls.getLink('mn1_pngimage', 'iCn3D PNG Image');
@@ -47286,8 +47311,14 @@ class SetMenu {
47286
47311
  html += "<li id='" + me.pre + "assemblyWrapper'><span>Assembly</span>";
47287
47312
  html += "<ul>";
47288
47313
 
47289
- html += me.htmlCls.setHtmlCls.getRadio('mn6_assembly', 'mn6_assemblyYes', 'Biological Assembly');
47290
- html += me.htmlCls.setHtmlCls.getRadio('mn6_assembly', 'mn6_assemblyNo', 'Asymmetric Unit', true);
47314
+ if(me.cfg.bu == 0) {
47315
+ html += me.htmlCls.setHtmlCls.getRadio('mn6_assembly', 'mn6_assemblyYes', 'Biological Assembly');
47316
+ html += me.htmlCls.setHtmlCls.getRadio('mn6_assembly', 'mn6_assemblyNo', 'Asymmetric Unit', true);
47317
+ }
47318
+ else {
47319
+ html += me.htmlCls.setHtmlCls.getRadio('mn6_assembly', 'mn6_assemblyYes', 'Biological Assembly', true);
47320
+ html += me.htmlCls.setHtmlCls.getRadio('mn6_assembly', 'mn6_assemblyNo', 'Asymmetric Unit');
47321
+ }
47291
47322
 
47292
47323
  html += "</ul>";
47293
47324
  html += "</li>";
@@ -48146,7 +48177,8 @@ class SetDialog {
48146
48177
 
48147
48178
  html += "<a href='https://alphafold.ebi.ac.uk/' target='_blank'>AlphaFold Uniprot</a> ID: " + me.htmlCls.inputTextStr + "id='" + me.pre + "afid' value='" + afid + "' size=10><br><br>";
48148
48179
  html += me.htmlCls.buttonStr + "reload_af'>Load Structure</button>"
48149
- + me.htmlCls.buttonStr + "reload_afmap' style='margin-left:30px'>Load Aligned Error Map (slow)</button>";
48180
+ + me.htmlCls.buttonStr + "reload_afmap' style='margin-left:30px'>Load Half PAE Map</button>"
48181
+ + me.htmlCls.buttonStr + "reload_afmapfull' style='margin-left:30px'>Load Full PAE Map (slow)</button>";
48150
48182
  html += "</div>";
48151
48183
 
48152
48184
  html += me.htmlCls.divStr + "dl_opmid' class='" + dialogClass + "'>";
@@ -48244,8 +48276,9 @@ class SetDialog {
48244
48276
  html += "</div>";
48245
48277
 
48246
48278
  html += me.htmlCls.divStr + "dl_afmapfile' class='" + dialogClass + "'>";
48247
- html += "AlphaFold Aligned Error File: " + me.htmlCls.inputFileStr + "id='" + me.pre + "afmapfile' size=8> ";
48248
- html += me.htmlCls.buttonStr + "reload_afmapfile'>Load</button>";
48279
+ html += "AlphaFold PAE File: " + me.htmlCls.inputFileStr + "id='" + me.pre + "afmapfile' size=8> <br><br>";
48280
+ html += me.htmlCls.buttonStr + "reload_afmapfile'>Load Half PAE Map</button>"
48281
+ + me.htmlCls.buttonStr + "reload_afmapfilefull' style='margin-left:30px'>Load Full PAE Map (slow)</button>";
48249
48282
  html += "</div>";
48250
48283
 
48251
48284
  html += me.htmlCls.divStr + "dl_urlfile' class='" + dialogClass + "'>";
@@ -48624,7 +48657,7 @@ class SetDialog {
48624
48657
  html += me.htmlCls.divNowrapStr + buttonStrTmp + me.alignerrormapid + '_svg">SVG</button>' + me.htmlCls.space2;
48625
48658
  html += buttonStrTmp + me.alignerrormapid + '_png">PNG (slow)</button>' + me.htmlCls.space2;
48626
48659
  html += buttonStrTmp + me.alignerrormapid + '_json">JSON</button>' + me.htmlCls.space4;
48627
- html += "<b>Scale</b>: <select id='" + me.alignerrormapid + "_scale'>";
48660
+ html += '<b>Scale</b>: <select id="' + me.alignerrormapid + '_scale">';
48628
48661
 
48629
48662
  //let optArray5 = ['0.01', '0.02', '0.04', '0.06', '0.08', '0.1', '0.2', '0.4', '0.6', '0.8', '1'];
48630
48663
  html += me.htmlCls.setHtmlCls.getOptionHtml(optArray5, 2);
@@ -49382,10 +49415,19 @@ class Events {
49382
49415
  if(!me.cfg.notebook) dialog.dialog( "close" );
49383
49416
  let afid = me.cfg.afid ? me.cfg.afid : $("#" + me.pre + "afid").val();
49384
49417
 
49385
- me.htmlCls.clickMenuCls.setLogCmd("set af align error map " + afid, true);
49418
+ me.htmlCls.clickMenuCls.setLogCmd("set half pae map " + afid, true);
49386
49419
 
49387
49420
  ic.contactMapCls.afErrorMap(afid);
49388
49421
  });
49422
+ me.myEventCls.onIds("#" + me.pre + "reload_afmapfull", "click", function(e) { let ic = me.icn3d;
49423
+ e.preventDefault();
49424
+ if(!me.cfg.notebook) dialog.dialog( "close" );
49425
+ let afid = me.cfg.afid ? me.cfg.afid : $("#" + me.pre + "afid").val();
49426
+
49427
+ me.htmlCls.clickMenuCls.setLogCmd("set full pae map " + afid, true);
49428
+
49429
+ ic.contactMapCls.afErrorMap(afid, true);
49430
+ });
49389
49431
 
49390
49432
  me.myEventCls.onIds("#" + me.pre + "afid", "keyup", function(e) { me.icn3d;
49391
49433
  if (e.keyCode === 13) {
@@ -49420,23 +49462,23 @@ class Events {
49420
49462
  // },
49421
49463
  // clickReload_align_refined: function() {
49422
49464
  me.myEventCls.onIds("#" + me.pre + "reload_align_refined", "click", function(e) { me.icn3d;
49423
- e.preventDefault();
49424
- if(!me.cfg.notebook) dialog.dialog( "close" );
49425
- let alignment = $("#" + me.pre + "alignid1").val() + "," + $("#" + me.pre + "alignid2").val();
49426
- me.htmlCls.clickMenuCls.setLogCmd("load alignment " + alignment + ' | parameters &atype=1', false);
49427
- //window.open(me.htmlCls.baseUrl + 'icn3d/full.html?align=' + alignment + '&showalignseq=1&atype=1', '_blank');
49428
- window.open(hostUrl + '?align=' + alignment + '&showalignseq=1&atype=1', '_blank');
49429
- });
49465
+ e.preventDefault();
49466
+ if(!me.cfg.notebook) dialog.dialog( "close" );
49467
+ let alignment = $("#" + me.pre + "alignid1").val() + "," + $("#" + me.pre + "alignid2").val();
49468
+ me.htmlCls.clickMenuCls.setLogCmd("load alignment " + alignment + ' | parameters &atype=1&bu=1', false);
49469
+ //window.open(me.htmlCls.baseUrl + 'icn3d/full.html?align=' + alignment + '&showalignseq=1&atype=1', '_blank');
49470
+ window.open(hostUrl + '?align=' + alignment + '&showalignseq=1&atype=1&bu=1', '_blank');
49471
+ });
49430
49472
  // },
49431
49473
  // clickReload_align_ori: function() {
49432
49474
  me.myEventCls.onIds("#" + me.pre + "reload_align_ori", "click", function(e) { me.icn3d;
49433
- e.preventDefault();
49434
- if(!me.cfg.notebook) dialog.dialog( "close" );
49435
- let alignment = $("#" + me.pre + "alignid1").val() + "," + $("#" + me.pre + "alignid2").val();
49436
- me.htmlCls.clickMenuCls.setLogCmd("load alignment " + alignment + ' | parameters &atype=0', false);
49437
- //window.open( me.htmlCls.baseUrl + 'icn3d/full.html?align=' + alignment + '&showalignseq=1&atype=0', '_blank');
49438
- window.open(hostUrl + '?align=' + alignment + '&showalignseq=1&atype=0', '_blank');
49439
- });
49475
+ e.preventDefault();
49476
+ if(!me.cfg.notebook) dialog.dialog( "close" );
49477
+ let alignment = $("#" + me.pre + "alignid1").val() + "," + $("#" + me.pre + "alignid2").val();
49478
+ me.htmlCls.clickMenuCls.setLogCmd("load alignment " + alignment + ' | parameters &atype=0&bu=1', false);
49479
+ //window.open( me.htmlCls.baseUrl + 'icn3d/full.html?align=' + alignment + '&showalignseq=1&atype=0', '_blank');
49480
+ window.open(hostUrl + '?align=' + alignment + '&showalignseq=1&atype=0&bu=1', '_blank');
49481
+ });
49440
49482
  // },
49441
49483
  // clickReload_chainalign: function() {
49442
49484
  me.myEventCls.onIds("#" + me.pre + "reload_chainalign", "click", function(e) { me.icn3d;
@@ -49970,14 +50012,43 @@ class Events {
49970
50012
  let reader = new FileReader();
49971
50013
  reader.onload = function(e) {
49972
50014
  let dataStr = e.target.result; // or = reader.result;
49973
- me.htmlCls.clickMenuCls.setLogCmd('load AlphaFold aligned error file ' + $("#" + me.pre + "afmapfile").val(), false);
50015
+ me.htmlCls.clickMenuCls.setLogCmd('load AlphaFold PAE file ' + $("#" + me.pre + "afmapfile").val(), false);
49974
50016
 
49975
- me.htmlCls.dialogCls.openDlg('dl_alignerrormap', 'Show predicted aligned error map');
50017
+ me.htmlCls.dialogCls.openDlg('dl_alignerrormap', 'Show Predicted Aligned Error (PAE) map');
49976
50018
  ic.contactMapCls.processAfErrorMap(JSON.parse(dataStr));
49977
50019
  };
49978
50020
  reader.readAsText(file);
49979
50021
  }
49980
50022
  });
50023
+
50024
+ me.myEventCls.onIds("#" + me.pre + "reload_afmapfilefull", "click", function(e) { let ic = me.icn3d;
50025
+ e.preventDefault();
50026
+ ic.bInitial = true;
50027
+ if(!me.cfg.notebook) dialog.dialog( "close" );
50028
+ //close all dialog
50029
+ if(!me.cfg.notebook) {
50030
+ $(".ui-dialog-content").dialog("close");
50031
+ }
50032
+ else {
50033
+ ic.resizeCanvasCls.closeDialogs();
50034
+ }
50035
+ let file = $("#" + me.pre + "afmapfile")[0].files[0];
50036
+ if(!file) {
50037
+ var aaa = 1; //alert("Please select a file before clicking 'Load'");
50038
+ }
50039
+ else {
50040
+ me.htmlCls.setHtmlCls.fileSupport();
50041
+ let reader = new FileReader();
50042
+ reader.onload = function(e) {
50043
+ let dataStr = e.target.result; // or = reader.result;
50044
+ me.htmlCls.clickMenuCls.setLogCmd('load AlphaFold PAE file ' + $("#" + me.pre + "afmapfile").val(), false);
50045
+
50046
+ me.htmlCls.dialogCls.openDlg('dl_alignerrormap', 'Show Predicted Aligned Error (PAE) map');
50047
+ ic.contactMapCls.processAfErrorMap(JSON.parse(dataStr), true);
50048
+ };
50049
+ reader.readAsText(file);
50050
+ }
50051
+ });
49981
50052
  // },
49982
50053
  // clickReload_urlfile: function() {
49983
50054
  me.myEventCls.onIds("#" + me.pre + "reload_urlfile", "click", function(e) { let ic = me.icn3d;
@@ -50356,9 +50427,17 @@ class Events {
50356
50427
  e.preventDefault();
50357
50428
  //if(!me.cfg.notebook) dialog.dialog( "close" );
50358
50429
  ic.saveFileCls.savePng(me.alignerrormapid, ic.inputid + "_alignerrormap.png", true);
50430
+ });
50431
+ me.myEventCls.onIds("#" + me.alignerrormapid + "_full", "click", function(e) { let ic = me.icn3d;
50432
+ e.preventDefault();
50433
+ //if(!me.cfg.notebook) dialog.dialog( "close" );
50434
+ ic.contactMapCls.afErrorMap(afid, true);
50435
+
50436
+
50359
50437
  });
50360
50438
  me.myEventCls.onIds("#" + me.alignerrormapid + "_json", "click", function(e) { let ic = me.icn3d;
50361
50439
  e.preventDefault();
50440
+
50362
50441
  //if(!me.cfg.notebook) dialog.dialog( "close" );
50363
50442
  let graphStr2 = ic.alignerrormapStr.substr(0, ic.alignerrormapStr.lastIndexOf('}'));
50364
50443
 
@@ -52789,10 +52868,10 @@ class ContactMap {
52789
52868
  }
52790
52869
  }
52791
52870
 
52792
- afErrorMap(afid) { let ic = this.icn3d, me = ic.icn3dui;
52871
+ afErrorMap(afid, bFull) { let ic = this.icn3d, me = ic.icn3dui;
52793
52872
  let thisClass = this;
52794
52873
 
52795
- me.htmlCls.dialogCls.openDlg('dl_alignerrormap', 'Show predicted aligned error map');
52874
+ me.htmlCls.dialogCls.openDlg('dl_alignerrormap', 'Show Predicted Aligned Error (PAE) map');
52796
52875
 
52797
52876
  let url, dataType;
52798
52877
 
@@ -52807,7 +52886,7 @@ class ContactMap {
52807
52886
  tryCount : 0,
52808
52887
  retryLimit : 1,
52809
52888
  success: function(data) {
52810
- thisClass.processAfErrorMap(data);
52889
+ thisClass.processAfErrorMap(data, bFull);
52811
52890
  },
52812
52891
  error : function(xhr, textStatus, errorThrown ) {
52813
52892
  this.tryCount++;
@@ -52816,19 +52895,19 @@ class ContactMap {
52816
52895
  $.ajax(this);
52817
52896
  return;
52818
52897
  }
52819
- var aaa = 1; //alert("There are some problems in loading the predicted aligned error file...");
52898
+ var aaa = 1; //alert("There are some problems in loading the PAE file...");
52820
52899
  return;
52821
52900
  }
52822
52901
  });
52823
52902
  }
52824
52903
 
52825
- processAfErrorMap(dataJson) { let ic = this.icn3d, me = ic.icn3dui;
52904
+ processAfErrorMap(dataJson, bFull) { let ic = this.icn3d, me = ic.icn3dui;
52826
52905
  // json format: [{"residue1": [1, ..., 1, ..., n, ..., n], "residue2": [1, 2, ..., n, ..., 1, 2, ..., n],
52827
52906
  // "distance": [n*n matrix],"max_predicted_aligned_error":31.75}]
52828
52907
  let distMatrix = dataJson[0].distance;
52829
52908
  let max = dataJson[0].max_predicted_aligned_error;
52830
52909
  if(!distMatrix || !max) {
52831
- var aaa = 1; //alert("The predicted aligned error file didn't have the right format...");
52910
+ var aaa = 1; //alert("The PAE file didn't have the right format...");
52832
52911
  return;
52833
52912
  }
52834
52913
 
@@ -52840,18 +52919,39 @@ class ContactMap {
52840
52919
  let postA = '', postB = '.';
52841
52920
 
52842
52921
  // initialize some parameters if no structure wasloaded yet
52843
- if(!ic.chains) ic.init_base();
52922
+ let bStruData;
52923
+ if(!ic.chains || Object.keys(ic.chains).length == 0) {
52924
+ bStruData = false;
52925
+ ic.init_base();
52926
+ }
52927
+ else {
52928
+ bStruData = true;
52929
+ }
52844
52930
 
52845
- let chainidArray = Object.keys(ic.chains);
52846
- let chainid = (chainidArray.length == 1) ? chainidArray[0] : 'stru_A';
52931
+ //let chainidArray = Object.keys(ic.chains);
52932
+ //let chainid = (chainidArray.length == 1) ? chainidArray[0] : 'stru_A';
52847
52933
 
52848
52934
  let dim = parseInt(Math.sqrt(distMatrix.length));
52849
52935
 
52936
+ // map index with residue number when the structure has multiple chains
52937
+ let index = 0;
52938
+ let index2resObj = {};
52939
+ for(let chainid in ic.chains) {
52940
+ for(let j = 0, jl = ic.chainsSeq[chainid].length; j < jl; ++j) {
52941
+ index2resObj[index] = ic.chainsSeq[chainid][j];
52942
+ index2resObj[index].chainid = chainid;
52943
+ ++index;
52944
+ }
52945
+ }
52946
+
52850
52947
  //for(let chainid in ic.chains) {
52851
52948
  //for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
52949
+ index = 0;
52852
52950
  for(let i = 0; i < dim; ++i) {
52853
- let resi = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid][i].resi : i + 1;
52854
- let resn = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid][i].name : '*';
52951
+ let resi = (bStruData) ? index2resObj[i].resi : i + 1;
52952
+ let resn = (bStruData) ? index2resObj[i].name : '*';
52953
+ let chainid = (bStruData) ? index2resObj[i].chainid : 'stru_A';
52954
+
52855
52955
  let resid = chainid + '_' + resi;
52856
52956
  let atom = (ic.residues[resid]) ? ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid])
52857
52957
  : {color: me.parasCls.thr(0x888888)};
@@ -52864,13 +52964,19 @@ class ContactMap {
52864
52964
  nodeStr += ', {"id":"' + idStr + postB + '","r":"1_1_' + resid + '","s":"b","c":"' + color + '"}';
52865
52965
  bNode = true;
52866
52966
 
52967
+ let start = (bFull) ? 0 : i; // full map, or half map
52968
+
52867
52969
  //for(let j = 0, jl = ic.chainsSeq[chainid].length; j < jl; ++j) {
52868
52970
  //for(let j = 0; j < dim; ++j) {
52869
- for(let j = i; j < dim; ++j) { // half map
52870
- let resi2 = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid][j].resi : j + 1;
52871
- let resn2 = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid][j].name : '*';
52872
- let idStr2 = resn2 + resi2 + '.' + chain;
52873
- let index = i * dim + j;
52971
+ for(let j = start; j < dim; ++j) {
52972
+ index = i * dim + j;
52973
+ let resi2 = (bStruData) ? index2resObj[j].resi : j + 1;
52974
+ let resn2 = (bStruData) ? index2resObj[j].name : '*';
52975
+ let chainid2 = (bStruData) ? index2resObj[j].chainid : 'stru_A';
52976
+ let chain2 = chainid2.substr(chainid2.indexOf('_') + 1);
52977
+
52978
+ let idStr2 = resn2 + resi2 + '.' + chain2;
52979
+
52874
52980
  // max dark green color 004d00, 0x4d = 77, 77/255 = 0.302
52875
52981
  // 0: 004d00, max: FFFFFF
52876
52982
  let ratio = (distMatrix[index]) ? distMatrix[index] / max : 0;
@@ -55394,7 +55500,7 @@ iCn3D.prototype.init = function (bKeepCmd) {
55394
55500
  //this.inputid = {"idtype": undefined, "id":undefined}; // support pdbid, mmdbid
55395
55501
 
55396
55502
  this.biomtMatrices = [];
55397
- this.bAssembly = true;
55503
+ this.bAssembly = false; //true;
55398
55504
 
55399
55505
  this.bDrawn = false;
55400
55506
  this.bSecondaryStructure = false;
@@ -55532,7 +55638,7 @@ iCn3D.prototype.reinitAfterLoad = function () { let ic = this, me = ic.icn3dui;
55532
55638
  ic.lines = {}; // hash of name -> a list of solid or dashed lines. Each line contains 'position1', 'position2', 'color', and a boolean of 'dashed'
55533
55639
  // line name could be custom, hbond, ssbond, distance
55534
55640
 
55535
- ic.bAssembly = true;
55641
+ ic.bAssembly = false; //true;
55536
55642
  };
55537
55643
 
55538
55644
  iCn3D.prototype.resetConfig = function () { let ic = this, me = ic.icn3dui;
@@ -55571,7 +55677,7 @@ class iCn3DUI {
55571
55677
  //even when multiple iCn3D viewers are shown together.
55572
55678
  this.pre = this.cfg.divid + "_";
55573
55679
 
55574
- this.REVISION = '3.8.0';
55680
+ this.REVISION = '3.8.1';
55575
55681
 
55576
55682
  // In nodejs, iCn3D defines "window = {navigator: {}}"
55577
55683
  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.8.0",
3
+ "version": "3.8.1",
4
4
  "main": "icn3d.js",
5
5
  "description": "iCn3D Structure Viewer",
6
6
  "repository": {
@@ -15,6 +15,6 @@
15
15
  "dependencies": {
16
16
  "jquery": "^3.5.0",
17
17
  "jsdom": "^16.5.3",
18
- "three": "~0.128.0"
18
+ "three": "~0.137.0"
19
19
  }
20
20
  }