icn3d 3.23.5 → 3.23.6

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
@@ -7045,6 +7045,12 @@ class ClickMenu {
7045
7045
  thisClass.setLogCmd('color ig strand', true);
7046
7046
  });
7047
7047
 
7048
+ me.myEventCls.onIds("#" + me.pre + "mn4_clrIgproto", "click", function(e) { let ic = me.icn3d; //e.preventDefault();
7049
+ //ic.legendClick = 6;
7050
+ ic.setOptionCls.setOption('color', 'ig protodomain');
7051
+ thisClass.setLogCmd('color ig protodomain', true);
7052
+ });
7053
+
7048
7054
 
7049
7055
  me.myEventCls.onIds("#" + me.pre + "mn4_clrArea", "click", function(e) { me.icn3d; //e.preventDefault();
7050
7056
  me.htmlCls.dialogCls.openDlg('dl_colorbyarea', "Color based on residue's solvent accessibility");
@@ -9361,7 +9367,9 @@ class SetMenu {
9361
9367
  html += this.getRadio('mn4_clr', 'mn4_clrConfidence', 'AlphaFold<br><span style="padding-left:1.5em;">Confidence</span>', undefined, 1, 1);
9362
9368
  //}
9363
9369
 
9364
- html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
9370
+ //!!!
9371
+ //html += this.getRadio('mn4_clr', 'mn4_clrIgstrand', 'Ig Strand', undefined, undefined, 2);
9372
+ //html += this.getRadio('mn4_clr', 'mn4_clrIgproto', 'Ig Protodomain', undefined, undefined, 2);
9365
9373
  }
9366
9374
  else {
9367
9375
  //if(!me.cfg.hidelicense) html += this.getRadio('mn4_clr', 'mn1_delphi2', 'DelPhi<br><span style="padding-left:1.5em;">Potential ' + me.htmlCls.licenseStr + '</span>');
@@ -9580,12 +9588,13 @@ class SetMenu {
9580
9588
  html += this.getMenuText('mn6_igrefwrap', 'Ref. Number', undefined, undefined, 1);
9581
9589
 
9582
9590
  html += "<ul>";
9583
-
9591
+ //!!!
9592
+ /*
9584
9593
  html += this.getLink('mn6_igrefYes', 'Show Ig Ref. Number', undefined, 2);
9585
9594
  html += this.getLink('mn6_igrefNo', 'Hide Ig Ref. Number', undefined, 2);
9586
9595
 
9587
9596
  html += this.getMenuSep();
9588
-
9597
+ */
9589
9598
  html += this.getLink('mn6_customref', 'Custom Ref. Number', undefined, 2);
9590
9599
  html += "</ul>";
9591
9600
  html += "</li>";
@@ -31852,6 +31861,8 @@ class Alternate {
31852
31861
 
31853
31862
  ic.dAtoms = {};
31854
31863
 
31864
+ let bMutation = moleculeArray.length == 2 && moleculeArray[1].replace(moleculeArray[0], '') == '2';
31865
+
31855
31866
  for(let i = 0, il = moleculeArray.length; i < il; ++i) {
31856
31867
  let structure = moleculeArray[i];
31857
31868
  //if(i > ic.ALTERNATE_STRUCTURE || (ic.ALTERNATE_STRUCTURE === il - 1 && i === 0) ) {
@@ -31884,7 +31895,17 @@ class Alternate {
31884
31895
 
31885
31896
  if(ic.ALTERNATE_STRUCTURE < 0) ic.ALTERNATE_STRUCTURE += il;
31886
31897
 
31887
- $("#" + ic.pre + "title").html(structure);
31898
+ let label = '';
31899
+ if(bMutation) {
31900
+ if(i == 0) {
31901
+ label = "Wild Type ";
31902
+ }
31903
+ else if(i == 1) {
31904
+ label = "Mutant ";
31905
+ }
31906
+ }
31907
+
31908
+ $("#" + ic.pre + "title").html(label + structure);
31888
31909
 
31889
31910
  break;
31890
31911
  }
@@ -34410,6 +34431,35 @@ class SetColor {
34410
34431
 
34411
34432
  break;
34412
34433
 
34434
+ case 'ig protodomain':
34435
+ if(ic.bShowRefnum) {
34436
+ for(let resid in ic.resid2refnum) {
34437
+ let refnumLabel = ic.resid2refnum[resid];
34438
+ let color;
34439
+ if(!refnumLabel) {
34440
+ color = me.parasCls.thr(me.htmlCls.GREYB);
34441
+ }
34442
+ else {
34443
+ let refnumStr = refnumLabel.replace(/'/g, '').replace(/\*/g, '').replace(/\^/g, '').substr(1); // C', C''
34444
+ let currStrand = refnumLabel.replace(new RegExp(refnumStr,'g'), '');
34445
+ color = ic.showSeqCls.getProtodomainColor(currStrand);
34446
+
34447
+ if(ic.residIgLoop.hasOwnProperty(resid)) {
34448
+ color = me.parasCls.thr(me.htmlCls.GREYB);
34449
+ }
34450
+ }
34451
+
34452
+ for (let i in ic.residues[resid]) {
34453
+ let atom = ic.atoms[i];
34454
+ atom.color = me.parasCls.thr(color);
34455
+
34456
+ ic.atomPrevColors[i] = atom.color;
34457
+ }
34458
+ }
34459
+ }
34460
+
34461
+ break;
34462
+
34413
34463
  case 'residue custom':
34414
34464
  for (let i in atoms) {
34415
34465
  let atom = ic.atoms[i];
@@ -35074,6 +35124,9 @@ class SetOption {
35074
35124
  else if(colorType == 'ig strand') {
35075
35125
  colorLabel = 'Ig Strand';
35076
35126
  }
35127
+ else if(colorType == 'ig protodomain') {
35128
+ colorLabel = 'Ig Protodomain';
35129
+ }
35077
35130
 
35078
35131
  let html = "Color by <b>" + colorLabel + "</b><br><br>";
35079
35132
 
@@ -35097,6 +35150,9 @@ class SetOption {
35097
35150
  else if (colorType == 'ig strand'){
35098
35151
  html += this.getColorLegendForIgstrand(ic.hAtoms);
35099
35152
  }
35153
+ else if (colorType == 'ig protodomain'){
35154
+ html += this.getColorLegendForIgproto(ic.hAtoms);
35155
+ }
35100
35156
  //else if (ic.legendClick == 4){
35101
35157
  else if (colorType == 'normalized hydrophobic' || colorType == 'hydrophobic') {
35102
35158
  let bOriResn = true;
@@ -35328,19 +35384,49 @@ class SetOption {
35328
35384
  "A^ Strand": "FF00FF",
35329
35385
  "A Strand": "663399",
35330
35386
  "A* Strand": "FFC0CB",
35331
- "A Strand": "9370db",
35387
+ "A' Strand": "663399", //"9370db",
35332
35388
  "B Strand": "ba55d3",
35333
35389
  "C Strand": "0000FF",
35334
35390
  "C' Strand": "6495ED",
35335
35391
  "C'' Strand": "006400",
35336
35392
  "D Strand": "00FF00",
35337
- "E Strand": "FFFF00",
35393
+ "E Strand": "F7DC6F", //"F0E68C",
35338
35394
  "F Strand": "FFA500",
35339
35395
  "G Strand": "FF0000",
35340
35396
  "G* Strand": "8B0000",
35341
35397
  "Loop": "CCCCCC"
35342
35398
  };
35343
-
35399
+
35400
+ html += "<div>";
35401
+ for (let name in name2color) {
35402
+ let color = name2color[name];
35403
+ html += "<span>";
35404
+ html += "<div style='width: 10px; height: 10px; background-color:#" + color + "; border: 0px;display:inline-block;' ></div> ";
35405
+ html += name;
35406
+ html += "</span><br>";
35407
+ }
35408
+
35409
+ html += "</div>";
35410
+
35411
+ return html;
35412
+ }
35413
+
35414
+ getColorLegendForIgproto(atomHash) { let ic = this.icn3d; ic.icn3dui;
35415
+ let html = '';
35416
+
35417
+ const name2color = {
35418
+ "A Strand": "0000FF",
35419
+ "B Strand": "006400",
35420
+ "C Strand": "F7DC6F", //"F0E68C",
35421
+ "C' Strand": "FFA500",
35422
+ "C'' Strand": "FF0000",
35423
+ "D Strand": "0000FF",
35424
+ "E Strand": "006400",
35425
+ "F Strand": "F7DC6F", //"F0E68C",
35426
+ "G Strand": "FFA500",
35427
+ "Loop": "CCCCCC"
35428
+ };
35429
+
35344
35430
  html += "<div>";
35345
35431
  for (let name in name2color) {
35346
35432
  let color = name2color[name];
@@ -41479,6 +41565,8 @@ class ShowSeq {
41479
41565
  let html = '', html3 = '';
41480
41566
 
41481
41567
  let chainList = '';
41568
+ if(!ic.chainid2index[chnid]) return {html: html, html3: html3};
41569
+
41482
41570
  for(let i = 0, il = ic.chainid2index[chnid].length; i < il; ++i) {
41483
41571
  chainList += ic.refpdbArray[ic.chainid2index[chnid][i]] + " ";
41484
41572
  }
@@ -41962,7 +42050,7 @@ class ShowSeq {
41962
42050
  return '#FFC0CB'; //'#9900ff'; //'#87CEEB';
41963
42051
  }
41964
42052
  else if(currStrand == "A'") { //medium purple // steel blue
41965
- return '#9370db'; //'#9900ff'; //'#4682B4';
42053
+ return '#663399'; //'#9370db'; //'#9900ff'; //'#4682B4';
41966
42054
  }
41967
42055
  else if(currStrand == "B") { //medium orchid // cyan
41968
42056
  return '#ba55d3'; //'#0000FF'; //'#4a86e8'; //'#00FFFF';
@@ -41980,7 +42068,7 @@ class ShowSeq {
41980
42068
  return '#00FF00'; //'#fffb00'; //'#A52A2A';
41981
42069
  }
41982
42070
  else if(currStrand == "E") { //yellow // pink
41983
- return '#F0E68C'; //'#ff9900'; //'#ffd966'; //'#FFC0CB';
42071
+ return "#F7DC6F"; //'#F0E68C'; //'#ff9900'; //'#ffd966'; //'#FFC0CB';
41984
42072
  }
41985
42073
  else if(currStrand == "F") { //orange // magenta
41986
42074
  return '#FFA500'; //'#FF00FF'; //'#ff9900'; //'#FF00FF';
@@ -41996,6 +42084,27 @@ class ShowSeq {
41996
42084
  }
41997
42085
  }
41998
42086
 
42087
+ getProtodomainColor(currStrand) { let ic = this.icn3d, me = ic.icn3dui;
42088
+ if((currStrand && currStrand.substr(0,1) == "A") || currStrand == "D") {
42089
+ return '#0000FF';
42090
+ }
42091
+ else if(currStrand == "B" || currStrand == "E") {
42092
+ return '#006400';
42093
+ }
42094
+ else if(currStrand == "C" || currStrand == "F") {
42095
+ return "#F7DC6F"; //'#F0E68C';
42096
+ }
42097
+ else if(currStrand == "C'" || (currStrand && currStrand.substr(0, 1) == "G")) {
42098
+ return '#FFA500';
42099
+ }
42100
+ else if(currStrand == "C''") { //linker
42101
+ return '#FF0000';
42102
+ }
42103
+ else {
42104
+ return me.htmlCls.GREYB;
42105
+ }
42106
+ }
42107
+
41999
42108
  insertGap(chnid, seqIndex, text, bNohtml) { let ic = this.icn3d; ic.icn3dui;
42000
42109
  let html = '';
42001
42110
  //if(me.cfg.blast_rep_id == chnid && ic.targetGapHash!== undefined && ic.targetGapHash.hasOwnProperty(seqIndex)) {
@@ -43058,7 +43167,7 @@ class LineGraph {
43058
43167
  // Node for common interaction: {id : "Q24.A.2AJF|Q24", r : "1_1_2AJF_A_24", s: "a", ...}
43059
43168
  let nodeArray1SplitCommon = [], nodeArray2SplitCommon = [], linkArraySplitCommon = [], nameHashSplitCommon = [];
43060
43169
  let nodeArray1SplitDiff = [], nodeArray2SplitDiff = [], linkArraySplitDiff = [], nameHashSplitDiff = [];
43061
- let linkedNodeCnt = {};
43170
+ let linkedNodeCnt = {}, linkedNodeInterDiff = {};
43062
43171
 
43063
43172
  for(let i = 0, il = structureArray.length; i < il; ++i) {
43064
43173
  nodeArray1Split[i] = [];
@@ -43078,7 +43187,7 @@ class LineGraph {
43078
43187
 
43079
43188
  struc2index[structureArray[i]] = i;
43080
43189
  }
43081
-
43190
+
43082
43191
  for(let i = 0, il = linkArray.length; i < il; ++i) {
43083
43192
  let link = linkArray[i];
43084
43193
  let nodeA = name2node[link.source];
@@ -43114,9 +43223,11 @@ class LineGraph {
43114
43223
 
43115
43224
  if(!linkedNodeCnt.hasOwnProperty(mappingid)) {
43116
43225
  linkedNodeCnt[mappingid] = 1;
43226
+ linkedNodeInterDiff[mappingid] = link.n;
43117
43227
  }
43118
43228
  else {
43119
43229
  ++linkedNodeCnt[mappingid];
43230
+ linkedNodeInterDiff[mappingid] -= link.n; // show difference
43120
43231
  }
43121
43232
  }
43122
43233
  }
@@ -43167,7 +43278,7 @@ class LineGraph {
43167
43278
  linkDiff.source += separatorDiff + ic.chainsMapping[chainid1][resid1];
43168
43279
  linkDiff.target += separatorDiff + ic.chainsMapping[chainid2][resid2];
43169
43280
 
43170
- if(linkedNodeCnt[mappingid] == structureArray.length) {
43281
+ if(linkedNodeCnt[mappingid] == structureArray.length && linkedNodeInterDiff[mappingid] == 0) {
43171
43282
  linkArraySplitCommon[index].push(linkCommon);
43172
43283
  }
43173
43284
  else {
@@ -43956,7 +44067,10 @@ class GetGraph {
43956
44067
  ic.hBondCls.calculateChemicalHbonds(me.hashUtilsCls.intHash2Atoms(ic.dAtoms, complement, ic.atoms), me.hashUtilsCls.intHash2Atoms(ic.dAtoms, firstSetAtoms, ic.atoms), parseFloat(threshold), bSaltbridge, 'graph', true );
43957
44068
  resid2ResidhashHbond = me.hashUtilsCls.cloneHash(ic.resid2Residhash);
43958
44069
  }
43959
- let hbondStr = this.getGraphLinks(resid2ResidhashHbond, resid2ResidhashHbond, me.htmlCls.hbondInsideColor, labelType, me.htmlCls.hbondValuehbondInsideValue);
44070
+
44071
+ //let hbondStr = this.getGraphLinks(resid2ResidhashHbond, resid2ResidhashHbond, me.htmlCls.hbondInsideColor, labelType, me.htmlCls.hbondValuehbondInsideValue);
44072
+ let hbondStr = this.getGraphLinks(resid2ResidhashHbond, resid2ResidhashHbond, me.htmlCls.hbondInsideColor, labelType, me.htmlCls.hbondInsideValue);
44073
+
43960
44074
  return hbondStr;
43961
44075
  }
43962
44076
  getIonicLinksForSet(atoms, labelType) { let ic = this.icn3d, me = ic.icn3dui;
@@ -44056,9 +44170,10 @@ class GetGraph {
44056
44170
  getGraphLinks(hash1, hash2, color, labelType, value, bCartoon2d) {var ic = this.icn3d, me = ic.icn3dui;
44057
44171
  let hbondStr = '';
44058
44172
  value =(value === undefined) ? 1 : value;
44059
- let prevLinkStr = '';
44060
- let sourceTargetHash = {};
44173
+ //let prevLinkStr = '';
44174
+ //let sourceTargetHash = {};
44061
44175
 
44176
+ let linkstr2cnt = {};
44062
44177
  for(let resid1 in hash1) {
44063
44178
  //ASN $1KQ2.A:6@ND2
44064
44179
  //or ASN $1KQ2.A:6
@@ -44089,7 +44204,7 @@ class GetGraph {
44089
44204
  resName1 = ic.resi2resirange[resName1];
44090
44205
  resName2 = ic.resi2resirange[resName2];
44091
44206
  }
44092
-
44207
+ /*
44093
44208
  if(!sourceTargetHash.hasOwnProperty(resName1 + '_' + resName2) && resName1 !== undefined && resName2 !== undefined ) {
44094
44209
  let linkStr = ', {"source": "' + resName1 + '", "target": "' + resName2 + '", "v": ' + value + ', "c": "' + color + '"}';
44095
44210
  if(linkStr != prevLinkStr) hbondStr += linkStr;
@@ -44098,8 +44213,29 @@ class GetGraph {
44098
44213
  sourceTargetHash[resName1 + '_' + resName2] = 1;
44099
44214
  sourceTargetHash[resName2 + '_' + resName1] = 1;
44100
44215
  }
44216
+ */
44217
+
44218
+ if(resName1 !== undefined && resName2 !== undefined ) {
44219
+ let linkStr = '"source": "' + resName1 + '", "target": "' + resName2 + '", "v": ' + value + ', "c": "' + color + '"';
44220
+
44221
+ //prevLinkStr = linkStr;
44222
+
44223
+ if(!linkstr2cnt.hasOwnProperty(linkStr)) {
44224
+ linkstr2cnt[linkStr] = 1;
44225
+ linkstr2cnt[linkStr] = 1;
44226
+ }
44227
+ else {
44228
+ linkstr2cnt[linkStr] += 1;
44229
+ linkstr2cnt[linkStr] += 1;
44230
+ }
44231
+ }
44101
44232
  }
44102
44233
  }
44234
+
44235
+ for(let linkStr in linkstr2cnt) {
44236
+ hbondStr += ', {' + linkStr + ', "n": ' + linkstr2cnt[linkStr] + '}';
44237
+ }
44238
+
44103
44239
  return hbondStr;
44104
44240
  }
44105
44241
  convertLabel2Resid(residLabel) {var ic = this.icn3d; ic.icn3dui;
@@ -44535,12 +44671,14 @@ class ViewInterPairs {
44535
44671
  let bondCnt;
44536
44672
 
44537
44673
  // reset
44538
- ic.hbondpnts = [];
44539
- ic.saltbridgepnts = [];
44540
- ic.contactpnts = [];
44541
- ic.halogenpnts = [];
44542
- ic.picationpnts = [];
44543
- ic.pistackingpnts = [];
44674
+ if(!bHbondCalc) {
44675
+ ic.hbondpnts = [];
44676
+ ic.saltbridgepnts = [];
44677
+ ic.contactpnts = [];
44678
+ ic.halogenpnts = [];
44679
+ ic.picationpnts = [];
44680
+ ic.pistackingpnts = [];
44681
+ }
44544
44682
 
44545
44683
  // type: view, save, forcegraph
44546
44684
  ic.bRender = false;
@@ -47702,7 +47840,7 @@ class MmcifParser {
47702
47840
  }
47703
47841
 
47704
47842
  async downloadMmcifSymmetry(mmcifid, type) { let ic = this.icn3d, me = ic.icn3dui;
47705
- // https://files.rcsb.org/header/ i snot accessible in Node.js
47843
+ // https://files.rcsb.org/header/ is not accessible in Node.js
47706
47844
  let url = (me.bNode) ? "https://files.rcsb.org/view/" + mmcifid + ".cif" : "https://files.rcsb.org/header/" + mmcifid + ".cif";
47707
47845
 
47708
47846
  //ic.bCid = undefined;
@@ -49001,7 +49139,8 @@ class PdbParser {
49001
49139
  }
49002
49140
  else {
49003
49141
  url = "https://files.rcsb.org/view/" + pdbid + ".pdb";
49004
- ic.ParserUtilsCls.setYourNote(pdbid.toUpperCase() + '(PDB) in iCn3D');
49142
+ pdbid = pdbid.toUpperCase();
49143
+ ic.ParserUtilsCls.setYourNote(pdbid + '(PDB) in iCn3D');
49005
49144
  }
49006
49145
 
49007
49146
  //ic.bCid = undefined;
@@ -54310,6 +54449,7 @@ class LoadPDB {
54310
54449
  //let chainMissingResidueArray = {}
54311
54450
 
54312
54451
  let id = (pdbid) ? pdbid : ic.defaultPdbId;
54452
+
54313
54453
  let structure = id;
54314
54454
 
54315
54455
  let prevMissingChain = '';