icn3d 3.29.15 → 3.29.17

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
@@ -36881,16 +36881,17 @@ class AnnoCddSite {
36881
36881
  if(ic.seqStartLen && ic.seqStartLen[chnid]) html2 += ic.showSeqCls.insertMulGapOverview(chnid, ic.seqStartLen[chnid]);
36882
36882
 
36883
36883
  if(me.cfg.blast_rep_id != chnid) { // regular
36884
+ let color;
36884
36885
  for(let i = 0, il = fromArray.length; i < il; ++i) {
36885
- let color = this.getColorFromPos(chnid, fromArray[i], titleArray);
36886
+ if(i == 0) color = this.getColorFromPos(chnid, fromArray[i], titleArray);
36886
36887
 
36887
36888
  let emptyWidth;
36888
- if(titleArray) {
36889
+ // if(titleArray) {
36889
36890
  emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i]) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
36890
- }
36891
- else {
36892
- 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);
36893
- }
36891
+ // }
36892
+ // else {
36893
+ // 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);
36894
+ // }
36894
36895
 
36895
36896
  html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
36896
36897
  html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(toArray[i] - fromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle ' + linkStr + '" ' + type + '="' +(index+1).toString() + '" from="' + fromArray + '" to="' + toArray + '" shorttitle="' + title + '" index="' + index + '" setname="' + setname + '" id="' + chnid + '_domain_' + index + '_' + r + '" anno="sequence" chain="' + chnid + '" title="' + fulltitle + '">' + domain + ' </div>';
@@ -37919,19 +37920,24 @@ class AnnoIg {
37919
37920
  html2 += htmlTitle;
37920
37921
  html2 += htmlCnt + '<span class="icn3d-seqLine">';
37921
37922
 
37923
+ let prevDomainindex, color;
37922
37924
  for(let i = 0, il = fromArray.length; i < il; ++i) {
37923
37925
  let resi = ic.ParserUtilsCls.getResi(chnid, fromArray[i]);
37924
37926
  let resid = chnid + "_" + resi;
37925
- let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
37926
- let colorStr =(!atom || atom.color === undefined || atom.color.getHexString() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
37927
- let color =(atom && atom.color !== undefined) ? colorStr : "CCCCCC";
37928
37927
 
37929
37928
  let domainindex = posindex2domainindex[fromArray[i]];
37929
+ if(domainindex != prevDomainindex) {
37930
+ let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[resid]);
37931
+ let colorStr =(!atom || atom.color === undefined || atom.color.getHexString() === 'FFFFFF') ? 'DDDDDD' : atom.color.getHexString();
37932
+ color =(atom && atom.color !== undefined) ? colorStr : "CCCCCC";
37933
+ }
37930
37934
 
37931
37935
  let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i]) / ic.maxAnnoLength) :
37932
37936
  Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
37933
37937
  html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
37934
37938
  html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(toArray[i] - fromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle ' + linkStr + '" ig="0" from="' + fromArray + '" to="' + toArray + '" shorttitle="' + domainArray[domainindex] + '" index="0" setname="' + chnid + '_igs" id="' + chnid + '_igs" anno="sequence" chain="' + chnid + '" title="' + domainArray[domainindex] + '">' + domainArray[domainindex] + ' </div>';
37939
+
37940
+ prevDomainindex = domainindex;
37935
37941
  }
37936
37942
 
37937
37943
  html2 += htmlCnt;
