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.js CHANGED
@@ -9062,9 +9062,9 @@ class ClickMenu {
9062
9062
  });
9063
9063
 
9064
9064
  me.myEventCls.onIds("#" + me.pre + "mn1_collection", "click", function (e) { me.icn3d; //e.preventDefault();
9065
- me.htmlCls.dialogCls.openDlg('dl_collection', 'Please input the collection file');
9066
- });
9067
-
9065
+ me.htmlCls.dialogCls.openDlg("dl_selectCollections", "Select Collections");
9066
+ });
9067
+
9068
9068
  me.myEventCls.onIds("#" + me.pre + "mn1_dsn6", "click", function(e) { me.icn3d; //e.preventDefault();
9069
9069
  me.htmlCls.dialogCls.openDlg('dl_dsn6', 'Please input the map file to display electron density map');
9070
9070
  });
@@ -14131,18 +14131,18 @@ class SetDialog {
14131
14131
  html += me.htmlCls.buttonStr + "reload_selectionfile' style='margin-top: 6px;'>Load</button>";
14132
14132
  html += "</div>";
14133
14133
 
14134
- html += me.htmlCls.divStr + "dl_collection' class='" + dialogClass + "'>";
14135
- html += this.addNotebookTitle('dl_collection', 'Please input the collection file');
14134
+ html += me.htmlCls.divStr + "dl_selectCollections' class='" + dialogClass + "'>";
14135
+ html += me.htmlCls.divStr + "dl_collectionsMenu'>";
14136
+ 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>';
14137
+ html += me.htmlCls.divStr + "dl_collection_file' style=''>";
14136
14138
  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>";
14137
14139
  html += "Collection file: " + me.htmlCls.inputFileStr + "id='" + me.pre + "collectionfile'><br/>";
14138
14140
  html += me.htmlCls.buttonStr + "reload_collectionfile' style='margin-top: 6px;'>Load</button>";
14139
14141
  html += "</div>";
14140
-
14141
- html += me.htmlCls.divStr + "dl_selectCollections' class='" + dialogClass + "'>";
14142
- html += me.htmlCls.divStr + "dl_collectionsMenu'>";
14143
- html += "<b>Structures:</b> <br/>";
14144
- html += "<select id='" + me.pre + "collections_menu' multiple size='6' style='min-width:130px;'>";
14145
- html += "</select>";
14142
+ html += "</div>";
14143
+ 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>';
14144
+ html += me.htmlCls.divStr + "dl_collection_structures' style='display: none'>";
14145
+ html += "<select id='" + me.pre + "collections_menu'multiple size='6' style='min-width:300px;'></select>";
14146
14146
  html += "</div>";
14147
14147
  html += "</div>";
14148
14148
 
@@ -16505,17 +16505,13 @@ class Events {
16505
16505
  ic.resizeCanvasCls.closeDialogs();
16506
16506
  }
16507
16507
  me.htmlCls.setHtmlCls.fileSupport();
16508
- let reader = new FileReader();
16509
- reader.onload = async function (e) {
16508
+ let reader = new FileReader();
16509
+
16510
+ reader.onload = async function (e) {
16510
16511
  let dataStr = JSON.parse(e.target.result);
16511
16512
  let collection = [dataStr["structures"].map(({ id }) => id), dataStr["structures"].map(({ title }) => title)];
16512
16513
  let collectionHtml = ic.selectCollectionsCls.setAtomMenu(collection[0], collection[1]);
16513
- let bNoDuplicate = true;
16514
- await ic.chainalignParserCls.downloadMmdbAf(collection[0][0], undefined, undefined, bNoDuplicate);
16515
-
16516
- ic.opts["color"] = "structure";
16517
- ic.setColorCls.setColorByOptions(ic.opts, ic.dAtoms);
16518
-
16514
+
16519
16515
  $("#" + ic.pre + "collections_menu").html(collectionHtml);
16520
16516
  ic.selectCollectionsCls.clickStructure();
16521
16517
 
@@ -16526,8 +16522,27 @@ class Events {
16526
16522
  $("#" + me.pre + "collectionfile").val(),
16527
16523
  false
16528
16524
  );
16525
+
16529
16526
  };
16530
16527
  reader.readAsText(file);
16528
+
16529
+ if (Object.keys(me.utilsCls.getStructures(ic.dAtoms))){
16530
+ $("#" + me.pre + "dl_collection_file").hide();
16531
+ $("#" + me.pre + "dl_collection_structures").show();
16532
+ $("#" + me.pre + "dl_collection_file_expand").show();
16533
+ $("#" + me.pre + "dl_collection_file_shrink").hide();
16534
+ $("#" + me.pre + "dl_collection_structures_expand").hide();
16535
+ $("#" + me.pre + "dl_collection_structures_shrink").show();
16536
+
16537
+ } else {
16538
+ $("#" + me.pre + "dl_collection_file").show();
16539
+ $("#" + me.pre + "dl_collection_structures").hide();
16540
+ $("#" + me.pre + "dl_collection_file_expand").hide();
16541
+ $("#" + me.pre + "dl_collection_file_shrink").hide();
16542
+ $("#" + me.pre + "dl_collection_structures_expand").show();
16543
+ $("#" + me.pre + "dl_collection_structures_shrink").hide();
16544
+ }
16545
+
16531
16546
  me.htmlCls.dialogCls.openDlg("dl_selectCollections", "Select Collections");
16532
16547
  }
16533
16548
  });
