icn3d 3.31.9 → 3.31.11

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
@@ -9963,9 +9963,9 @@ class ClickMenu {
9963
9963
  });
9964
9964
 
9965
9965
  me.myEventCls.onIds("#" + me.pre + "mn1_collection", "click", function (e) { me.icn3d; //e.preventDefault();
9966
- me.htmlCls.dialogCls.openDlg('dl_collection', 'Please input the collection file');
9967
- });
9968
-
9966
+ me.htmlCls.dialogCls.openDlg("dl_selectCollections", "Select Collections");
9967
+ });
9968
+
9969
9969
  me.myEventCls.onIds("#" + me.pre + "mn1_dsn6", "click", function(e) { me.icn3d; //e.preventDefault();
9970
9970
  me.htmlCls.dialogCls.openDlg('dl_dsn6', 'Please input the map file to display electron density map');
9971
9971
  });
@@ -15032,18 +15032,18 @@ class SetDialog {
15032
15032
  html += me.htmlCls.buttonStr + "reload_selectionfile' style='margin-top: 6px;'>Load</button>";
15033
15033
  html += "</div>";
15034
15034
 
15035
- html += me.htmlCls.divStr + "dl_collection' class='" + dialogClass + "'>";
15036
- html += this.addNotebookTitle('dl_collection', 'Please input the collection file');
15035
+ html += me.htmlCls.divStr + "dl_selectCollections' class='" + dialogClass + "'>";
15036
+ html += me.htmlCls.divStr + "dl_collectionsMenu'>";
15037
+ html += '<b>Collection File</b>: <div style="width:20px; margin-top:6px; display:inline-block;"><span id="' + me.pre + 'dl_collection_file_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="display:none; width:15px;" title="Expand"></span><span id="' + me.pre + 'dl_collection_file_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="width:15px;" title="Shrink"></span></div><br>';
15038
+ html += me.htmlCls.divStr + "dl_collection_file' style=''>";
15037
15039
  html += "You can load a collection of structures via a file. Here is <a href='https://github.com/ncbi/icn3d/blob/master/example/collection.json' target='_blank'>one example file</a><br><br>";
15038
15040
  html += "Collection file: " + me.htmlCls.inputFileStr + "id='" + me.pre + "collectionfile'><br/>";
15039
15041
  html += me.htmlCls.buttonStr + "reload_collectionfile' style='margin-top: 6px;'>Load</button>";
15040
15042
  html += "</div>";
15041
-
15042
- html += me.htmlCls.divStr + "dl_selectCollections' class='" + dialogClass + "'>";
15043
- html += me.htmlCls.divStr + "dl_collectionsMenu'>";
15044
- html += "<b>Structures:</b> <br/>";
15045
- html += "<select id='" + me.pre + "collections_menu' multiple size='6' style='min-width:130px;'>";
15046
- html += "</select>";
15043
+ html += "</div>";
15044
+ html += '<br/><b>Structures</b>: <div style="width:20px; margin-top:6px; display:inline-block;"><span id="' + me.pre + 'dl_collection_structures_expand" class="ui-icon ui-icon-plus icn3d-expand icn3d-link" style="width:15px;" title="Expand"></span><span id="' + me.pre + 'dl_collection_structures_shrink" class="ui-icon ui-icon-minus icn3d-shrink icn3d-link" style="display:none; width:15px;" title="Shrink"></span></div><br>';
15045
+ html += me.htmlCls.divStr + "dl_collection_structures' style='display: none'>";
15046
+ html += "<select id='" + me.pre + "collections_menu'multiple size='6' style='min-width:300px;'></select>";
15047
15047
  html += "</div>";
15048
15048
  html += "</div>";
15049
15049
 
@@ -17406,17 +17406,13 @@ class Events {
17406
17406
  ic.resizeCanvasCls.closeDialogs();
17407
17407
  }
17408
17408
  me.htmlCls.setHtmlCls.fileSupport();
17409
- let reader = new FileReader();
17410
- reader.onload = async function (e) {
17409
+ let reader = new FileReader();
17410
+
17411
+ reader.onload = async function (e) {
17411
17412
  let dataStr = JSON.parse(e.target.result);
17412
17413
  let collection = [dataStr["structures"].map(({ id }) => id), dataStr["structures"].map(({ title }) => title)];
17413
17414
  let collectionHtml = ic.selectCollectionsCls.setAtomMenu(collection[0], collection[1]);
17414
- let bNoDuplicate = true;
17415
- await ic.chainalignParserCls.downloadMmdbAf(collection[0][0], undefined, undefined, bNoDuplicate);
17416
-
17417
- ic.opts["color"] = "structure";
17418
- ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
17419
-
17415
+
17420
17416
  $("#" + ic.pre + "collections_menu").html(collectionHtml);
17421
17417
  ic.selectCollectionsCls.clickStructure();
17422
17418
 
@@ -17427,8 +17423,27 @@ class Events {
17427
17423
  $("#" + me.pre + "collectionfile").val(),
17428
17424
  false
17429
17425
  );
17426
+
17430
17427
  };
17431
17428
  reader.readAsText(file);
17429
+
17430
+ if (Object.keys(me.utilsCls.getStructures(ic.dAtoms))){
17431
+ $("#" + me.pre + "dl_collection_file").hide();
17432
+ $("#" + me.pre + "dl_collection_structures").show();
17433
+ $("#" + me.pre + "dl_collection_file_expand").show();
17434
+ $("#" + me.pre + "dl_collection_file_shrink").hide();
17435
+ $("#" + me.pre + "dl_collection_structures_expand").hide();
17436
+ $("#" + me.pre + "dl_collection_structures_shrink").show();
17437
+
17438
+ } else {
17439
+ $("#" + me.pre + "dl_collection_file").show();
17440
+ $("#" + me.pre + "dl_collection_structures").hide();
17441
+ $("#" + me.pre + "dl_collection_file_expand").hide();
17442
+ $("#" + me.pre + "dl_collection_file_shrink").hide();
17443
+ $("#" + me.pre + "dl_collection_structures_expand").show();
17444
+ $("#" + me.pre + "dl_collection_structures_shrink").hide();
17445
+ }
17446
+
17432
17447
  me.htmlCls.dialogCls.openDlg("dl_selectCollections", "Select Collections");
17433
17448
  }
17434
17449
  });