@@ -38331,7 +38337,9 @@ class AnnoDomain {
38331
38337
 
38332
38338
  if(me.cfg.blast_rep_id != chnid) { // regular
38333
38339
  for(let i = 0, il = fromArray.length; i < il; ++i) {
38334
- 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);
38340
+ // 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);
38341
+ let emptyWidth =(i == 0) ? Math.round(ic.seqAnnWidth *(fromArray[i]) / ic.maxAnnoLength) : Math.round(ic.seqAnnWidth *(fromArray[i] - toArray[i-1] - 1) / ic.maxAnnoLength);
38342
+
38335
38343
  html2 += '<div style="display:inline-block; width:' + emptyWidth + 'px;">&nbsp;</div>';
38336
38344
  html2 += '<div style="display:inline-block; color:white!important; font-weight:bold; background-color:#' + color + '; width:' + Math.round(ic.seqAnnWidth *(toArray[i] - fromArray[i] + 1) / ic.maxAnnoLength) + 'px;" class="icn3d-seqTitle icn3d-link icn3d-blue" 3ddomain="' +(index+1).toString() + '" from="' + fromArray + '" to="' + toArray + '" 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>';
38337
38345
  }
@@ -39940,7 +39948,7 @@ class Domain3d {
39940
39948
  // get a list of Calpha-Calpha contacts
39941
39949
  ///list< pair< pair< int, let >, let > >
39942
39950
  let cts = this.c2b_AlphaContacts(seqLen, x0, y0, z0, dcut, resiArray);
39943
-
39951
+
39944
39952
  //
39945
39953
  // Produce a "map" of the SSEs, i.e. vec_sse[i] = 0 means residue i + 1
39946
39954
  // is in a loop, and vec_sse[i] = k means residue i + 1 belongs to SSE
@@ -40001,7 +40009,7 @@ class Domain3d {
40001
40009
  vec_cts1.push(i + 1);
40002
40010
  vec_cts2.push(i + 1);
40003
40011
  }
40004
-
40012
+
40005
40013
  // create contact counts from the contacts/interactions
40006
40014
  //map< pair< int, let >, let > ctable = this.c2b_ContactTable(vec_cts1, vec_cts2);
40007
40015
  let ctable = this.c2b_ContactTable(vec_cts1, vec_cts2);
@@ -40025,7 +40033,7 @@ class Domain3d {
40025
40033
  sheetNeighbor[ss2][ss1] = 1;
40026
40034
  }
40027
40035
  }
40028
-
40036
+
40029
40037
  //https://www.geeksforgeeks.org/number-groups-formed-graph-friends/
40030
40038
  let existing_groups = 0;
40031
40039
  let sheet2sheetnum = {};
@@ -40153,7 +40161,7 @@ class Domain3d {
40153
40161
  this.parts[2*i] = this.parts[2*i + 1] = 0;
40154
40162
  ratios[i] = 0.0;
40155
40163
  }
40156
-
40164
+
40157
40165
  n_saved = this.new_split_chain(nsse, sratio, minSize, minSSE, maxCsz, avgCts, cDelta, ncFact, this.parts, n_saved, ratios);
40158
40166
 
40159
40167
  // save domain data
@@ -40201,6 +40209,36 @@ class Domain3d {
40201
40209
 
40202
40210
  list_parts = list_partsTmp;
40203
40211
 
40212
+ // if there is only one domain, add all
40213
+ if(list_parts.length == 0) {
40214
+ let groupnum2cnt = {}, groupnum2sseList = {}, chosenGroupnum = 0;
40215
+ for(let i = 0, il = this.group_num.length; i < il; ++i) {
40216
+ let groupnum = this.group_num[i];
40217
+ let sse = i + 1;
40218
+ if(groupnum && groupnum != i + 1) {
40219
+ if(!groupnum2sseList[groupnum]) groupnum2sseList[groupnum] = [];
40220
+ // collect all sse for this groupnum
40221
+ groupnum2sseList[groupnum].push(sse);
40222
+
40223
+ if(!groupnum2cnt[groupnum]) {
40224
+ groupnum2cnt[groupnum] = 1;
40225
+ }
40226
+ else {
40227
+ ++groupnum2cnt[groupnum];
40228
+ if(groupnum2cnt[groupnum] >= 3) { // minimum 3 sse
40229
+ chosenGroupnum = groupnum;
40230
+ }
40231
+ }
40232
+ }
40233
+ }
40234
+
40235
+ if(chosenGroupnum != 0) { // found a domain
40236
+ let sseArray = [chosenGroupnum].concat(groupnum2sseList[chosenGroupnum]);
40237
+
40238
+ list_parts.push(sseArray);
40239
+ }
40240
+ }
40241
+
40204
40242
  //for (lplet = list_parts.begin(); lplet != list_parts.end(); lpint++) {
40205
40243
  for (let index = 0, indexl = list_parts.length; index < indexl; ++index) {
40206
40244
  //vector<int> prts = *lpint;
@@ -40338,7 +40376,7 @@ class Domain3d {
40338
40376
  ic.tddomains[domainName][resid] = 1;
40339
40377
  }
40340
40378
  }
40341
- }
40379
+ }
40342
40380
 