@@ -40865,8 +40880,10 @@ class AnnoIg {
40865
40880
  }
40866
40881
 
40867
40882
  showRefNum(giSeq, chnid, kabat_or_imgt, bCustom) { let ic = this.icn3d; ic.icn3dui;
40868
- let bResult = ic.chainid2igtrack[chnid];
40869
- if(!bResult) return {html: '', html2: '', html3: ''};
40883
+ if(ic.chainid2igtrack) {
40884
+ let bResult = ic.chainid2igtrack[chnid];
40885
+ if(!bResult) return {html: '', html2: '', html3: ''};
40886
+ }
40870
40887
 
40871
40888
  let html = this.getIgAnnoHtml(chnid, giSeq, bCustom, kabat_or_imgt);
40872
40889
 
@@ -40933,12 +40950,13 @@ class AnnoIg {
40933
40950
  ic.chain2igArray[chnid] = [];
40934
40951
  this.setChain2igArray(chnid, giSeq, bCustom);
40935
40952
 
40936
-
40937
40953
  // remove Igs without BCEF strands one more time
40938
40954
  let igArray = ic.chain2igArray[chnid];
40939
40955
 
40940
40956
  for(let i = 0, il = igArray.length; i < il; ++i) {
40941
40957
  let domainid = igArray[i].domainid;
40958
+
40959
+ if(!ic.domainid2info) continue;
40942
40960
  let info = ic.domainid2info[domainid];
40943
40961
  if(!info) continue;
40944
40962
 
@@ -41006,7 +41024,6 @@ class AnnoIg {
41006
41024
  }
41007
41025
  }
41008
41026
 
41009
-
41010
41027
  // reset ic.chain2igArray
41011
41028
  ic.chain2igArray[chnid] = [];
41012
41029
  this.setChain2igArray(chnid, giSeq, bCustom);
@@ -41025,7 +41042,7 @@ class AnnoIg {
41025
41042
  // htmlIg += '<span></span>';
41026
41043
  //}
41027
41044
  //else {
41028
- refnumLabel = ic.resid2refnum[residueid];
41045
+ refnumLabel = (bCustom) ? ic.chainsMapping[chnid][residueid] : ic.resid2refnum[residueid];
41029
41046
  let bHidelabel = false;
41030
41047
 
41031
41048
  if(refnumLabel) {
@@ -41150,9 +41167,14 @@ class AnnoIg {
41150
41167
  html3 += htmlTmp + '<br>';
41151
41168
  html += htmlTmp + '<span class="icn3d-seqLine">';
41152
41169
 
41170
+ if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqStartLen[chnid], '-');
41171
+
41153
41172
  html += htmlIg;
41154
41173
 
41155
- html += htmlCnt;
41174
+ if(ic.seqStartLen && ic.seqStartLen[chnid]) html += ic.showSeqCls.insertMulGap(ic.seqEndLen[chnid], '-');
41175
+
41176
+ if(!bCustom) html += htmlCnt;
41177
+
41156
41178
  html += '</span>';
41157
41179
  html += '<br>';
41158
41180
  html += '</div>';
@@ -41166,6 +41188,8 @@ class AnnoIg {
41166
41188
 
41167
41189
  for(let i = 0, il = igArray.length; i < il; ++i) {
41168
41190
  let domainid = igArray[i].domainid;
41191
+ if(!ic.domainid2info) continue;
41192
+
41169
41193
  let info = ic.domainid2info[domainid];
41170
41194
  if(!info) continue;
41171
41195
 
@@ -41194,6 +41218,8 @@ class AnnoIg {
41194
41218
  html2 += htmlTitle;
41195
41219
  html2 += htmlCnt + '<span class="icn3d-seqLine">';
41196
41220
 
41221
+ if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
41222
+
41197
41223
  let prevDomainindex, color;
41198
41224
  for(let i = 0, il = fromArray.length; i < il; ++i) {
41199
41225
  let resi = ic.ParserUtilsCls.getResi(chnid, fromArray[i]);
@@ -41625,7 +41651,7 @@ class AnnoDomain {
41625
41651
 
41626
41652
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
41627
41653
 
41628
- if(me.cfg.blast_rep_id != chnid) { // regular
41654
+ if(me.cfg.blast_rep_id != chnid) { // regular
41629
41655
  for(let i = 0, il = posFromArray.length; i < il; ++i) {
41630
41656
  // 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);
41631
41657
  let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(posFromArray[i]) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(posFromArray[i] - posToArray[i-1] - 1) / ic.maxAnnoLength);
@@ -41634,7 +41660,7 @@ class AnnoDomain {
41634
41660
  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>';
41635
41661
  }
41636
41662
  }
41637
- else { // with potential gaps
41663
+ else { // with potential gaps
41638
41664
  let fromArray2 = [], toArray2 = [];
41639
41665
  for(let i = 0, il = fromArray.length; i < il; ++i) {
41640
41666
  fromArray2.push(fromArray[i]);
@@ -46938,6 +46964,7 @@ class ShowAnno {
46938
46964
  // the missing residues at the end of the seq will be filled up in the API showNewTrack()
46939
46965
  let nGap = 0;
46940
46966
  ic.alnChainsSeq[chnid] = [];
46967
+
46941
46968
  //let offset =(ic.chainid2offset[chnid]) ? ic.chainid2offset[chnid] : 0;
46942
46969
  for(let i = 0, il = targetSeq.length; i < il; ++i) {
46943
46970
  //text += ic.showSeqCls.insertGap(chnid, i, '-', true);
@@ -47557,6 +47584,7 @@ class ShowSeq {
47557
47584
  let bCustom = true;
47558
47585
  let result = ic.annoIgCls.showRefNum(giSeq, chnid, undefined, bCustom);
47559
47586
  html += result.html;
47587
+ // html2 += result.html2;
47560
47588
  html3 += result.html3;
47561
47589
  }
47562
47590
  }
@@ -57030,8 +57058,9 @@ class RealignParser {
57030
57058
  }
57031
57059
 
57032
57060
  // If rmsd from vastsrv is too large, realign the chains
57033
- //if(me.cfg.chainalign && !me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57034
- if(!me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57061
+ //if(me.cfg.chainalign && !me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57062
+ // redo algnment only for VAST serv page
57063
+ if(!me.cfg.usepdbnum && me.cfg.resdef && rmsd > 5) {
57035
57064
  console.log("RMSD from VAST is larger than 5. Realign the chains with TM-align.");
57036
57065
  //let nameArray = me.cfg.chainalign.split(',');
57037
57066
  let nameArray = Object.keys(chainidHash);
@@ -60993,13 +61022,15 @@ class SetSeqAlign {
60993
61022
  ic.alnChains = {};
60994
61023
  ic.alnChains[chainid1] = {};
60995
61024
 
60996
- let resi2range_t = {}; // accumulative aligned residues in the template chain
61025
+ let resid2range_t = {}; // accumulative aligned residues in the template chain
60997
61026
  // start and end of MSA
60998
61027
  let start_t = 9999, end_t = -1;
60999
61028
 
61000
61029
  let baseResi = ic.chainsSeq[chainid1][0].resi - 1;
61030
+
61001
61031
  for(let index = 1, indexl = chainidArray.length; index < indexl; ++index) {
61002
61032
  let chainIndex = index - 1;
61033
+ chainidArray[index];
61003
61034
  if(!ic.qt_start_end[chainIndex]) continue;
61004
61035
 
61005
61036
  for(let i = 0, il = ic.qt_start_end[chainIndex].length; i < il; ++i) {
@@ -61010,11 +61041,12 @@ class SetSeqAlign {
61010
61041
  // end1 = ic.qt_start_end[chainIndex][i].t_end;
61011
61042
  // }
61012
61043
  // else {
61044
+ //ic.qt_start_end is zero-based
61013
61045
  start1 = parseInt(ic.qt_start_end[chainIndex][i].t_start) - 1;
61014
61046
  end1 = parseInt(ic.qt_start_end[chainIndex][i].t_end) - 1;
61015
61047
  // }
61016
61048
  for(let j = start1; j <= end1; ++j) {
61017
- let resi;
61049
+ let resi, resid;
61018
61050
 
61019
61051
  // if(me.cfg.aligntool == 'tmalign') { // tmalign: just one residue in this for loop
61020
61052
  // resi = ic.qt_start_end[chainIndex][i].t_start;
@@ -61026,53 +61058,56 @@ class SetSeqAlign {
61026
61058
  resiPos = j - baseResi;
61027
61059
  }
61028
61060
  else {
61029
- resiPos = (bRealign) ? j : j - baseResi;
61061
+ // resiPos = (bRealign) ? j : j - baseResi;
61062
+ resiPos = j;
61030
61063
  }
61031
61064
  resi = ic.ParserUtilsCls.getResi(chainidArray[0], resiPos);
61065
+ resid = chainidArray[0] + '_' + resi;
61032
61066
  // }
61033
61067
 
61034
- resi2range_t[resi] = 1;
61068
+ resid2range_t[resid] = 1;
61035
61069
  if(j < start_t) start_t = j;
61036
61070
  if(j > end_t) end_t = j;
61037
61071
  }
61038
61072
  }
61039
61073
  }
61040
-
61074
+
61041
61075
  // TM-align should use "start1 = ic.qt_start_end[chainIndex][i].t_start - 1", but the rest are the same as ""bRealign"
61042
61076
  if(me.cfg.aligntool == 'tmalign') bRealign = true; // real residue numbers are stored
61043
61077
 
61044
- let resi2rangeArray = Object.keys(resi2range_t);
61045
- resi2rangeArray.sort(function(a, b) {
61046
- return parseInt(a) - parseInt(b);
61078
+ let resid2rangeArray = Object.keys(resid2range_t);
61079
+ resid2rangeArray.sort(function(a, b) {
61080
+ return parseInt(a.split('_')[2]) - parseInt(b.split('_')[2]);
61047
61081
  });
61048
61082
 
61049
61083
  // assign range to each resi
61050
- let prevResi = -999, start = 0, end = 0, resiArray = [], prevEnd = 0;
61051
- for(let i = 0, il = resi2rangeArray.length; i < il; ++i) {
61052
- let resi = resi2rangeArray[i];
61084
+ let prevResi = -999, start = 0, end = 0, residArray = [], prevEnd = 0;
61085
+ for(let i = 0, il = resid2rangeArray.length; i < il; ++i) {
61086
+ let resid = resid2rangeArray[i];
61087
+ let resi = resid.split('_')[2];
61053
61088
 
61054
61089
  if(i == 0) {
61055
61090
  start = resi;
61056
61091
  }
61057
61092
  else if(i > 0 && ic.resid2ncbi[resi] != ic.resid2ncbi[prevResi] + 1 && ic.resid2ncbi[resi] != ic.resid2ncbi[prevResi]) { // new start
61058
61093
  end = prevResi;
61059
- for(let j = 0, jl = resiArray.length; j < jl; ++j) {
61060
- resi2range_t[resiArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61094
+ for(let j = 0, jl = residArray.length; j < jl; ++j) {
61095
+ resid2range_t[residArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61061
61096
  }
61062
61097
 
61063
- resiArray = [];
61098
+ residArray = [];
61064
61099
  start = resi;
61065
61100
  prevEnd = end;
61066
61101
  }
61067
61102
 
61068
- resiArray.push(resi);
61103
+ residArray.push(resid);
61069
61104
 
61070
61105
  prevResi = resi;
61071
61106
  }
61072
61107
 
61073
61108
  end = prevResi;
61074
- for(let j = 0, jl = resiArray.length; j < jl; ++j) {
61075
- resi2range_t[resiArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61109
+ for(let j = 0, jl = residArray.length; j < jl; ++j) {
61110
+ resid2range_t[residArray[j]] = {resiStart: start, resiEnd: end, prevResiEnd: prevEnd};
61076
61111
  }
61077
61112
 
61078
61113
  for(let i = 0, il = chainidArray.length; i < il; ++i) {
@@ -61086,6 +61121,7 @@ class SetSeqAlign {
61086
61121
  // fill the template ic.alnChainsSeq[chainid1]
61087
61122
  for(let j = 0, jl = ic.chainsSeq[chainid1].length; j < jl; ++j) {
61088
61123
  let resi = ic.chainsSeq[chainid1][j].resi;
61124
+ let resid = chainid1 + '_' + resi;
61089
61125
 
61090
61126
  let jAdjusted = (me.cfg.aligntool != 'tmalign') ? j : j + baseResi;
61091
61127
 
@@ -61099,15 +61135,15 @@ class SetSeqAlign {
61099
61135
  resObject.mmdbid = chainid1.substr(0, pos);
61100
61136
  resObject.chain = chainid1.substr(pos+1);
61101
61137
  resObject.resi = resi;
61102
- resObject.resn = (resi2range_t[resi]) ? ic.chainsSeq[chainid1][j].name.toUpperCase() : ic.chainsSeq[chainid1][j].name.toLowerCase();
61103
- resObject.aligned = (resi2range_t[resi]) ? true : false;
61104
- resObject.color = (resi2range_t[resi]) ? '#FF0000' : me.htmlCls.GREYC; // color by identity
61105
- resObject.color2 = (resi2range_t[resi]) ? '#FF0000' : me.htmlCls.GREYC; // color by conservation
61106
- resObject.class = (resi2range_t[resi]) ? 'icn3d-align' : 'icn3d-nalign';
61138
+ resObject.resn = (resid2range_t[resid]) ? ic.chainsSeq[chainid1][j].name.toUpperCase() : ic.chainsSeq[chainid1][j].name.toLowerCase();
61139
+ resObject.aligned = (resid2range_t[resid]) ? true : false;
61140
+ resObject.color = (resid2range_t[resid]) ? '#FF0000' : me.htmlCls.GREYC; // color by identity
61141
+ resObject.color2 = (resid2range_t[resid]) ? '#FF0000' : me.htmlCls.GREYC; // color by conservation
61142
+ resObject.class = (resid2range_t[resid]) ? 'icn3d-align' : 'icn3d-nalign';
61107
61143
 
61108
61144
  ic.alnChainsSeq[chainid1].push(resObject);
61109
61145
 
61110
- if(resi2range_t[resi]) {
61146
+ if(resid2range_t[resid]) {
61111
61147
  $.extend(ic.alnChains[chainid1], ic.residues[chainid1 + '_' + resObject.resi] );
61112
61148
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, ic.residues[chainid1 + '_' + resObject.resi]);
61113
61149
  }
@@ -61119,7 +61155,7 @@ class SetSeqAlign {
61119
61155
  for(let arrayIndex = 0, arrayIndexl = index_alignLen.length; arrayIndex < arrayIndexl; ++arrayIndex) {
61120
61156
  let index = index_alignLen[arrayIndex].index;
61121
61157
  alignedChainIndice.push(index);
61122
- let hAtomsTmp = this.mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resi2range_t, start_t, end_t, bRealign);
61158
+ let hAtomsTmp = this.mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resid2range_t, start_t, end_t, bRealign);
61123
61159
 
61124
61160
  hAtoms = me.hashUtilsCls.unionHash(hAtoms, hAtomsTmp);
61125
61161
  }
@@ -61292,7 +61328,7 @@ class SetSeqAlign {
61292
61328
  return {"pos1": result1.pos, "pos2": result2.pos};
61293
61329
  }
61294
61330
 
61295
- mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resi2range_t, start_t, end_t, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
61331
+ mergeTwoSeqForAll(chainidArray, index, alignedChainIndice, resid2range_t, start_t, end_t, bRealign) { let ic = this.icn3d, me = ic.icn3dui;
61296
61332
  let hAtoms = {};
61297
61333
 
61298
61334
  let chainid = chainidArray[index];
@@ -61381,7 +61417,7 @@ class SetSeqAlign {
61381
61417
  start1Pos = start1;
61382
61418
  end1Pos = end1;
61383
61419
  }
61384
- //let range = resi2range_t[resiStart1];
61420
+ //let range = resid2range_t[chainid1 + '_' + resiStart1];
61385
61421
 
61386
61422
  // if the mapping does not start from start_t, add gaps to the query seq
61387
61423
  if(i == 0) {
@@ -66849,70 +66885,181 @@ class SelectCollections {
66849
66885
  return html;
66850
66886
  }
66851
66887
 
66888
+ reset() {
66889
+ let ic = this.icn3d;
66890
+
66891
+ ic.atoms = {};
66892
+
66893
+ ic.proteins = {};
66894
+ ic.nucleotides = {};
66895
+ ic.chemicals = {};
66896
+ ic.ions = {};
66897
+ ic.water = {};
66898
+
66899
+ ic.structures = {};
66900
+ ic.chains = {};
66901
+ ic.chainsSeq = {};
66902
+ ic.residues = {};
66903
+
66904
+ ic.defNames2Atoms = {};
66905
+ ic.defNames2Residues = {};
66906
+
66907
+ ic.ssbondpnts = {};
66908
+
66909
+ ic.bShowHighlight = false;
66910
+ ic.bResetSets = true;
66911
+ }
66912
+
66913
+ dictionaryDifference(dict1, dict2) {
66914
+ const difference = {};
66915
+
66916
+ for (let key in dict2) {
66917
+ if (!(key in dict1)) {
66918
+ difference[key] = dict2[key];
66919
+ }
66920
+ }
66921
+
66922
+ return difference;
66923
+ }
66924
+
66852
66925
  clickStructure() {
66853
66926
  let ic = this.icn3d,
66854
66927
  me = ic.icn3dui;
66855
66928
  let thisClass = this;
66856
66929
 
66930
+ if (ic.allData == undefined) {
66931
+ ic.allData = {};
66932
+ ic.allData['all'] = {
66933
+ 'atoms': {},
66934
+ 'proteins': {},
66935
+ 'nucleotides': {},
66936
+ 'chemicals': {},
66937
+ 'ions': {},
66938
+ 'water': {},
66939
+ 'structures': {}, // getSSExpandedAtoms
66940
+ 'ssbondpnts': {},
66941
+ 'residues': {}, // getSSExpandedAtoms
66942
+ 'chains': {},
66943
+ 'chainsSeq': {}, //Sequences and Annotation
66944
+ 'defNames2Atoms': {},
66945
+ 'defNames2Residues': {}
66946
+ };
66947
+ ic.allData['prev'] = {};
66948
+ }
66949
+
66857
66950
  //me.myEventCls.onIds("#" + ic.pre + "atomsCustom", "change", function(e) { let ic = thisClass.icn3d;
66858
66951
  $("#" + ic.pre + "collections_menu").change(async function (e) {
66859
66952
  let ic = thisClass.icn3d;
66860
- // ic.init()
66953
+
66861
66954
  let nameArray = $(this).val();
66862
66955
  let nameStructure = $(this).find("option:selected").text();
66863
66956
 
66864
66957
  ic.nameArray = nameArray;
66865
66958
  if (nameArray !== null) {
66866
- ic.bShowHighlight = false;
66959
+ // let chainIdHash = {};
66960
+
66867
66961
  let bNoDuplicate = true;
66868
- await ic.chainalignParserCls.downloadMmdbAf(nameArray.toString(), undefined, undefined, bNoDuplicate);
66962
+ thisClass.reset();
66963
+ for (const name of nameArray) {
66964
+ if (!(name in ic.allData)) {
66965
+ ic.allData['prev'] = JSON.parse(JSON.stringify(ic.allData['all']));//me.hashUtilsCls.cloneHash(ic.allData['all']);
66869
66966
 
66870
- ic.dAtoms = {};
66871
- ic.hAtoms = {};
66872
- // ic.ssbondpnts = {};
66873
- let chainIdHash = {};
66874
-
66875
- for (const name in nameArray) {
66876
- for (const key in ic.chains) {
66877
- if (key.includes(nameArray[name])) {
66878
- chainIdHash[key] = 1;
66879
- if (ic.chains.hasOwnProperty(key)) {
66880
- const innerDict = ic.chains[key];
66881
- for (const innerKey in innerDict) {
66882
- if (innerDict.hasOwnProperty(innerKey)) {
66883
- ic.dAtoms[innerKey] = innerDict[innerKey];
66884
- ic.hAtoms[innerKey] = innerDict[innerKey];
66885
- }
66886
- }
66887
- }
66888
- }
66967
+ ic.atoms = ic.allData['all']['atoms'];
66968
+
66969
+ ic.proteins = ic.allData['all']['proteins'];
66970
+ ic.nucleotides = ic.allData['all']['nucleotides'];
66971
+ ic.chemicals = ic.allData['all']['chemicals'];
66972
+ ic.ions = ic.allData['all']['ions'];
66973
+ ic.water = ic.allData['all']['water'];
66974
+
66975
+ ic.structures = ic.allData['all']['structures'];
66976
+ ic.ssbondpnts = ic.allData['all']['ssbondpnts'];
66977
+ ic.residues = ic.allData['all']['residues'];
66978
+ ic.chains = ic.allData['all']['chains'];
66979
+ ic.chainsSeq = ic.allData['all']['chainsSeq'];
66980
+ ic.defalls2Atoms = ic.allData['all']['defalls2Atoms'];
66981
+ ic.defalls2Residues = ic.allData['all']['defalls2Residues'];
66982
+ await ic.chainalignParserCls.downloadMmdbAf(name, undefined, undefined, bNoDuplicate).then(() => {
66983
+ ic.allData['all'] = {
66984
+ 'atoms': ic.atoms,
66985
+ 'proteins': ic.proteins,
66986
+ 'nucleotides': ic.nucleotides,
66987
+ 'chemicals': ic.chemicals,
66988
+ 'ions': ic.ions,
66989
+ 'water': ic.water,
66990
+ 'structures': ic.structures, // getSSExpandedAtoms
66991
+ 'ssbondpnts': ic.ssbondpnts,
66992
+ 'residues': ic.residues, // getSSExpandedAtoms
66993
+ 'chains': ic.chains,
66994
+ 'chainsSeq': ic.chainsSeq, //Sequences and Annotation
66995
+ 'defNames2Atoms': ic.defNames2Atoms,
66996
+ 'defNames2Residues': ic.defNames2Residues
66997
+ };
66998
+
66999
+ ic.allData[name] = {
67000
+ 'atoms': thisClass.dictionaryDifference(ic.allData['prev']['atoms'], ic.atoms),
67001
+ 'proteins': thisClass.dictionaryDifference(ic.allData['prev']['proteins'], ic.proteins),
67002
+ 'nucleotides': thisClass.dictionaryDifference(ic.allData['prev']['nucleotides'], ic.nucleotides),
67003
+ 'chemicals': thisClass.dictionaryDifference(ic.allData['prev']['chemicals'], ic.chemicals),
67004
+ 'ions': thisClass.dictionaryDifference(ic.allData['prev']['ions'], ic.ions),
67005
+ 'water': thisClass.dictionaryDifference(ic.allData['prev']['water'], ic.water),
67006
+ 'structures': thisClass.dictionaryDifference(ic.allData['prev']['structures'], ic.structures), // getSSExpandedAtoms
67007
+ 'ssbondpnts': thisClass.dictionaryDifference(ic.allData['prev']['ssbondpnts'], ic.ssbondpnts),
67008
+ 'residues': thisClass.dictionaryDifference(ic.allData['prev']['residues'], ic.residues), // getSSExpandedAtoms
67009
+ 'chains': thisClass.dictionaryDifference(ic.allData['prev']['chains'], ic.chains),
67010
+ 'chainsSeq': thisClass.dictionaryDifference(ic.allData['prev']['chainsSeq'], ic.chainsSeq), //Sequences and Annotation
67011
+ 'defNames2Atoms': thisClass.dictionaryDifference(ic.allData['prev']['defNames2Atoms'], ic.defNames2Atoms),
67012
+ 'defNames2Residues': thisClass.dictionaryDifference(ic.allData['prev']['defNames2Residues'], ic.defNames2Residues)
67013
+ };
67014
+
67015
+ // ic.atoms = Object.assign(ic.atoms, ic.atomsTemp);
67016
+ thisClass.reset();
67017
+ });
66889
67018
  }
66890
67019
  }
67020
+ for (const name of nameArray) {
67021
+ ic.atoms = Object.assign(ic.atoms, ic.allData[name]['atoms']);
67022
+
67023
+ ic.proteins = Object.assign(ic.proteins, ic.allData[name]['proteins']);
67024
+ ic.nucleotides = Object.assign(ic.nucleotides, ic.allData[name]['nucleotides']);
67025
+ ic.chemicals = Object.assign(ic.chemicals, ic.allData[name]['chemicals']);
67026
+ ic.ions = Object.assign(ic.ions, ic.allData[name]['ions']);
67027
+ ic.water = Object.assign(ic.water, ic.allData[name]['water']);
67028
+
67029
+ ic.structures = Object.assign(ic.structures, ic.allData[name]['structures']);
67030
+ ic.ssbondpnts = Object.assign(ic.ssbondpnts, ic.allData[name]['ssbondpnts']);
67031
+ ic.residues = Object.assign(ic.residues, ic.allData[name]['residues']);
67032
+ ic.chains = Object.assign(ic.chains, ic.allData[name]['chains']);
67033
+ ic.chainsSeq = Object.assign(ic.chainsSeq, ic.allData[name]['chainsSeq']);
67034
+ ic.defNames2Atoms = Object.assign(ic.defNames2Atoms, ic.allData[name]['defNames2Atoms']);
67035
+ ic.defNames2Residues = Object.assign(ic.defNames2Residues, ic.allData[name]['defNames2Residues']);
67036
+ ic.dAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
67037
+ ic.hAtoms = me.hashUtilsCls.cloneHash(ic.atoms);
67038
+ }
67039
+
67040
+ ic.opts["color"] = "structure";
67041
+ ic.setStyleCls.setAtomStyleByOptions();
67042
+ ic.setColorCls.setColorByOptions(ic.opts, ic.atoms);
66891
67043
 
66892
67044
  ic.transformCls.zoominSelection();
66893
67045
  ic.definedSetsCls.showSets();
66894
67046
 
66895
- await ic.drawCls.draw();
66896
- ic.saveFileCls.showTitle();
66897
-
66898
67047
  ic.bResetAnno = true;
66899
67048
  if(ic.bAnnoShown) {
66900
- // show annotations just fo the displayed atoms
66901
- // await ic.showAnnoCls.showAnnotations(ic.dAtoms);
66902
67049
  await ic.showAnnoCls.showAnnotations();
66903
67050
 
66904
67051
  ic.hlUpdateCls.updateHlAll(nameArray);
66905
67052
  // show selected chains in annotation window
66906
67053
  ic.annotationCls.showAnnoSelectedChains();
66907
67054
  }
66908
-
67055
+
67056
+ await ic.drawCls.draw();
67057
+ ic.saveFileCls.showTitle();
67058
+
66909
67059
  me.htmlCls.clickMenuCls.setLogCmd(
66910
67060
  "select structure " + "[" + nameStructure + "]",
66911
67061
  true
66912
67062
  );
66913
- ic.bSelectResidue = false;
66914
-
66915
- ic.bShowHighlight = true; // reset
66916
67063
  }
66917
67064
  });
66918
67065
 
@@ -67467,7 +67614,10 @@ class LoadScript {
67467
67614
  let idArray = id.split(',');
67468
67615
  let idNew = '';
67469
67616
  for(let i = 0, il = idArray.length; i < il; ++i) {
67470
- if(!(ic.structures && ic.structures.hasOwnProperty(idArray[i]))) {
67617
+ if(!(ic.structures && (ic.structures.hasOwnProperty(idArray[i])
67618
+ || ic.structures.hasOwnProperty(idArray[i].toLowerCase())
67619
+ || ic.structures.hasOwnProperty(idArray[i].toUpperCase())
67620
+ ) )) {
67471
67621
  if(idNew) idNew += ',';
67472
67622
  idNew += idArray[i];
67473
67623
  }
@@ -71492,7 +71642,12 @@ class Dssp {
71492
71642
  }
71493
71643
 
71494
71644
  rmStrandFromRefnumlabel(refnumLabel) { let ic = this.icn3d; ic.icn3dui;
71495
- return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
71645
+ if(refnumLabel && isNaN(refnumLabel.substr(0,1))) {
71646
+ return (!refnumLabel) ? refnumLabel : refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').replace(/\+/g, '').replace(/\-/g, '').substr(1); // C', C''
71647
+ }
71648
+ else { // custom ref numbers
71649
+ return refnumLabel;
71650
+ }
71496
71651
  }
71497
71652
 
71498
71653
  exportRefnum(type, bNoArraySymbol) { let ic = this.icn3d, me = ic.icn3dui;
@@ -71540,25 +71695,15 @@ class Dssp {
71540
71695
  }
71541
71696
  }
71542
71697
 
71543
- // let bIgDomain = (ic.domainid2info && Object.keys(ic.domainid2info).length > 0) ? 1 : 0;
71544
- let stru2bIgDomain = {};
71545
- for(let domainid in ic.domainid2info) {
71546
- let stru = domainid.split('_')[0];
71547
- stru2bIgDomain[stru] = 1;
71548
- }
71549
-
71550
71698
  // if(bIgDomain) {
71551
71699
  for(let structure in ic.structures) {
71552
- let bIgDomain = stru2bIgDomain.hasOwnProperty(structure) ? 1 : 0;
71553
-
71554
- refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
71555
-
71700
+ let refDataTmp = '';
71556
71701
  for(let m = 0, ml = ic.structures[structure].length; ic.bShowRefnum && m < ml; ++m) {
71557
71702
  let chnid = ic.structures[structure][m];
71558
71703
  let igArray = ic.chain2igArray[chnid];
71559
71704
 
71560
71705
  if(igArray && igArray.length > 0) {
71561
- refData += '{"' + chnid + '": {\n';
71706
+ refDataTmp += '{"' + chnid + '": {\n';
71562
71707
 
71563
71708
  for(let i = 0, il = igArray.length; i < il; ++i) {
71564
71709
  let startPosArray = igArray[i].startPosArray;
@@ -71567,26 +71712,32 @@ class Dssp {
71567
71712
  let info = ic.domainid2info[domainid];
71568
71713
  if(!info) continue;
71569
71714
 
71570
- refData += '"' + domainid + '": {\n';
71715
+ refDataTmp += '"' + domainid + '": {\n';
71571
71716
 
71572
- refData += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
71717
+ refDataTmp += '"refpdbname":"' + info.refpdbname + '", "score":' + info.score + ', "seqid":' + info.seqid + ', "nresAlign":' + info.nresAlign + ', "data": [';
71573
71718
  for(let j = 0, jl = startPosArray.length; j < jl; ++j) {
71574
71719
  let startPos = startPosArray[j];
71575
71720
  let endPos = endPosArray[j];
71576
71721
  for(let k = startPos; k <= endPos; ++k) {
71577
71722
  const resid = chnid + '_' + ic.chainsSeq[chnid][k].resi + '_' + ic.chainsSeq[chnid][k].name;
71578
- refData += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
71723
+ refDataTmp += '{"' + resid + '": "' + resid2refnum[resid] + '"},\n';
71579
71724
  }
71580
71725
  }
71581
- refData += '],\n';
71726
+ refDataTmp += '],\n';
71582
71727
 
71583
- refData += '},\n';
71728
+ refDataTmp += '},\n';
71584
71729
  }
71585
71730
 
71586
- refData += '}},\n';
71731
+ refDataTmp += '}},\n';
71587
71732
  }
71588
71733
  }
71589
71734
 
71735
+ let bIgDomain = (refDataTmp) ? 1 : 0;
71736
+
71737
+ refData += '{"' + structure + '": {"Ig domain" : ' + bIgDomain + ', "igs": [\n';
71738
+
71739
+ refData += refDataTmp;
71740
+
71590
71741
  refData += ']}},\n';
71591
71742
  }
71592
71743
  // }
@@ -71951,7 +72102,7 @@ class Dssp {
71951
72102
  let strandTmp = strandArray[i].strand;
71952
72103
 
71953
72104
  if(strandTmp != 'G' && strandArray[i].endRefnum - strandArray[i].startRefnum + 1 < 3) { // remove the strand
71954
- if(i != il - 1) { // modify
72105
+ if(strandArray[i + 1]) { // modify
71955
72106
  strandArray[i + 1].loopResCnt += strandArray[i].loopResCnt + parseInt(strandArray[i].endResi) - parseInt(strandArray[i].startResi) + 1;
71956
72107
  }
71957
72108
 
@@ -80337,7 +80488,7 @@ class iCn3DUI {
80337
80488
  //even when multiple iCn3D viewers are shown together.
80338
80489
  this.pre = this.cfg.divid + "_";
80339
80490
 
80340
- this.REVISION = '3.31.2';
80491
+ this.REVISION = '3.31.3';
80341
80492
 
80342
80493
  // In nodejs, iCn3D defines "window = {navigator: {}}"
80343
80494
  this.bNode = (Object.keys(window).length < 2) ? true : false;