@@ -41766,8 +41781,10 @@ class AnnoIg {
41766
41781
  }
41767
41782
 
41768
41783
  showRefNum(giSeq, chnid, kabat_or_imgt, bCustom) { let ic = this.icn3d; ic.icn3dui;
41769
- let bResult = ic.chainid2igtrack[chnid];
41770
- if(!bResult) return {html: '', html2: '', html3: ''};
41784
+ if(ic.chainid2igtrack) {
41785
+ let bResult = ic.chainid2igtrack[chnid];
41786
+ if(!bResult) return {html: '', html2: '', html3: ''};
41787
+ }
41771
41788
 
41772
41789
  let html = this.getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt);
41773
41790
 
@@ -41834,12 +41851,13 @@ class AnnoIg {
41834
41851
  ic.chain2igArray[chnid] = [];
41835
41852
  this.setChain2igArray(chnid, giSeq, bCustom);
41836
41853
 
41837
-
41838
41854
  // remove Igs without BCEF strands one more time
41839
41855
  let igArray = ic.chain2igArray[chnid];
41840
41856
 
41841
41857
  for(let i = 0, il = igArray.length; i < il; ++i) {
41842
41858
  let domainid = igArray[i].domainid;
41859
+
41860
+ if(!ic.domainid2info) continue;
41843
41861
  let info = ic.domainid2info[domainid];
41844
41862
  if(!info) continue;
41845
41863
 
@@ -41907,7 +41925,6 @@ class AnnoIg {
41907
41925
  }
41908
41926
  }
41909
41927
 
41910
-
41911
41928
  // reset ic.chain2igArray
41912
41929
  ic.chain2igArray[chnid] = [];
41913
41930
  this.setChain2igArray(chnid, giSeq, bCustom);
@@ -41926,7 +41943,7 @@ class AnnoIg {
41926
41943
  // htmlIg += '<span></span>';
41927
41944
  //}
41928
41945
  //else {
41929
- refnumLabel = ic.resid2refnum[residueid];
41946
+ refnumLabel = (bCustom) ? ic.chainsMapping[chnid][residueid] : ic.resid2refnum[residueid];
41930
41947
  let bHidelabel = false;
41931
41948
 
41932
41949
  if(refnumLabel) {
@@ -42051,9 +42068,14 @@ class AnnoIg {
42051
42068
  html3 += htmlTmp + '<br>';
42052
42069
  html += htmlTmp + '<span class="icn3d-seqLine">';
42053
42070
 
42071
+ if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqStartLen[chnid], '-');
42072
+
42054
42073
  html += htmlIg;
42055
42074
 
42056
- html += htmlCnt;
42075
+ if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqEndLen[chnid], '-');
42076
+
42077
+ if(!bCustom) html += htmlCnt;
42078
+
42057
42079
  html += '</span>';
42058
42080
  html += '<br>';
42059
42081
  html += '</div>';
@@ -42067,6 +42089,8 @@ class AnnoIg {
42067
42089
 
42068
42090
  for(let i = 0, il = igArray.length; i < il; ++i) {
42069
42091
  let domainid = igArray[i].domainid;
42092
+ if(!ic.domainid2info) continue;
42093
+
42070
42094
  let info = ic.domainid2info[domainid];
42071
42095
  if(!info) continue;
42072
42096
 
@@ -42095,6 +42119,8 @@ class AnnoIg {
42095
42119
  html2 += htmlTitle;
42096
42120
  html2 += htmlCnt + '<span class="icn3d-seqLine">';
42097
42121
 
42122
+ if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
42123
+
42098
42124
  let prevDomainindex, color;
42099
42125
  for(let i = 0, il = fromArray.length; i < il; ++i) {
42100
42126
  let resi = ic.ParserUtilsCls.getResi(chnid, fromArray[i]);
@@ -42526,7 +42552,7 @@ class AnnoDomain {
42526
42552
 
42527
42553
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
42528
42554
 
42529
- if(me.cfg.blast_rep_id != chnid) { // regular
42555
+ if(me.cfg.blast_rep_id != chnid) { // regular
42530
42556
  for(let i = 0, il = posFromArray.length; i < il; ++i) {
42531
42557
  // let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i] - ic.baseResi[chnid] - 1) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
42532
42558
  let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(posFromArray[i]) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(posFromArray[i] - posToArray[i-1] - 1) / ic.maxAnnoLength);
@@ -42535,7 +42561,7 @@ class AnnoDomain {
42535
42561
  html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(posToArray[i] - posFromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + posFromArray + '" to="' + posToArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + chnid + '_3d_domain_' +(index+1).toString() + '" id="' + chnid + '_3d_domain_' + index + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">3D domain ' +(index+1).toString() + '</div>';
42536
42562
  }
42537
42563
  }
42538
- else { // with potential gaps
42564
+ else { // with potential gaps
42539
42565
  let fromArray2 = [], toArray2 = [];
42540
42566
  for(let i = 0, il = fromArray.length; i < il; ++i) {
42541
42567
  fromArray2.push(fromArray[i]);
@@ -47839,6 +47865,7 @@ class ShowAnno {
47839
47865
  // the missing residues at the end of the seq will be filled up in the API showNewTrack()
47840
47866
  let nGap = 0;
47841
47867
  ic.alnChainsSeq[chnid] = [];
47868
+
47842
47869
  //let offset =(ic.chainid2offset[chnid]) ? ic.chainid2offset[chnid] : 0;
47843
47870
  for(let i = 0, il = targetSeq.length; i < il; ++i) {
47844
47871
  //text += ic.showSeqCls.insertGap(chnid, i, '-', true);
@@ -48458,6 +48485,7 @@ class ShowSeq {
48458
48485
  let bCustom = true;
48459
48486
  let result = ic.annoIgCls.showRefNum(giSeq, chnid, undefined, bCustom);
48460
48487
  html += result.html;
48488
+ // html2 += result.html2;
48461
48489
  html3 += result.html3;
48462
48490
  }
48463
48491
  }
@@ -57931,8 +57959,9 @@ class RealignParser {
57931
57959
  }
57932
57960
 
57933
57961
  // If rmsd from vastsrv is too large, realign the chains
57934
- //if(me.cfg.chainalign && !me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57935
- if(!me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57962
+ //if(me.cfg.chainalign && !me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57963
+ // redo algnment only for VAST serv page
57964
+ if(!me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57936
57965
  console.log("RMSD from VAST is larger than 5. Realign the chains with TM-align.");
57937
57966
  //let nameArray = me.cfg.chainalign.split(',');
57938
57967
  let nameArray = Object.keys(chainidHash);
@@ -61894,13 +61923,15 @@ class SetSeqAlign {
61894
61923
  ic.alnChains = {};
61895
61924
  ic.alnChains[chainid1] = {};
61896
61925
 
61897
- let resi2range_t = {}; // accumulative aligned residues in the template chain
61926
+ let resid2range_t = {}; // accumulative aligned residues in the template chain
61898
61927
  // start and end of MSA
61899
61928
  let start_t = 9999, end_t = -1;
61900
61929
 
61901
61930
  let baseResi = ic.chainsSeq[chainid1][0].resi - 1;
61931
+
61902
61932
  for(let index = 1, indexl = chainidArray.length; index < indexl; ++index) {
61903
61933
  let chainIndex = index - 1;
61934
+ chainidArray[index];
61904
61935
  if(!ic.qt_start_end[chainIndex]) continue;
61905
61936
 
61906
61937
  for(let i = 0, il = ic.qt_start_end[chainIndex].length; i < il; ++i) {
@@ -61911,11 +61942,12 @@ class SetSeqAlign {
61911
61942
  // end1 = ic.qt_start_end[chainIndex][i].t_end;
61912
61943
  // }
61913
61944
  // else {
61945
+ //ic.qt_start_end is zero-based
61914
61946
  start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start) - 1;
61915
61947
  end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end) - 1;
61916
61948
  // }
61917
61949
  for(let j = start1; j <= end1; ++j) {
61918
- let resi;
61950
+ let resi, resid;
61919
61951
 
61920
61952
  // if(me.cfg.aligntool == 'tmalign') { // tmalign: just one residue in this for loop
61921
61953
  // resi = ic.qt_start_end[chainIndex][i].t_start;
@@ -61927,53 +61959,56 @@ class SetSeqAlign {
61927
61959
  resiPos = j - baseResi;
61928
61960
  }
61929
61961
  else {
61930
- resiPos = (bRealign) ? j : j - baseResi;
61962
+ // resiPos = (bRealign) ? j : j - baseResi;
61963
+ resiPos = j;
61931
61964
  }
61932
61965
  resi = ic.ParserUtilsCls.getResi(chainidArray[0], resiPos);
61966
+ resid = chainidArray[0] + '_' + resi;
61933
61967
  // }
61934
61968
 
61935
- resi2range_t[resi] = 1;
61969
+ resid2range_t[resid] = 1;
61936
61970
  if(j < start_t) start_t = j;
61937
61971
  if(j > end_t) end_t = j;
61938
61972
  }
61939
61973
  }
61940
61974
  }
61941
-
61975
+
61942
61976
  // TM-align should use "start1 = ic.qt_start_end[chainIndex][i].t_start - 1", but the rest are the same as ""bRealign"
61943
61977
  if(me.cfg.aligntool == 'tmalign') bRealign = true; // real residue numbers are stored
61944
61978
 
61945
- let resi2rangeArray = Object.keys(resi2range_t);
61946
- resi2rangeArray.sort(function(a, b) {
61947
- return parseInt(a) - parseInt(b);
61979
+ let resid2rangeArray = Object.keys(resid2range_t);
61980
+ resid2rangeArray.sort(function(a, b) {
61981
+ return parseInt(a.split('_')[2]) - parseInt(b.split('_')[2]);
61948
61982
  });
61949
61983
 
61950
61984
  // assign range to each resi
61951
- let prevResi = -999, start = 0, end = 0, resiArray = [], prevEnd = 0;
61952
- for(let i = 0, il = resi2rangeArray.length; i < il; ++i) {
61953
- let resi = resi2rangeArray[i];
61985
+ let prevResi = -999, start = 0, end = 0, residArray = [], prevEnd = 0;
61986
+ for(let i = 0, il = resid2rangeArray.length; i < il; ++i) {
61987
+ let resid = resid2rangeArray[i];
61988
+ let resi = resid.split('_')[2];
61954
61989
 
61955
61990
  if(i == 0) {
61956
61991
  start = resi;
61957
61992
  }
61958
61993
  else if(i > 0 && ic.resid2ncbi[resi] != ic.resid2ncbi[prevResi] + 1 && ic.resid2ncbi[resi] != ic.resid2ncbi[prevResi]) { // new start
61959
61994
  end = prevResi;
61960
- for(let j = 0, jl = resiArray.length; j < jl; ++j) {
61961
- resi2range_t[resiArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61995
+ for(let j = 0, jl = residArray.length; j < jl; ++j) {
61996
+ resid2range_t[residArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61962
61997
  }
61963
61998
 
61964
- resiArray = [];
61999
+ residArray = [];
61965
62000
  start = resi;
61966
62001
  prevEnd = end;
61967
62002
  }
61968
62003
 
61969
- resiArray.push(resi);
62004
+ residArray.push(resid);
61970
62005
 
61971
62006
  prevResi = resi;
61972
62007
  }
61973
62008
 
61974
62009
  end = prevResi;
61975
- for(let j = 0, jl = resiArray.length; j < jl; ++j) {
61976
- resi2range_t[resiArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
62010
+ for(let j = 0, jl = residArray.length; j < jl; ++j) {
62011
+ resid2range_t[residArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61977
62012
  }
61978
62013
 
61979
62014
  for(let i = 0, il = chainidArray.length; i < il; ++i) {
@@ -61987,6 +62022,7 @@ class SetSeqAlign {
61987
62022
  // fill the template ic.alnChainsSeq[chainid1]
61988
62023
  for(let j = 0, jl = ic.chainsSeq[chainid1].length; j < jl; ++j) {
61989
62024
  let resi = ic.chainsSeq[chainid1][j].resi;
62025
+ let resid = chainid1 + '_' + resi;
61990
62026
 
61991
62027
  let jAdjusted = (me.cfg.aligntool != 'tmalign') ? j : j + baseResi;
61992
62028
 
@@ -62000,15 +62036,15 @@ class SetSeqAlign {
62000
62036
  resObject.mmdbid = chainid1.substr(0, pos);
62001
62037
  resObject.chain = chainid1.substr(pos+1);
62002
62038
  resObject.resi = resi;
62003
- resObject.resn = (resi2range_t[resi]) ? ic.chainsSeq[chainid1][j].name.toUpperCase() : ic.chainsSeq[chainid1][j].name.toLowerCase();
62004
- resObject.aligned = (resi2range_t[resi]) ? true : false;
62005
- resObject.color = (resi2range_t[resi]) ? '#FF0000' : me.htmlCls.GREYC; // color by identity
62006
- resObject.color2 = (resi2range_t[resi]) ? '#FF0000' : me.htmlCls.GREYC; // color by conservation
62007
- resObject.class = (resi2range_t[resi]) ? 'icn3d-align' : 'icn3d-nalign';
62039
+ resObject.resn = (resid2range_t[resid]) ? ic.chainsSeq[chainid1][j].name.toUpperCase() : ic.chainsSeq[chainid1][j].name.toLowerCase();
62040
+ resObject.aligned = (resid2range_t[resid]) ? true : false;
62041
+ resObject.color = (resid2range_t[resid]) ? '#FF0000' : me.htmlCls.GREYC; // color by identity
62042
+ resObject.color2 = (resid2range_t[resid]) ? '#FF0000' : me.htmlCls.GREYC; // color by conservation
62043
+ resObject.class = (resid2range_t[resid]) ? 'icn3d-align' : 'icn3d-nalign';
62008
62044
 
62009
62045
  ic.alnChainsSeq[chainid1].push(resObject);
62010
62046
 
62011
- if(resi2range_t[resi]) {
62047
+ if(resid2range_t[resid]) {
62012
62048
  $.extend(ic.alnChains[chainid1], ic.residues[chainid1 + '_' + resObject.resi] );
62013
62049
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, ic.residues[chainid1 + '_' + resObject.resi]);
62014
62050
  }
@@ -62020,7 +62056,7 @@ class SetSeqAlign {
62020
62056
  for(let arrayIndex = 0, arrayIndexl = index_alignLen.length; arrayIndex < arrayIndexl; ++arrayIndex) {
62021
62057
  let index = index_alignLen[arrayIndex].index;
62022
62058
  alignedChainIndice.push(index);
62023
- let hAtomsTmp = this.mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resi2range_t, start_t, end_t, bRealign);
62059
+ let hAtomsTmp = this.mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resid2range_t, start_t, end_t, bRealign);
62024
62060
 
62025
62061
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
62026
62062
  }
@@ -62193,7 +62229,7 @@ class SetSeqAlign {
62193
62229
  return {"pos1": result1.pos, "pos2": result2.pos};
62194
62230
  }
62195
62231
 
62196
- mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resi2range_t, start_t, end_t, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
62232
+ mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resid2range_t, start_t, end_t, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
62197
62233
  let hAtoms = {};
62198
62234
 
62199
62235
  let chainid = chainidArray[index];
@@ -62282,7 +62318,7 @@ class SetSeqAlign {
62282
62318
  start1Pos = start1;
62283
62319
  end1Pos = end1;
62284
62320
  }
62285
- //let range = resi2range_t[resiStart1];
62321
+ //let range = resid2range_t[chainid1 + '_' + resiStart1];
62286
62322
 
62287
62323
  // if the mapping does not start from start_t, add gaps to the query seq
62288
62324
  if(i == 0) {
@@ -67750,70 +67786,181 @@ class SelectCollections {
67750
67786
  return html;
67751
67787
  }
67752
67788
 
67789
+ reset() {
67790
+ let ic = this.icn3d;
67791
+
67792
+ ic.atoms = {};
67793
+
67794
+ ic.proteins = {};
67795
+ ic.nucleotides = {};
67796
+ ic.chemicals = {};
67797
+ ic.ions = {};
67798
+ ic.water = {};
67799
+
67800
+ ic.structures = {};
67801
+ ic.chains = {};
67802
+ ic.chainsSeq = {};
67803
+ ic.residues = {};
67804
+
67805
+ ic.defNames2Atoms = {};
67806
+ ic.defNames2Residues = {};
67807
+
67808
+ ic.ssbondpnts = {};
67809
+
67810
+ ic.bShowHighlight = false;
67811
+ ic.bResetSets = true;
67812
+ }
67813
+
67814
+ dictionaryDifference(dict1, dict2) {
67815
+ const difference = {};
67816
+
67817
+ for (let key in dict2) {
67818
+ if (!(key in dict1)) {
67819
+ difference[key] = dict2[key];
67820
+ }
67821
+ }
67822
+
67823
+ return difference;
67824
+ }
67825
+
67753
67826
  clickStructure() {
67754
67827
  let ic = this.icn3d,
67755
67828
  me = ic.icn3dui;
67756
67829
  let thisClass = this;
67757
67830
 
67831
+ if (ic.allData == undefined) {
67832
+ ic.allData = {};
67833
+ ic.allData['all'] = {
67834
+ 'atoms': {},
67835
+ 'proteins': {},
67836
+ 'nucleotides': {},
67837
+ 'chemicals': {},
67838
+ 'ions': {},
67839
+ 'water': {},
67840
+ 'structures': {}, // getSSExpandedAtoms
67841
+ 'ssbondpnts': {},
67842
+ 'residues': {}, // getSSExpandedAtoms
67843
+ 'chains': {},
67844
+ 'chainsSeq': {}, //Sequences and Annotation
67845
+ 'defNames2Atoms': {},
67846
+ 'defNames2Residues': {}
67847
+ };
67848
+ ic.allData['prev'] = {};
67849
+ }
67850
+
67758
67851
  //me.myEventCls.onIds("#" + ic.pre + "atomsCustom", "change", function(e) { let ic = thisClass.icn3d;
67759
67852
  $("#" + ic.pre + "collections_menu").change(async function (e) {
67760
67853
  let ic = thisClass.icn3d;
67761
- // ic.init()
67854
+
67762
67855
  let nameArray = $(this).val();
67763
67856
  let nameStructure = $(this).find("option:selected").text();
67764
67857
 
67765
67858
  ic.nameArray = nameArray;
67766
67859
  if (nameArray !== null) {
67767
- ic.bShowHighlight = false;
67860
+ // let chainIdHash = {};
67861
+
67768
67862
  let bNoDuplicate = true;
67769
- await ic.chainalignParserCls.downloadMmdbAf(nameArray.toString(), undefined, undefined, bNoDuplicate);
67863
+ thisClass.reset();
67864
+ for (const name of nameArray) {
67865
+ if (!(name in ic.allData)) {
67866
+ ic.allData['prev'] = JSON.parse(JSON.stringify(ic.allData['all']));//me.hashUtilsCls.cloneHash(ic.allData['all']);
67770
67867
 
67771
- ic.dAtoms = {};
67772
- ic.hAtoms = {};
67773
- // ic.ssbondpnts = {};
67774
- let chainIdHash = {};
67775
-
67776
- for (const name in nameArray) {
67777
- for (const key in ic.chains) {
67778
- if (key.includes(nameArray[name])) {
67779
- chainIdHash[key] = 1;
67780
- if (ic.chains.hasOwnProperty(key)) {
67781
- const innerDict = ic.chains[key];
67782
- for (const innerKey in innerDict) {
67783
- if (innerDict.hasOwnProperty(innerKey)) {
67784
- ic.dAtoms[innerKey] = innerDict[innerKey];
67785
- ic.hAtoms[innerKey] = innerDict[innerKey];
67786
- }
67787
- }
67788
- }
67789
- }
67868
+ ic.atoms = ic.allData['all']['atoms'];
67869
+
67870
+ ic.proteins = ic.allData['all']['proteins'];
67871
+ ic.nucleotides = ic.allData['all']['nucleotides'];
67872
+ ic.chemicals = ic.allData['all']['chemicals'];
67873
+ ic.ions = ic.allData['all']['ions'];
67874
+ ic.water = ic.allData['all']['water'];
67875
+
67876
+ ic.structures = ic.allData['all']['structures'];
67877
+ ic.ssbondpnts = ic.allData['all']['ssbondpnts'];
67878
+ ic.residues = ic.allData['all']['residues'];
67879
+ ic.chains = ic.allData['all']['chains'];
67880
+ ic.chainsSeq = ic.allData['all']['chainsSeq'];
67881
+ ic.defalls2Atoms = ic.allData['all']['defalls2Atoms'];
67882
+ ic.defalls2Residues = ic.allData['all']['defalls2Residues'];
67883
+ await ic.chainalignParserCls.downloadMmdbAf(name, undefined, undefined, bNoDuplicate).then(() => {
67884
+ ic.allData['all'] = {
67885
+ 'atoms': ic.atoms,
67886
+ 'proteins': ic.proteins,
67887
+ 'nucleotides': ic.nucleotides,
67888
+ 'chemicals': ic.chemicals,
67889
+ 'ions': ic.ions,
67890
+ 'water': ic.water,
67891
+ 'structures': ic.structures, // getSSExpandedAtoms
67892
+ 'ssbondpnts': ic.ssbondpnts,
67893
+ 'residues': ic.residues, // getSSExpandedAtoms
67894
+ 'chains': ic.chains,
67895
+ 'chainsSeq': ic.chainsSeq, //Sequences and Annotation
67896
+ 'defNames2Atoms': ic.defNames2Atoms,
67897
+ 'defNames2Residues': ic.defNames2Residues
67898
+ };
67899
+
67900
+ ic.allData[name] = {
67901
+ 'atoms': thisClass.dictionaryDifference(ic.allData['prev']['atoms'], ic.atoms),
67902
+ 'proteins': thisClass.dictionaryDifference(ic.allData['prev']['proteins'], ic.proteins),
67903
+ 'nucleotides': thisClass.dictionaryDifference(ic.allData['prev']['nucleotides'], ic.nucleotides),
67904
+ 'chemicals': thisClass.dictionaryDifference(ic.allData['prev']['chemicals'], ic.chemicals),
67905
+ 'ions': thisClass.dictionaryDifference(ic.allData['prev']['ions'], ic.ions),
67906
+ 'water': thisClass.dictionaryDifference(ic.allData['prev']['water'], ic.water),
67907
+ 'structures': thisClass.dictionaryDifference(ic.allData['prev']['structures'], ic.structures), // getSSExpandedAtoms
67908
+ 'ssbondpnts': thisClass.dictionaryDifference(ic.allData['prev']['ssbondpnts'], ic.ssbondpnts),
67909
+ 'residues': thisClass.dictionaryDifference(ic.allData['prev']['residues'], ic.residues), // getSSExpandedAtoms
67910
+ 'chains': thisClass.dictionaryDifference(ic.allData['prev']['chains'], ic.chains),
67911
+ 'chainsSeq': thisClass.dictionaryDifference(ic.allData['prev']['chainsSeq'], ic.chainsSeq), //Sequences and Annotation
67912
+ 'defNames2Atoms': thisClass.dictionaryDifference(ic.allData['prev']['defNames2Atoms'], ic.defNames2Atoms),
67913
+ 'defNames2Residues': thisClass.dictionaryDifference(ic.allData['prev']['defNames2Residues'], ic.defNames2Residues)
67914
+ };
67915
+
67916
+ // ic.atoms = Object.assign(ic.atoms, ic.atomsTemp);
67917
+ thisClass.reset();
67918
+ });
67790
67919
  }
67791
67920
  }
67921
+ for (const name of nameArray) {
67922
+ ic.atoms = Object.assign(ic.atoms, ic.allData[name]['atoms']);
67923
+
67924
+ ic.proteins = Object.assign(ic.proteins, ic.allData[name]['proteins']);
67925
+ ic.nucleotides = Object.assign(ic.nucleotides, ic.allData[name]['nucleotides']);
67926
+ ic.chemicals = Object.assign(ic.chemicals, ic.allData[name]['chemicals']);
67927
+ ic.ions = Object.assign(ic.ions, ic.allData[name]['ions']);
67928
+ ic.water = Object.assign(ic.water, ic.allData[name]['water']);
67929
+
67930
+ ic.structures = Object.assign(ic.structures, ic.allData[name]['structures']);
67931
+ ic.ssbondpnts = Object.assign(ic.ssbondpnts, ic.allData[name]['ssbondpnts']);
67932
+ ic.residues = Object.assign(ic.residues, ic.allData[name]['residues']);
67933
+ ic.chains = Object.assign(ic.chains, ic.allData[name]['chains']);
67934
+ ic.chainsSeq = Object.assign(ic.chainsSeq, ic.allData[name]['chainsSeq']);
67935
+ ic.defNames2Atoms = Object.assign(ic.defNames2Atoms, ic.allData[name]['defNames2Atoms']);
67936
+ ic.defNames2Residues = Object.assign(ic.defNames2Residues, ic.allData[name]['defNames2Residues']);
67937
+ ic.dAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
67938
+ ic.hAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
67939
+ }
67940
+
67941
+ ic.opts["color"] = "structure";
67942
+ ic.setStyleCls.setAtomStyleByOptions();
67943
+ ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
67792
67944
 
67793
67945
  ic.transformCls.zoominSelection();
67794
67946
  ic.definedSetsCls.showSets();
67795
67947
 
67796
- await ic.drawCls.draw();
67797
- ic.saveFileCls.showTitle();
67798
-
67799
67948
  ic.bResetAnno = true;
67800
67949
  if(ic.bAnnoShown) {
67801
- // show annotations just fo the displayed atoms
67802
- // await ic.showAnnoCls.showAnnotations(ic.dAtoms);
67803
67950
  await ic.showAnnoCls.showAnnotations();
67804
67951
 
67805
67952
  ic.hlUpdateCls.updateHlAll(nameArray);
67806
67953
  // show selected chains in annotation window
67807
67954
  ic.annotationCls.showAnnoSelectedChains();
67808
67955
  }
67809
-
67956
+
67957
+ await ic.drawCls.draw();
67958
+ ic.saveFileCls.showTitle();
67959
+
67810
67960
  me.htmlCls.clickMenuCls.setLogCmd(
67811
67961
  "select structure " + "[" + nameStructure + "]",
67812
67962
  true
67813
67963
  );
67814
- ic.bSelectResidue = false;
67815
-
67816
- ic.bShowHighlight = true; // reset
67817
67964
  }
67818
67965
  });
67819
67966
 
@@ -68368,7 +68515,10 @@ class LoadScript {
68368
68515
  let idArray = id.split(',');
68369
68516
  let idNew = '';
68370
68517
  for(let i = 0, il = idArray.length; i < il; ++i) {
68371
- if(!(ic.structures && ic.structures.hasOwnProperty(idArray[i]))) {
68518
+ if(!(ic.structures && (ic.structures.hasOwnProperty(idArray[i])
68519
+ || ic.structures.hasOwnProperty(idArray[i].toLowerCase())
68520
+ || ic.structures.hasOwnProperty(idArray[i].toUpperCase())
68521
+ ) )) {
68372
68522
  if(idNew) idNew += ',';
68373
68523
  idNew += idArray[i];
68374
68524
  }
@@ -72393,7 +72543,12 @@ class Dssp {
72393
72543
  }
72394
72544
 
72395
72545
  rmStrandFromRefnumlabel(refnumLabel) { let ic = this.icn3d; ic.icn3dui;
72396
- return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
72546
+ if(refnumLabel && isNaN(refnumLabel.substr(0,1))) {
72547
+ return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
72548
+ }
72549
+ else { // custom ref numbers
72550
+ return refnumLabel;
72551
+ }
72397
72552
  }
72398
72553
 
72399
72554
  exportRefnum(type, bNoArraySymbol) { let ic = this.icn3d, me = ic.icn3dui;
@@ -72441,25 +72596,15 @@ class Dssp {
72441
72596
  }
72442
72597
  }
72443
72598
 
72444
- // let bIgDomain = (ic.domainid2info && Object.keys(ic.domainid2info).length > 0) ? 1 : 0;
72445
- let stru2bIgDomain = {};
72446
- for(let domainid in ic.domainid2info) {
72447
- let stru = domainid.split('_')[0];
72448
- stru2bIgDomain[stru] = 1;
72449
- }
72450
-
72451
72599
  // if(bIgDomain) {
72452
72600
  for(let structure in ic.structures) {
72453
- let bIgDomain = stru2bIgDomain.hasOwnProperty(structure) ? 1 : 0;
72454
-
72455
- refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
72456
-
72601
+ let refDataTmp = '';
72457
72602
  for(let m = 0, ml = ic.structures[structure].length; ic.bShowRefnum && m < ml; ++m) {
72458
72603
  let chnid = ic.structures[structure][m];
72459
72604
  let igArray = ic.chain2igArray[chnid];
72460
72605
 
72461
72606
  if(igArray && igArray.length > 0) {
72462
- refData += '{"' + chnid + '": {\n';
72607
+ refDataTmp += '{"' + chnid + '": {\n';
72463
72608
 
72464
72609
  for(let i = 0, il = igArray.length; i < il; ++i) {
72465
72610
  let startPosArray = igArray[i].startPosArray;
@@ -72468,26 +72613,32 @@ class Dssp {
72468
72613
  let info = ic.domainid2info[domainid];
72469
72614
  if(!info) continue;
72470
72615
 
72471
- refData += '"' + domainid + '": {\n';
72616
+ refDataTmp += '"' + domainid + '": {\n';
72472
72617
 
72473
- refData += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
72618
+ refDataTmp += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
72474
72619
  for(let j = 0, jl = startPosArray.length; j < jl; ++j) {
72475
72620
  let startPos = startPosArray[j];
72476
72621
  let endPos = endPosArray[j];
72477
72622
  for(let k = startPos; k <= endPos; ++k) {
72478
72623
  const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi + '_' + ic.chainsSeq[chnid][k].name;
72479
- refData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
72624
+ refDataTmp += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
72480
72625
  }
72481
72626
  }
72482
- refData += '],\n';
72627
+ refDataTmp += '],\n';
72483
72628
 
72484
- refData += '},\n';
72629
+ refDataTmp += '},\n';
72485
72630
  }
72486
72631
 
72487
- refData += '}},\n';
72632
+ refDataTmp += '}},\n';
72488
72633
  }
72489
72634
  }
72490
72635
 
72636
+ let bIgDomain = (refDataTmp) ? 1 : 0;
72637
+
72638
+ refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
72639
+
72640
+ refData += refDataTmp;
72641
+
72491
72642
  refData += ']}},\n';
72492
72643
  }
72493
72644
  // }
@@ -72852,7 +73003,7 @@ class Dssp {
72852
73003
  let strandTmp = strandArray[i].strand;
72853
73004
 
72854
73005
  if(strandTmp != 'G' && strandArray[i].endRefnum - strandArray[i].startRefnum + 1 < 3) { // remove the strand
72855
- if(i != il - 1) { // modify
73006
+ if(strandArray[i + 1]) { // modify
72856
73007
  strandArray[i + 1].loopResCnt += strandArray[i].loopResCnt + parseInt(strandArray[i].endResi) - parseInt(strandArray[i].startResi) + 1;
72857
73008
  }
72858
73009
 
@@ -81238,7 +81389,7 @@ class iCn3DUI {
81238
81389
  //even when multiple iCn3D viewers are shown together.
81239
81390
  this.pre = this.cfg.divid + "_";
81240
81391
 
81241
- this.REVISION = '3.31.2';
81392
+ this.REVISION = '3.31.3';
81242
81393
 
81243
81394
  // In nodejs, iCn3D defines "window = {navigator: {}}"
81244
81395
  this.bNode = (Object.keys(window).length < 2) ? true : false;