40343
40381
  return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi };
40344
40382
  } // end c2b_NewSplitChain
@@ -65992,9 +66030,9 @@ class Dssp {
65992
66030
 
65993
66031
  if(bRerunDomain) {
65994
66032
  let atomsAssigned = {};
65995
- //ic.resid2refnum_ori should be used
65996
- for(let resid in ic.resid2refnum_ori) {
65997
- atomsAssigned = me.hashUtilsCls.unionHash(atomsAssigned, ic.residues[resid]);
66033
+ // for(let resid in ic.resid2refnum_ori) {
66034
+ for(let resid in ic.resid2domainid) {
66035
+ if(ic.resid2domainid[resid]) atomsAssigned = me.hashUtilsCls.unionHash(atomsAssigned, ic.residues[resid]);
65998
66036
  }
65999
66037
 
66000
66038
  currAtoms = me.hashUtilsCls.exclHash(currAtoms, atomsAssigned);
@@ -66015,7 +66053,7 @@ class Dssp {
66015
66053
  let result = ic.domain3dCls.c2b_NewSplitChain(currAtoms, undefined);
66016
66054
  let subdomains = result.subdomains;
66017
66055
  let pos2resi = result.pos2resi;
66018
-
66056
+ /*
66019
66057
  if(subdomains.length <= 1) {
66020
66058
  let residueArray = ic.resid2specCls.atoms2residues(Object.keys(currAtoms));
66021
66059
  if(residueArray.length < minResidues) return domainAtomsArray;
@@ -66032,25 +66070,27 @@ class Dssp {
66032
66070
 
66033
66071
  domainAtomsArray.push(currAtoms);
66034
66072
  }
66035
- else {
66073
+ else
66074
+ */
66075
+
66076
+ if(subdomains.length >= 1) {
66036
66077
  for(let k = 0, kl = subdomains.length; k < kl; ++k) {
66037
66078
  let domainAtoms = {};
66038
66079
  let segArray = subdomains[k];
66039
66080
 
66040
66081
  let resCnt = 0;
66041
66082
  for(let m = 0, ml = segArray.length; m < ml; m += 2) {
66042
- let startResi = segArray[m];
66043
- let endResi = segArray[m+1];
66044
- for(let n = parseInt(startResi); n <= parseInt(endResi); ++n) {
66083
+ let startResi = parseInt(segArray[m]);
66084
+ let endResi = parseInt(segArray[m+1]);
66085
+
66086
+ for(let n = startResi; n <= endResi; ++n) {
66045
66087
  let resid = chainid + '_' + pos2resi[n];
66046
66088
  ++resCnt;
66047
66089
  domainAtoms = me.hashUtilsCls.unionHash(domainAtoms, ic.residues[resid]);
66048
66090
 
66049
66091
  // clear previous refnum assignment if any
66050
- // if(bRerunDomain) {
66051
- delete ic.resid2refnum[resid];
66052
- delete ic.residIgLoop[resid];
66053
- // }
66092
+ delete ic.resid2refnum[resid];
66093
+ delete ic.residIgLoop[resid];
66054
66094
  }
66055
66095
  }
66056
66096
 
@@ -66247,11 +66287,12 @@ class Dssp {
66247
66287
  domainid2refpdbnamelist[domainid][refpdbname] = score;
66248
66288
  }
66249
66289
  }
66250
- /* !!!
66251
- // combine the top three clusters for the 2nd round alignment
66290
+
66291
+ //!!!
66292
+
66293
+ // combine the top four clusters for the 2nd round alignment
66252
66294
  if(bRound1) {
66253
66295
  for(let domainid in domainid2refpdbnamelist) {
66254
- console.log("###score " + ic.domainid2score[domainid].split('_')[0] + " ic.domainid2refpdbname[domainid][0] " + ic.domainid2refpdbname[domainid][0])
66255
66296
  if(!me.bNode && ic.domainid2refpdbname[domainid][0] == 'all_templates') {
66256
66297
  let refpdbname2score = domainid2refpdbnamelist[domainid];
66257
66298
  let refpdbnameList = Object.keys(refpdbname2score);
@@ -66259,12 +66300,11 @@ class Dssp {
66259
66300
  return refpdbname2score[b] - refpdbname2score[a]
66260
66301
  });
66261
66302
  // top 3 templates
66262
- ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,3);
66303
+ ic.domainid2refpdbname[domainid] = refpdbnameList.slice(0,4);
66263
66304
  }
66264
- console.log("###bb ic.domainid2refpdbname[domainid] " + ic.domainid2refpdbname[domainid])
66265
66305
  }
66266
66306
  }
66267
- */
66307
+
66268
66308
  return domainid2segs; // only used in round 2
66269
66309
  }
66270
66310
 
@@ -67131,6 +67171,7 @@ class Dssp {
67131
67171
  let currResid = chnid + '_' + currResi;
67132
67172
  delete ic.residIgLoop[currResid];
67133
67173
  ic.resid2domainid[currResid] = domainid;
67174
+ ic.resid2refnum_ori[currResid] = 1; // a hash to check which residues were assigned
67134
67175
  }
67135
67176
 
67136
67177
  break;
@@ -67164,6 +67205,7 @@ class Dssp {
67164
67205
  let currResid = chnid + '_' + currResi;
67165
67206
  delete ic.residIgLoop[currResid];
67166
67207
  ic.resid2domainid[currResid] = domainid;
67208
+ ic.resid2refnum_ori[currResid] = 1; // a hash to check which residues were assigned
67167
67209
  }
67168
67210
 
67169
67211
  break;
@@ -67171,15 +67213,13 @@ class Dssp {
67171
67213
  }
67172
67214
  }
67173
67215
  }
67174
- /*
67216
+
67175
67217
  // 2b. remove strands with less than 3 residues except G strand
67176
67218
  for(let il = strandArray.length, i = il - 1; i >= 0; --i) {
67177
67219
  let strandTmp = strandArray[i].strand.substr(0, 1);
67178
67220
  if(strandTmp != 'G' && strandArray[i].endRefnum - strandArray[i].startRefnum + 1 < 3) { // remove the strand
67179
67221
  if(strandTmp == 'B' || strandTmp == 'C' || strandTmp == 'E' || strandTmp == 'F') {
67180
67222
  if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are removed since they are too short...");
67181
-
67182
- console.log("### strandTmp " + strandTmp + " strandArray[i].endRefnum - strandArray[i].startRefnum + 1 " + (strandArray[i].endRefnum - strandArray[i].startRefnum + 1))
67183
67223
  return false;
67184
67224
  }
67185
67225
 
@@ -67190,7 +67230,7 @@ class Dssp {
67190
67230
  strandArray.splice(i, 1);
67191
67231
  }
67192
67232
  }
67193
- */
67233
+
67194
67234
  // 3. assign refnumLabel for each resid
67195
67235
  strandCnt = 0;
67196
67236
  let loopCnt = 0;