icn3d 3.26.8 → 3.27.0

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
@@ -4456,23 +4456,23 @@ class ParasCls {
4456
4456
  //this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * ( + 0.81)/(1.14 + 0.81)),
4457
4457
  // hydrophobic
4458
4458
  // https://en.m.wikipedia.org/wiki/Hydrophobicity_scales#Wimley%E2%80%93White_whole_residue_hydrophobicity_scales
4459
- 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.85 + 1.85)/(0 + 1.85)),
4460
- 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.13 + 1.85)/(0 + 1.85)),
4461
- 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.94 + 1.85)/(0 + 1.85)),
4462
- 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.56 + 1.85)/(0 + 1.85)),
4463
- 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.31 + 1.85)/(0 + 1.85)),
4464
- 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.24 + 1.85)/(0 + 1.85)),
4465
- 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.23 + 1.85)/(0 + 1.85)),
4459
+ 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-2.09 + 2.09) / (0 + 2.09)),
4460
+ 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.71 + 2.09) / (0 + 2.09)),
4461
+ 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.25 + 2.09) / (0 + 2.09)),
4462
+ 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.12 + 2.09) / (0 + 2.09)),
4463
+ 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.71 + 2.09) / (0 + 2.09)),
4464
+ 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.67 + 2.09) / (0 + 2.09)),
4465
+ 'VAL': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.46 + 2.09) / (0 + 2.09)),
4466
+ 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.02 + 2.09) / (0 + 2.09)),
4466
4467
 
4467
4468
  // polar
4468
- 'GLY': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.01 + 0.58)/(0 + 0.58)),
4469
- 'VAL': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.07 + 0.58)/(0 + 0.58)),
4470
- 'SER': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.13 + 0.58)/(0 + 0.58)),
4471
- 'THR': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.14 + 0.58)/(0 + 0.58)),
4472
- 'ALA': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.17 + 0.58)/(0 + 0.58)),
4473
- 'ASN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.42 + 0.58)/(0 + 0.58)),
4474
- 'PRO': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.45 + 0.58)/(0 + 0.58)),
4475
- 'GLN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.58 + 0.58)/(0 + 0.58))
4469
+ 'PRO': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.14 + 1.15) / (0 + 1.15)),
4470
+ 'THR': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.25 + 1.15) / (0 + 1.15)),
4471
+ 'SER': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.46 + 1.15) / (0 + 1.15)),
4472
+ 'ALA': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.50 + 1.15) / (0 + 1.15)),
4473
+ 'GLN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.77 + 1.15) / (0 + 1.15)),
4474
+ 'ASN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.85 + 1.15) / (0 + 1.15)),
4475
+ 'GLY': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-1.15 + 1.15) / (0 + 1.15))
4476
4476
  };
4477
4477
 
4478
4478
  this.normalizedHPColors = {
@@ -4490,59 +4490,58 @@ class ParasCls {
4490
4490
  //this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * ( + 0.81)/(1.14 + 0.81)),
4491
4491
  // hydrophobic
4492
4492
  // https://en.m.wikipedia.org/wiki/Hydrophobicity_scales#Wimley%E2%80%93White_whole_residue_hydrophobicity_scales
4493
- // 0.65 ~ -1.85: white ~ green
4494
- 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.85 + 1.85)/2.5),
4495
- 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.13 + 1.85)/2.5),
4496
- 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.94 + 1.85)/2.5),
4497
- 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.56 + 1.85)/2.5),
4498
- 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.31 + 1.85)/2.5),
4499
- 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.24 + 1.85)/2.5),
4500
- 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.23 + 1.85)/2.5),
4493
+ // 1.15 ~ -2.09: white ~ green
4494
+ 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-2.09 + 2.09) / 3.24),
4495
+ 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.71 + 2.09) / 3.24),
4496
+ 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.25 + 2.09) / 3.24),
4497
+ 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.12 + 2.09) / 3.24),
4498
+ 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.71 + 2.09) / 3.24),
4499
+ 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.67 + 2.09) / 3.24),
4500
+ 'VAL': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.46 + 2.09) / 3.24),
4501
+ 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.02 + 2.09) / 3.24),
4501
4502
 
4502
4503
  // polar
4503
- 'GLY': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.01 + 1.85)/2.5),
4504
- 'VAL': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.07 + 1.85)/2.5),
4505
- 'SER': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.13 + 1.85)/2.5),
4506
- 'THR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.14 + 1.85)/2.5),
4507
- 'ALA': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.17 + 1.85)/2.5),
4508
- 'ASN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.42 + 1.85)/2.5),
4509
- 'PRO': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.45 + 1.85)/2.5),
4510
- 'GLN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.58 + 1.85)/2.5)
4504
+ 'PRO': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.14 + 2.09) / 3.24),
4505
+ 'THR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.25 + 2.09) / 3.24),
4506
+ 'SER': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.46 + 2.09) / 3.24),
4507
+ 'ALA': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.50 + 2.09) / 3.24),
4508
+ 'GLN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.77 + 2.09) / 3.24),
4509
+ 'ASN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.85 + 2.09) / 3.24),
4510
+ 'GLY': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (1.15 + 2.09) / 3.24)
4511
4511
  };
4512
4512
 
4513
4513
  this.hydrophobicValues = {
4514
- // charged residues
4514
+ // charged residues, larger than max polar (1.15)
4515
4515
  ' G': 3, ' A': 3, ' T': 3,
4516
4516
  ' C': 3, ' U': 3, ' DG': 3,
4517
4517
  ' DA': 3, ' DT': 3, ' DC': 3,
4518
4518
  ' DU': 3, 'G': 3, 'A': 3,
4519
4519
  'T': 3, 'C': 3, 'U': 3,
4520
4520
  'DG': 3, 'DA': 3, 'DT': 3,
4521
- 'DC': 3, 'DU': 3, 'ARG': 1,
4522
- 'LYS': 1, 'ASP': 3, 'GLU': 3,
4521
+ 'DC': 3, 'DU': 3, 'ARG': 1.5,
4522
+ 'LYS': 1.5, 'ASP': 3, 'GLU': 3,
4523
4523
  'HIS': 2,
4524
4524
 
4525
- // + 0.81)/(1.14 + 0.81)),
4526
4525
  // hydrophobic
4527
4526
  // https://en.m.wikipedia.org/wiki/Hydrophobicity_scales#Wimley%E2%80%93White_whole_residue_hydrophobicity_scales
4528
- // 0.65 ~ -1.85: white ~ green
4529
- 'TRP': -1.85,
4530
- 'PHE': -1.13,
4531
- 'TYR': -0.94,
4532
- 'LEU': -0.56,
4533
- 'ILE': -0.31,
4534
- 'CYS': -0.24,
4535
- 'MET': -0.23,
4527
+ // 1.15 ~ -2.09: white ~ green
4528
+ 'TRP': -2.09,
4529
+ 'PHE': -1.71,
4530
+ 'LEU': -1.25,
4531
+ 'ILE': -1.12,
4532
+ 'TYR': -0.71,
4533
+ 'MET': -0.67,
4534
+ 'VAL': -0.46,
4535
+ 'CYS': -0.02,
4536
4536
 
4537
4537
  // polar
4538
- 'GLY': 0.01,
4539
- 'VAL': 0.07,
4540
- 'SER': 0.13,
4541
- 'THR': 0.14,
4542
- 'ALA': 0.17,
4543
- 'ASN': 0.42,
4544
- 'PRO': 0.45,
4545
- 'GLN': 0.58
4538
+ 'PRO': 0.14,
4539
+ 'THR': 0.25,
4540
+ 'SER': 0.46,
4541
+ 'ALA': 0.50,
4542
+ 'GLN': 0.77,
4543
+ 'ASN': 0.85,
4544
+ 'GLY': 1.15
4546
4545
  };
4547
4546
 
4548
4547
  this.residueAbbrev = {
@@ -5928,8 +5927,8 @@ class ClickMenu {
5928
5927
  me.htmlCls.dialogCls.openDlg('dl_esmfold', 'Sequence to structure prediction with ESMFold');
5929
5928
  });
5930
5929
 
5931
- me.myEventCls.onIds("#" + me.pre + "mn1_gi", "click", function(e) { me.icn3d; //e.preventDefault();
5932
- me.htmlCls.dialogCls.openDlg('dl_gi', 'Please input protein gi');
5930
+ me.myEventCls.onIds("#" + me.pre + "mn1_proteinname", "click", function(e) { me.icn3d; //e.preventDefault();
5931
+ me.htmlCls.dialogCls.openDlg('dl_proteinname', 'Please input protein or gene name');
5933
5932
  });
5934
5933
 
5935
5934
  me.myEventCls.onIds("#" + me.pre + "mn1_cid", "click", function(e) { me.icn3d; //e.preventDefault();
@@ -6031,17 +6030,17 @@ class ClickMenu {
6031
6030
  thisClass.setLogCmd("export pdb hydrogen", true);
6032
6031
  });
6033
6032
 
6034
- me.myEventCls.onIds("#" + me.pre + "m1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6033
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6035
6034
  ic.refnumCls.exportRefnum('igstrand');
6036
6035
  thisClass.setLogCmd("export refnum igstrand", true);
6037
6036
  });
6038
6037
 
6039
- me.myEventCls.onIds("#" + me.pre + "m1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6038
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6040
6039
  ic.refnumCls.exportRefnum('kabat');
6041
6040
  thisClass.setLogCmd("export refnum kabat", true);
6042
6041
  });
6043
6042
 
6044
- me.myEventCls.onIds("#" + me.pre + "m1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6043
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6045
6044
  ic.refnumCls.exportRefnum('imgt');
6046
6045
  thisClass.setLogCmd("export refnum imgt", true);
6047
6046
  });
@@ -8454,10 +8453,16 @@ class SetMenu {
8454
8453
  let html = "";
8455
8454
 
8456
8455
  html += "<ul class='icn3d-mn-item'>";
8457
- //html += "<li><a href='https://www.ncbi.nlm.nih.gov/structure' target='_blank'>Search Structure " + me.htmlCls.wifiStr + "</a></li>";
8458
- html += this.getMenuUrl('mn1_searchstru', "https://www.ncbi.nlm.nih.gov/structure", "Search Structure " + me.htmlCls.wifiStr, 1, 1);
8456
+
8457
+ html += this.getMenuText('mn1_searchgrooup', 'Search Structure ' + me.htmlCls.wifiStr, undefined, 1, 1);
8458
+ html += "<ul>";
8459
+ html += this.getMenuUrl('mn1_searchstru', 'https://www.ncbi.nlm.nih.gov/structure', 'PDB Structures ' + me.htmlCls.wifiStr, undefined, 2);
8460
+ html += this.getLink('mn1_proteinname', 'AlphaFold Structures ' + me.htmlCls.wifiStr, undefined, 2);
8461
+ html += this.getMenuUrl('mn1_afdatabase', 'https://alphafold.ebi.ac.uk', 'AlphaFold UniProt Database ' + me.htmlCls.wifiStr, undefined, 2);
8462
+ html += "</ul>";
8463
+ html += "</li>";
8459
8464
 
8460
- html += this.getMenuText('mn1_searchsimilar', 'Search Similar', undefined, undefined, 1);
8465
+ html += this.getMenuText('mn1_searchsimilar', 'Search Similar' + me.htmlCls.wifiStr, undefined, undefined, 1);
8461
8466
  html += "<ul>";
8462
8467
  html += this.getLink('mn1_vastplus', 'NCBI VAST+ (PDB Complex)' + me.htmlCls.wifiStr, undefined, 2);
8463
8468
  html += this.getLink('mn1_vast', 'NCBI VAST (PDB Chain)' + me.htmlCls.wifiStr, undefined, 2);
@@ -8478,7 +8483,6 @@ class SetMenu {
8478
8483
 
8479
8484
  html += this.getLink('mn1_afid', 'UniProt ID ' + me.htmlCls.wifiStr, undefined, 3);
8480
8485
  html += this.getLink('mn1_refseqid', 'NCBI Protein Accession ' + me.htmlCls.wifiStr, undefined, 3);
8481
- // html += this.getLink('mn1_proteinname', 'Protein Name ' + me.htmlCls.wifiStr, undefined, 3);
8482
8486
  html += "</ul>";
8483
8487
 
8484
8488
 
@@ -8520,10 +8524,11 @@ class SetMenu {
8520
8524
  html += "</ul>";
8521
8525
  html += "</li>";
8522
8526
 
8523
- html += this.getMenuText('mn1_fold', 'AlphaFold/ESM', undefined, undefined, 1);
8527
+ //html += this.getMenuText('mn1_fold', 'AlphaFold/ESM', undefined, undefined, 1);
8528
+ html += this.getMenuText('mn1_fold', 'Predict by Seq.', undefined, undefined, 1);
8524
8529
  html += "<ul>";
8525
- html += this.getLink('mn1_alphafold', 'AlphaFold2 via ColabFold', undefined, 2);
8526
8530
  html += this.getLink('mn1_esmfold', 'ESMFold', undefined, 2);
8531
+ html += this.getLink('mn1_alphafold', 'AlphaFold2 via ColabFold', undefined, 2);
8527
8532
  html += "</ul>";
8528
8533
 
8529
8534
 
@@ -10341,6 +10346,9 @@ class Dialog {
10341
10346
  if(me.cfg.align) {
10342
10347
  position ={ my: "left top", at: "left top+90", of: "#" + me.pre + "canvas", collision: "none" };
10343
10348
  }
10349
+ else if(id === me.pre + 'dl_mmdbafid') {
10350
+ position ={ my: "left top", at: "left top+130", of: "#" + me.pre + "canvas", collision: "none" };
10351
+ }
10344
10352
  else {
10345
10353
  position ={ my: "left top", at: "left top+50", of: "#" + me.pre + "canvas", collision: "none" };
10346
10354
  }
@@ -10874,7 +10882,7 @@ class SetDialog {
10874
10882
 
10875
10883
  html += me.htmlCls.divStr + "dl_esmfold' style='max-width:600px;' class='" + dialogClass + "'>";
10876
10884
  html += this.addNotebookTitle('dl_esmfold', 'Sequence to structure prediction with ESMFold');
10877
- html += "The sequence to structure prediction is done via <a href='https://esmatlas.com/resources?action=fold' target='_blank'>ESM Metagenomic Atlas</a>. Generally the sequence should be less than 1024 characters. For any seqeunce longer than 1024, please see the discussion <a href='https://github.com/facebookresearch/esm/issues/21' target='_blank'>here</a>.<br><br> ";
10885
+ html += "The sequence to structure prediction is done via <a href='https://esmatlas.com/resources?action=fold' target='_blank'>ESM Metagenomic Atlas</a>. The sequence should be less than 400 characters. For any sequence longer than 400, please see the discussion <a href='https://github.com/facebookresearch/esm/issues/21' target='_blank'>here</a>.<br><br> ";
10878
10886
  html += "FASTA sequence: <br><textarea id='" + me.pre + "esmfold_fasta' rows='5' style='width: 100%; height: " +(me.htmlCls.LOG_HEIGHT) + "px; padding: 0px; border: 0px;'></textarea><br><br>";
10879
10887
  html += me.htmlCls.buttonStr + "run_esmfold'>ESMFold</button> ";
10880
10888
  html += "</div>";
@@ -10886,10 +10894,10 @@ class SetDialog {
10886
10894
  html += me.htmlCls.buttonStr + "applyyournote'>Save</button>";
10887
10895
  html += "</div>";
10888
10896
 
10889
- html += me.htmlCls.divStr + "dl_gi' class='" + dialogClass + "'>";
10890
- html += this.addNotebookTitle('dl_gi', 'Please input an NCBI gi');
10891
- html += "Protein gi: " + me.htmlCls.inputTextStr + "id='" + me.pre + "gi' value='1310960' size=8> ";
10892
- html += me.htmlCls.buttonStr + "reload_gi'>Load</button>";
10897
+ html += me.htmlCls.divStr + "dl_proteinname' class='" + dialogClass + "'>";
10898
+ html += this.addNotebookTitle('dl_proteinname', 'Please input a protein/gene name');
10899
+ html += "Protein/Gene name: " + me.htmlCls.inputTextStr + "id='" + me.pre + "proteinname' value='TP53' size=8> ";
10900
+ html += me.htmlCls.buttonStr + "reload_proteinname'>Search</button>";
10893
10901
  html += "</div>";
10894
10902
 
10895
10903
  html += me.htmlCls.divStr + "dl_cid' class='" + dialogClass + "'>";
@@ -12879,12 +12887,19 @@ class Events {
12879
12887
  }
12880
12888
 
12881
12889
  let esmfold_fasta = $("#" + me.pre + "esmfold_fasta").val();
12882
- let pdbid;
12890
+ let pdbid = 'stru--';
12883
12891
 
12884
12892
  if(esmfold_fasta.indexOf('>') != -1) { //FASTA with header
12885
12893
  let pos = esmfold_fasta.indexOf('\n');
12886
12894
  ic.esmTitle = esmfold_fasta.substr(1, pos - 1).trim();
12887
- pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
12895
+ if(ic.esmTitle.indexOf('|') != -1) { // uniprot
12896
+ let idArray = ic.esmTitle.split('|');
12897
+ pdbid = (idArray.length > 2) ? idArray[1] : ic.esmTitle;
12898
+ }
12899
+ else { // NCBI
12900
+ pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
12901
+ }
12902
+
12888
12903
  if(pdbid.length < 6) pdbid = pdbid.padEnd(6, '-');
12889
12904
 
12890
12905
  esmfold_fasta = esmfold_fasta.substr(pos + 1);
@@ -12893,8 +12908,8 @@ class Events {
12893
12908
  // remove new lines
12894
12909
  esmfold_fasta = esmfold_fasta.replace(/\s/g, '');
12895
12910
 
12896
- if(esmfold_fasta.length > 1024) {
12897
- var aaa = 1; //alert("Your seqeunce is larger than 1024 characters. Please consider to split it as described at https://github.com/facebookresearch/esm/issues/21.");
12911
+ if(esmfold_fasta.length > 400) {
12912
+ var aaa = 1; //alert("Your sequence is larger than 400 characters. Please consider to split it as described at https://github.com/facebookresearch/esm/issues/21.");
12898
12913
  return;
12899
12914
  }
12900
12915
 
@@ -12903,6 +12918,11 @@ class Events {
12903
12918
  thisClass.setLogCmd("Run ESMFold with the sequence " + esmfold_fasta, false);
12904
12919
 
12905
12920
  let esmData = await me.getAjaxPostPromise(esmUrl, esmfold_fasta, true, alertMess, undefined, true, 'text');
12921
+
12922
+ ic.bInputfile = true;
12923
+ ic.InputfileType = 'pdb';
12924
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + esmData : esmData;
12925
+
12906
12926
  ic.bEsmfold = true;
12907
12927
  let bAppend = true;
12908
12928
  await ic.pdbParserCls.loadPdbData(esmData, pdbid, undefined, bAppend, undefined, undefined, undefined, ic.bEsmfold);
@@ -12941,12 +12961,12 @@ class Events {
12941
12961
  });
12942
12962
 
12943
12963
 
12944
- me.myEventCls.onIds("#" + me.pre + "reload_gi", "click", function(e) { let ic = me.icn3d;
12964
+ me.myEventCls.onIds("#" + me.pre + "reload_proteinname", "click", function(e) { let ic = me.icn3d;
12945
12965
  e.preventDefault();
12946
12966
  if(!me.cfg.notebook) dialog.dialog( "close" );
12947
- thisClass.setLogCmd("load gi " + $("#" + me.pre + "gi").val(), false);
12967
+ thisClass.setLogCmd("load protein " + $("#" + me.pre + "proteinname").val(), false);
12948
12968
  let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
12949
- window.open(hostUrl + '?gi=' + $("#" + me.pre + "gi").val(), urlTarget);
12969
+ window.open(hostUrl + '?protein=' + $("#" + me.pre + "proteinname").val(), urlTarget);
12950
12970
  });
12951
12971
 
12952
12972
  me.myEventCls.onIds("#" + me.pre + "reload_refseq", "click", function(e) { let ic = me.icn3d;
@@ -14528,8 +14548,17 @@ class AlignSeq {
14528
14548
 
14529
14549
  let chainHash = {};
14530
14550
  if (alignChainArray !== undefined) {
14551
+
14531
14552
  for (let i = 0, il = alignChainArray.length; i < il; ++i) {
14532
- chainHash[alignChainArray[i]] = 1;
14553
+ let chainid = alignChainArray[i];
14554
+
14555
+ // make sure some residues are aligned
14556
+ if(ic.alnChainsSeq[chainid] && ic.alnChainsSeq[chainid].length > 0) {
14557
+ chainHash[chainid] = 1;
14558
+ }
14559
+ else {
14560
+ return { "sequencesHtml": sequencesHtml, "maxSeqCnt": maxSeqCnt };
14561
+ }
14533
14562
  }
14534
14563
  }
14535
14564
 
@@ -14544,7 +14573,7 @@ class AlignSeq {
14544
14573
  let bHighlightChain;
14545
14574
  let index = 0, prevResCnt2nd = 0;
14546
14575
  let firstChainid, oriChainid;
14547
-
14576
+ console.log("alignChainArray.length: " + alignChainArray.length);
14548
14577
  // for(let i in ic.alnChains) {
14549
14578
  for (let m = 0, ml = alignChainArray.length; m < ml; ++m) {
14550
14579
  let i = alignChainArray[m];
@@ -14721,7 +14750,7 @@ class AlignSeq {
14721
14750
  //sequencesHtml += "<div class='icn3d-residueLine' style='white-space:nowrap;'><div class='icn3d-seqTitle' chain='" + i + "' anno='" + j + "'>" + annotitle + "</div>" + resiHtmlArray[j] + "<br/></div>";
14722
14751
  sequencesHtml += "<div class='icn3d-residueLine' style='white-space:nowrap;'><div class='icn3d-seqTitle' anno='" + j + "'>" + annotitle + "</div>" + resiHtmlArray[j] + "<br/></div>";
14723
14752
  }
14724
-
14753
+
14725
14754
  sequencesHtml += '<div class="icn3d-seqTitle icn3d-link icn3d-blue" chain="' + i + '" anno="sequence" title="' + title + '">' + chainidTmp + ' </div><span class="icn3d-seqLine">' + seqHtml + '</span><br/>';
14726
14755
 
14727
14756
  if (index > 0) prevResCnt2nd += seqLength;
@@ -35560,13 +35589,13 @@ class SetOption {
35560
35589
  html += "<div>";
35561
35590
 
35562
35591
  if(colorType == 'normalized hydrophobic') {
35563
- html += "Dark green (W, F, Y, L, I, C, M): Hydrophobic<br>";
35564
- html += "Light green (G, V, S, T, A, N, P, Q): Polar<br>";
35592
+ html += "Dark green (W, F, L, I, Y, M, V, C): Hydrophobic<br>";
35593
+ html += "Light green (P, T, S, A, Q, N, G): Polar<br>";
35565
35594
  html += "Grey: Charged, not hydrophobic<br><br>";
35566
35595
  }
35567
35596
  else {
35568
- html += "Green (W, F, Y, L, I, C, M): Hydrophobic<br>";
35569
- html += "Yellow (G, V, S, T, A, N, P, Q): Polar<br>";
35597
+ html += "Green (W, F, L, I, Y, M, V, C): Hydrophobic<br>";
35598
+ html += "Yellow (P, T, S, A, Q, N, G): Polar<br>";
35570
35599
  html += "Red: Negatively Charged<br>";
35571
35600
  html += "Blue: Positively Charged<br><br>";
35572
35601
  }
@@ -39125,7 +39154,7 @@ class Domain3d {
39125
39154
  return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi };
39126
39155
  } // end c2b_NewSplitChain
39127
39156
 
39128
- getDomainJsonForAlign(atoms) { let ic = this.icn3d, me = ic.icn3dui;
39157
+ getDomainJsonForAlign(atoms, bForceOneDomain) { let ic = this.icn3d, me = ic.icn3dui;
39129
39158
  let result = this.c2b_NewSplitChain(atoms);
39130
39159
 
39131
39160
  let subdomains = result.subdomains;
@@ -39136,6 +39165,8 @@ class Domain3d {
39136
39165
  let residueArray = Object.keys(residueHash);
39137
39166
  let chnid = residueArray[0].substr(0, residueArray[0].lastIndexOf('_'));
39138
39167
 
39168
+ if(bForceOneDomain) subdomains = [];
39169
+
39139
39170
  //the whole structure is also considered as a large domain
39140
39171
  //if(subdomains.length == 0) {
39141
39172
  //subdomains.push([parseInt(ic.chainsSeq[chnid][0].resi), parseInt(ic.chainsSeq[chnid][ic.chainsSeq[chnid].length - 1].resi)]);
@@ -40993,7 +41024,7 @@ class ShowAnno {
40993
41024
  dataObj['targets'] = me.cfg.blast_rep_id + ':' + target_from_to_array.join(':');
40994
41025
  }
40995
41026
 
40996
- // get seqeunce
41027
+ // get sequence
40997
41028
  if(ic.blastAcxn) {
40998
41029
  let chainid = me.cfg.afid + '_A';
40999
41030
  let seq = '';
@@ -41024,7 +41055,7 @@ class ShowAnno {
41024
41055
  idArray.push(me.cfg.query_id);
41025
41056
  }
41026
41057
 
41027
- // get seqeunce
41058
+ // get sequence
41028
41059
  if(ic.blastAcxn) {
41029
41060
  let chainid = me.cfg.afid + '_A';
41030
41061
  let seq = '';
@@ -41351,7 +41382,7 @@ class ShowAnno {
41351
41382
  let data = ic.seqStructAlignData;
41352
41383
  if(data.data !== undefined) {
41353
41384
  query = data.data[0].query;
41354
- // if target is seqeunce, the key is not chnid
41385
+ // if target is sequence, the key is not chnid
41355
41386
  //target = data.data[0].targets[chnid];
41356
41387
  let keys = Object.keys(data.data[0].targets);
41357
41388
  target = data.data[0].targets[keys[0]];
@@ -41363,7 +41394,7 @@ class ShowAnno {
41363
41394
  evalue = target.scores.e_value.toPrecision(2);
41364
41395
  if(evalue > 1e-200) evalue = parseFloat(evalue).toExponential();
41365
41396
  target.scores.bit_score;
41366
- // if target is seqeunce, the key is not chnid
41397
+ // if target is sequence, the key is not chnid
41367
41398
  // targetSeq = data.targets[chnid].seqdata;
41368
41399
  let keys = Object.keys(data.targets);
41369
41400
  targetSeq = data.targets[keys[0]].seqdata;
@@ -42807,7 +42838,7 @@ class HlSeq {
42807
42838
  //});
42808
42839
 
42809
42840
  // remove possible text selection
42810
- // the following code caused the scroll of seqeunce window to the top, remove it for now
42841
+ // the following code caused the scroll of sequence window to the top, remove it for now
42811
42842
  /*
42812
42843
  if(window.getSelection) {
42813
42844
  if(window.getSelection().empty) { // Chrome
@@ -44395,26 +44426,22 @@ class LineGraph {
44395
44426
 
44396
44427
  let pdbAjaxArray = [];
44397
44428
  for(let k = 0, kl = ic.refpdbArray.length; k < kl; ++k) {
44398
- //let urlpdb = me.htmlCls.baseUrl + "icn3d/refpdb/" + ic.refpdbArray[k] + ".pdb";
44399
- let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + ic.refpdbArray[k];
44429
+ //let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + ic.refpdbArray[k];
44430
+ let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refjsonid=" + ic.refpdbArray[k];
44400
44431
 
44401
44432
  let pdbAjax = me.getAjaxPromise(urlpdb, 'text');
44402
44433
 
44403
44434
  pdbAjaxArray.push(pdbAjax);
44404
44435
  }
44405
44436
 
44406
- try {
44437
+ // try {
44407
44438
  let allPromise = Promise.allSettled(pdbAjaxArray);
44408
44439
  ic.pdbDataArray = await allPromise;
44409
44440
  await thisClass.parseRefPdbData(ic.pdbDataArray);
44410
- }
44411
- catch(err) {
44412
- if(!me.bNode) var aaa = 1; //alert("Error in retrieveing reference PDB data...");
44413
- //var aaa = 1; //alert("Error in retrieveing reference PDB data...");
44414
- return;
44415
- }
44416
-
44417
44441
  // }
44442
+ // catch(err) {
44443
+ // if(!me.bNode) var aaa = 1; //alert("Error in retrieveing reference PDB data...");
44444
+ // return;
44418
44445
  // }
44419
44446
  }
44420
44447
 
@@ -44426,7 +44453,8 @@ class LineGraph {
44426
44453
  let ajaxArray = [];
44427
44454
  let domainidpairArray = [];
44428
44455
 
44429
- let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
44456
+ me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
44457
+ let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
44430
44458
 
44431
44459
  if(!ic.resid2domainid) ic.resid2domainid = {};
44432
44460
  //ic.resid2domainid = {};
@@ -44506,6 +44534,9 @@ class LineGraph {
44506
44534
 
44507
44535
  for(let k = 0, kl = domainAtomsArray.length; k < kl; ++k) {
44508
44536
  let pdb_target = ic.saveFileCls.getAtomPDB(domainAtomsArray[k], undefined, undefined, undefined, undefined, struct);
44537
+ let bForceOneDomain = true;
44538
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(domainAtomsArray[k], bForceOneDomain);
44539
+
44509
44540
  // ig strand for any subset will have the same k, use the number of residue to separate them
44510
44541
  let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtomsArray[k]);
44511
44542
  let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtomsArray[k]);
@@ -44515,14 +44546,19 @@ class LineGraph {
44515
44546
  ic.domainid2pdb[domainid] = pdb_target;
44516
44547
 
44517
44548
  for(let index = 0, indexl = dataArray.length; index < indexl; ++index) {
44518
- let struct2 = ic.defaultPdbId + index;
44519
- //let pdb_query = (me.bNode) ? dataArray[index] : dataArray[index].value; //[0];
44520
- let pdb_query = dataArray[index].value; //[0];
44521
- let header = 'HEADER ' + struct2 + '\n';
44522
- pdb_query = header + pdb_query;
44523
-
44524
- let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
44525
- let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
44549
+ // let struct2 = ic.defaultPdbId + index;
44550
+ // let pdb_query = dataArray[index].value; //[0];
44551
+ // let header = 'HEADER ' + struct2 + '\n';
44552
+ // pdb_query = header + pdb_query;
44553
+ let jsonStr_q = dataArray[index].value; //[0];
44554
+
44555
+ // TM-align is not good when you align a full structure with the strand-only structure. VAST is better in this case.
44556
+ // let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
44557
+ // let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
44558
+
44559
+ let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
44560
+ let alignAjax = me.getAjaxPostPromise(urlalign, dataObj);
44561
+
44526
44562
  ajaxArray.push(alignAjax);
44527
44563
 
44528
44564
  domainidpairArray.push(domainid + "|" + ic.refpdbArray[index]);
@@ -44537,8 +44573,8 @@ class LineGraph {
44537
44573
  // let allPromise = Promise.allSettled(ajaxArray);
44538
44574
  // dataArray2 = await allPromise;
44539
44575
 
44540
- //split arrays into chunks of 100 jobs
44541
- let n = (me.bNode) ? 96 : 96;
44576
+ //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
44577
+ let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
44542
44578
 
44543
44579
  for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
44544
44580
  let currAjaxArray = [];
@@ -44601,6 +44637,7 @@ class LineGraph {
44601
44637
  let thisClass = this;
44602
44638
 
44603
44639
  let tmscoreThreshold = 0.4; // 0.4; //0.5;
44640
+ let rmsdThreshold = 10;
44604
44641
 
44605
44642
  // find the best alignment for each chain
44606
44643
  let domainid2score = {}, domainid2segs = {}, chainid2segs = {};
@@ -44628,8 +44665,15 @@ class LineGraph {
44628
44665
 
44629
44666
  if(queryData.length == 0) continue;
44630
44667
 
44631
- if(queryData[0].score < tmscoreThreshold || queryData[0].num_res < minResidues) {
44632
- continue;
44668
+ if(!bRound1) {
44669
+ if(queryData[0].score < tmscoreThreshold || queryData[0].num_res < minResidues) {
44670
+ continue;
44671
+ }
44672
+ }
44673
+ else {
44674
+ if(queryData[0].super_rmsd > rmsdThreshold || queryData[0].num_res < minResidues) {
44675
+ continue;
44676
+ }
44633
44677
  }
44634
44678
 
44635
44679
  //let domainid_index = domainidpairArray[i].split(',');
@@ -44638,42 +44682,63 @@ class LineGraph {
44638
44682
  let refpdbname = domainidpairArray[i].substr(domainidpairArray[i].indexOf('|') + 1);
44639
44683
  //let chainid = domainid.split('-')[0];
44640
44684
 
44685
+ if(!bRound1) {
44686
+ if(!me.bNode) console.log("refpdbname " + refpdbname + " TM-score: " + queryData[0].score);
44687
+ }
44688
+ else {
44689
+ if(!me.bNode) console.log("refpdbname " + refpdbname + " RMSD: " + queryData[0].super_rmsd);
44690
+ }
44691
+
44641
44692
  // Ig-like domains: B (2150, 2150a, 2150b), C (3150, 3250), E (7150, 7250), F (8150, 8250) strands
44642
44693
  // Ig domain may require G (7050). But we'll leave that out for now.
44643
- let bBstrand = false, bCstrand = false, bEstrand = false, bFstrand = false;
44644
- for(let i = 0, il = queryData[0].segs.length; i < il; ++i) {
44645
- let seg = queryData[0].segs[i];
44694
+ if(!bRound1) {
44695
+ let bBstrand = false, bCstrand = false, bEstrand = false, bFstrand = false;
44696
+ for(let i = 0, il = queryData[0].segs.length; i < il; ++i) {
44697
+ let seg = queryData[0].segs[i];
44646
44698
 
44647
- if(seg.q_start.indexOf('2150') != -1 || seg.q_start.indexOf('2250') != -1) {
44648
- bBstrand = true;
44649
- }
44650
- else if(seg.q_start.indexOf('3150') != -1 || seg.q_start.indexOf('3250') != -1) {
44651
- bCstrand = true;
44652
- }
44653
- else if(seg.q_start.indexOf('7150') != -1 || seg.q_start.indexOf('7250') != -1) {
44654
- bEstrand = true;
44655
- }
44656
- else if(seg.q_start.indexOf('8150') != -1 || seg.q_start.indexOf('8250') != -1) {
44657
- bFstrand = true;
44699
+ if(seg.q_start.indexOf('2150') != -1 || seg.q_start.indexOf('2250') != -1) {
44700
+ bBstrand = true;
44701
+ }
44702
+ else if(seg.q_start.indexOf('3150') != -1 || seg.q_start.indexOf('3250') != -1) {
44703
+ bCstrand = true;
44704
+ }
44705
+ else if(seg.q_start.indexOf('7150') != -1 || seg.q_start.indexOf('7250') != -1) {
44706
+ bEstrand = true;
44707
+ }
44708
+ else if(seg.q_start.indexOf('8150') != -1 || seg.q_start.indexOf('8250') != -1) {
44709
+ bFstrand = true;
44710
+ }
44711
+
44712
+ //if(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand) break;
44713
+ if(bBstrand && bCstrand && bEstrand && bFstrand) break;
44658
44714
  }
44659
44715
 
44660
- //if(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand) break;
44661
- if(bBstrand && bCstrand && bEstrand && bFstrand) break;
44716
+ //if(!(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand)) continue;
44717
+ if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
44718
+ if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are missing in the domain " + domainid + "...");
44719
+ continue;
44720
+ }
44662
44721
  }
44663
44722
 
44664
- //if(!(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand)) continue;
44665
- if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
44666
- if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are missing in the domain " + domainid + "...");
44667
- continue;
44723
+ if(!bRound1) {
44724
+ if(!domainid2score.hasOwnProperty(domainid) || queryData[0].score > domainid2score[domainid]) {
44725
+ domainid2score[domainid] = queryData[0].score;
44726
+
44727
+ ic.domainid2refpdbname[domainid] = refpdbname;
44728
+ domainid2segs[domainid] = queryData[0].segs;
44729
+ ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
44730
+ ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
44731
+ }
44668
44732
  }
44669
-
44670
- if(!domainid2score.hasOwnProperty(domainid) || queryData[0].score > domainid2score[domainid]) {
44671
- domainid2score[domainid] = queryData[0].score;
44672
-
44673
- ic.domainid2refpdbname[domainid] = refpdbname;
44674
- domainid2segs[domainid] = queryData[0].segs;
44675
- ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
44676
- ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
44733
+ else {
44734
+ if(!domainid2score.hasOwnProperty(domainid) || queryData[0].super_rmsd < domainid2score[domainid]) {
44735
+ domainid2score[domainid] = queryData[0].super_rmsd;
44736
+
44737
+ ic.domainid2refpdbname[domainid] = refpdbname;
44738
+ domainid2segs[domainid] = queryData[0].segs;
44739
+ ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
44740
+ ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
44741
+ }
44677
44742
  }
44678
44743
  }
44679
44744
 
@@ -48090,7 +48155,7 @@ class ChainalignParser {
48090
48155
  let hAtomsAll = {};
48091
48156
 
48092
48157
  if(ic.bFullUi && ic.q_rotation !== undefined && !me.cfg.resnum && !me.cfg.resdef) {
48093
- // set multiple seqeunce alignment from ic.qt_start_end
48158
+ // set multiple sequence alignment from ic.qt_start_end
48094
48159
  hAtomsAll = this.setMsa(chainidArray);
48095
48160
  }
48096
48161
 
@@ -48150,7 +48215,7 @@ class ChainalignParser {
48150
48215
  ic.qt_start_end = [];
48151
48216
 
48152
48217
  let mmdbid2cnt = {}, mmdbidpairHash = {};
48153
-
48218
+
48154
48219
  let bFoundAlignment = false;
48155
48220
  for(let i = 0, il = dataArray.length; i < il; ++i) {
48156
48221
  // let align = (me.bNode) ? dataArray[i] : dataArray[i].value;//[0];
@@ -48411,7 +48476,7 @@ class ChainalignParser {
48411
48476
  let chainid = chainidArray[i];
48412
48477
  let pos = chainid.indexOf('_');
48413
48478
  let struct = chainid.substr(0, pos);
48414
- if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
48479
+ //if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
48415
48480
 
48416
48481
  if(!struct2cnt.hasOwnProperty(struct)) {
48417
48482
  struct2cnt[struct] = 1;
@@ -48630,6 +48695,7 @@ class ChainalignParser {
48630
48695
 
48631
48696
  processAlign(align, index, queryData, bEqualMmdbid, bEqualChain, bNoAlert) { let ic = this.icn3d, me = ic.icn3dui;
48632
48697
  let bAligned = false;
48698
+
48633
48699
  if((!align || align.length == 0) && !bNoAlert) {
48634
48700
  let serverName = (me.cfg.aligntool == 'tmalign') ? 'TM-align' : 'VAST';
48635
48701
 
@@ -48814,14 +48880,14 @@ class ChainalignParser {
48814
48880
  ic.ParserUtilsCls.showLoading();
48815
48881
 
48816
48882
  let allPromise = Promise.allSettled(ajaxArray);
48817
- try {
48883
+ // try {
48818
48884
  let dataArray = await allPromise;
48819
48885
  await thisClass.parseMMdbAfData(dataArray, structArray, bQuery, vastplusAtype);
48820
48886
  if(vastplusAtype === undefined) ic.ParserUtilsCls.hideLoading();
48821
- }
48822
- catch(err) {
48823
- var aaa = 1; //alert("There are some problems in retrieving the coordinates...");
48824
- }
48887
+ // }
48888
+ // catch(err) {
48889
+ // var aaa = 1; //alert("There are some problems in retrieving the coordinates...");
48890
+ // }
48825
48891
  // });
48826
48892
 
48827
48893
  // return ic.deferredMmdbaf.promise();
@@ -49460,6 +49526,73 @@ class MmdbParser {
49460
49526
  //await ic.loadScriptCls.loadScript(me.cfg.command, undefined, true);
49461
49527
  }
49462
49528
 
49529
+ async downloadProteinname(protein) { let ic = this.icn3d, me = ic.icn3dui;
49530
+ me.icn3d.bCid = undefined;
49531
+
49532
+ // get RefSeq ID from protein name
49533
+ let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?protein2acc=" + protein;
49534
+
49535
+ let accJson = await me.getAjaxPromise(url, 'jsonp');
49536
+
49537
+ let accArray = accJson.acc;
49538
+
49539
+ if(accArray.length == 0) {
49540
+ if(!me.bNode) var aaa = 1; //alert('The protein/gene name ' + protein + ' can not be mapped to RefSeq proteins...');
49541
+ return;
49542
+ }
49543
+
49544
+ let ajaxArray = [];
49545
+ for(let index = 0, indexl = accArray.length; index < indexl; ++index) {
49546
+ let refseqid = accArray[index];
49547
+ url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?refseq2uniprot=" + refseqid;
49548
+
49549
+ let ajax = me.getAjaxPromise(url, 'jsonp');
49550
+
49551
+ ajaxArray.push(ajax);
49552
+ }
49553
+
49554
+ let allPromise = Promise.allSettled(ajaxArray);
49555
+ let dataArray = await allPromise;
49556
+
49557
+ ajaxArray = [];
49558
+ let afidArray = [];
49559
+ for(let i = 0, il = dataArray.length; i < il; ++i) {
49560
+ let data = dataArray[i].value;
49561
+
49562
+ if(data && data.uniprot) {
49563
+ let afid = data.uniprot;
49564
+ url = "https://alphafold.ebi.ac.uk/files/AF-" + afid + "-F1-model_" + ic.AFUniprotVersion + ".pdb";
49565
+ ic.ParserUtilsCls.setYourNote(me.cfg.protein + '(NCBI Protein/Gene) in iCn3D');
49566
+
49567
+ let ajax = me.getAjaxPromise(url, 'text', true);
49568
+ ajaxArray.push(ajax);
49569
+ afidArray.push(afid);
49570
+ }
49571
+ }
49572
+
49573
+ allPromise = Promise.allSettled(ajaxArray);
49574
+ dataArray = await allPromise;
49575
+
49576
+ for(let i = 0, il = dataArray.length; i < il; ++i) {
49577
+ let data = dataArray[i].value;
49578
+ me.cfg.afid = afidArray[i];
49579
+
49580
+ if(data) {
49581
+ // add UniProt ID into the header
49582
+ let header = 'HEADER ' + me.cfg.afid + '\n';
49583
+ data = header + data;
49584
+ await ic.opmParserCls.parseAtomData(data, me.cfg.afid, undefined, 'pdb', undefined);
49585
+
49586
+ break;
49587
+ }
49588
+ }
49589
+
49590
+ if(!me.cfg.afid) {
49591
+ if(!me.bNode) var aaa = 1; //alert('The protein/gene name ' + protein + ' can not be mapped to AlphaFold structures...');
49592
+ return;
49593
+ }
49594
+ }
49595
+
49463
49596
  getNoData(mmdbid, bGi) { let ic = this.icn3d, me = ic.icn3dui;
49464
49597
  if(bGi) {
49465
49598
  var aaa = 1; //alert("This gi " + mmdbid + " has no corresponding 3D structure...");
@@ -50536,6 +50669,9 @@ class PdbParser {
50536
50669
  if(me.cfg.refseqid) {
50537
50670
  ic.ParserUtilsCls.setYourNote(me.cfg.refseqid.toUpperCase() + '(NCBI Protein Acc.) in iCn3D');
50538
50671
  }
50672
+ else if(me.cfg.protein) {
50673
+ ic.ParserUtilsCls.setYourNote(me.cfg.protein + '(NCBI Protein/Gene) in iCn3D');
50674
+ }
50539
50675
  else {
50540
50676
  ic.ParserUtilsCls.setYourNote(pdbid.toUpperCase() + '(AlphaFold) in iCn3D');
50541
50677
  }
@@ -51471,6 +51607,7 @@ class RealignParser {
51471
51607
  async realignOnStructAlign(bReverse) { let ic = this.icn3d, me = ic.icn3dui;
51472
51608
  // each 3D domain should have at least 3 secondary structures
51473
51609
  let minSseCnt = (me.cfg.aligntool != 'tmalign') ? 3 : 0;
51610
+
51474
51611
  let struct2domain = {};
51475
51612
  for(let struct in ic.structures) {
51476
51613
  struct2domain[struct] = {};
@@ -51481,7 +51618,7 @@ class RealignParser {
51481
51618
  let sseCnt = 0;
51482
51619
  for(let serial in atoms) {
51483
51620
  if(ic.atoms[serial].ssbegin) ++sseCnt;
51484
- if(sseCnt == minSseCnt) {
51621
+ if(sseCnt > minSseCnt) {
51485
51622
  struct2domain[struct][chainid] = atoms;
51486
51623
  break;
51487
51624
  }
@@ -51513,7 +51650,6 @@ class RealignParser {
51513
51650
  let chainid2 = chainidArray2[j];
51514
51651
 
51515
51652
  let alignAjax;
51516
-
51517
51653
  if(me.cfg.aligntool != 'tmalign') {
51518
51654
  let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
51519
51655
 
@@ -51552,7 +51688,7 @@ class RealignParser {
51552
51688
 
51553
51689
  async realignOnStructAlignMsa(nameArray) { let ic = this.icn3d, me = ic.icn3dui;
51554
51690
  // each 3D domain should have at least 3 secondary structures
51555
- let minSseCnt = 3;
51691
+ let minSseCnt = (me.cfg.aligntool != 'tmalign') ? 3 : 0;
51556
51692
  let chainid2domain = {};
51557
51693
 
51558
51694
  for(let i = 0, il = nameArray.length; i < il; ++i) {
@@ -51561,7 +51697,7 @@ class RealignParser {
51561
51697
  let sseCnt = 0;
51562
51698
  for(let serial in atoms) {
51563
51699
  if(ic.atoms[serial].ssbegin) ++sseCnt;
51564
- if(sseCnt == minSseCnt) {
51700
+ if(sseCnt > minSseCnt) {
51565
51701
  chainid2domain[chainid] = atoms;
51566
51702
  break;
51567
51703
  }
@@ -51661,7 +51797,7 @@ class RealignParser {
51661
51797
  let pos = chainidArray[i].indexOf('_');
51662
51798
  let mmdbid = chainidArray[i].substr(0, pos); //.toUpperCase();
51663
51799
 
51664
- if(!bRealign) mmdbid = mmdbid.toUpperCase();
51800
+ // if(!bRealign) mmdbid = mmdbid.toUpperCase();
51665
51801
 
51666
51802
  if(i == 0) {
51667
51803
  mmdbid_t = mmdbid;
@@ -51840,14 +51976,12 @@ class RealignParser {
51840
51976
  for(let j = 0, jl = resiArray.length; j < jl; ++j) {
51841
51977
  if(resiArray[j].indexOf('-') != -1) {
51842
51978
  let startEnd = resiArray[j].split('-');
51843
-
51844
51979
  for(let k = parseInt(startEnd[0]); k <= parseInt(startEnd[1]); ++k) {
51845
51980
  // from VAST neighbor page, use NCBI residue number
51846
51981
  //if(me.cfg.usepdbnum === false) k += base - 1;
51847
51982
 
51848
51983
  //let seqIndex = k - base;
51849
51984
  let seqIndex = ic.setSeqAlignCls.getPosFromResi(chainid, k);
51850
-
51851
51985
  // if(ic.bNCBI) {
51852
51986
  // let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chainid + '_' + k]);
51853
51987
  // if(atom && atom.resiNCBI) seqIndex = atom.resiNCBI - 1;
@@ -51864,9 +51998,9 @@ class RealignParser {
51864
51998
  }
51865
51999
  }
51866
52000
  else { // one residue
52001
+
51867
52002
  //let k = parseInt(resiArray[j]);
51868
52003
  let k = resiArray[j];
51869
-
51870
52004
  // from VAST neighbor page, use NCBI residue number
51871
52005
  //if(me.cfg.usepdbnum === false) k += base - 1;
51872
52006
 
@@ -53684,7 +53818,7 @@ class ParserUtils {
53684
53818
  if(ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
53685
53819
  }
53686
53820
 
53687
- // Realign by seqeunce alignment with the residues in "segment", i.e., transmembrane helix
53821
+ // Realign by sequence alignment with the residues in "segment", i.e., transmembrane helix
53688
53822
  let segment = data.segment; // e.g., " 361- 379 ( 359- 384)", the first range is trnasmembrane range,
53689
53823
  //the second range is the range of the helix
53690
53824
  let range = segment.replace(/ /gi, '').split('(')[0]; //361-379
@@ -54790,22 +54924,23 @@ class SetSeqAlign {
54790
54924
  }
54791
54925
 
54792
54926
  getPosFromResi(chainid, resi) { let ic = this.icn3d; ic.icn3dui;
54793
- /*
54794
- let pos = undefined; //parseInt(resi);
54795
-
54796
- for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
54797
- if(ic.chainsSeq[chainid][i].resi == resi) {
54798
- pos = i;
54799
- break;
54800
- }
54801
- }
54802
- */
54803
54927
  let residNCBI = ic.resid2ncbi[chainid + '_' + resi];
54804
54928
  let pos = undefined;
54929
+
54805
54930
  if(residNCBI) {
54806
54931
  let resiNCBI = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
54807
54932
  pos = resiNCBI - 1;
54808
54933
  }
54934
+ // else {
54935
+ // //let il = ic.chainsSeq[chainid].length;
54936
+ // let il = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid].length : 0;
54937
+ // for(let i = 0; i < il; ++i) {
54938
+ // if(ic.chainsSeq[chainid][i].resi == resi) {
54939
+ // pos = i;
54940
+ // break;
54941
+ // }
54942
+ // }
54943
+ // }
54809
54944
 
54810
54945
  return pos;
54811
54946
  }
@@ -55497,7 +55632,7 @@ class SetSeqAlign {
55497
55632
 
55498
55633
  //mmdbid1 = ic.mmdbid_t;
55499
55634
  mmdbid1 = chainidArray[0].substr(0, pos1); //.toUpperCase();
55500
- mmdbid2 = chainid.substr(0, pos2); //.toUpperCase();
55635
+ mmdbid2 = chainid.substr(0, pos2); //.toUpperCase()mergeTwoSeqForAll;
55501
55636
 
55502
55637
  chain1 = chainidArray[0].substr(pos1 + 1);
55503
55638
  chain2 = chainid.substr(pos2 + 1);
@@ -55892,7 +56027,7 @@ class LoadPDB {
55892
56027
  getStructureId(id, moleculeNum, bMutation) { let ic = this.icn3d; ic.icn3dui;
55893
56028
  let structure = id;
55894
56029
 
55895
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
56030
+ if(id == ic.defaultPdbId || bMutation || ic.structures.hasOwnProperty(id)) { // bMutation: side chain prediction
55896
56031
  structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
55897
56032
  }
55898
56033
 
@@ -55960,7 +56095,7 @@ class LoadPDB {
55960
56095
  let prevMissingChain = '';
55961
56096
  let CSerial, prevCSerial, OSerial, prevOSerial;
55962
56097
 
55963
- let bHeader = false;
56098
+ let bHeader = false, bFirstAtom = true;
55964
56099
 
55965
56100
  for (let i in lines) {
55966
56101
  let line = lines[i];
@@ -56121,7 +56256,11 @@ class LoadPDB {
56121
56256
  ic.pmid = line.substr(19).trim();
56122
56257
  }
56123
56258
  } else if (record === 'ATOM ' || record === 'HETATM') {
56124
- structure = this.getStructureId(id, moleculeNum, bMutation);
56259
+ if(bFirstAtom) {
56260
+ structure = this.getStructureId(id, moleculeNum, bMutation);
56261
+
56262
+ bFirstAtom = false;
56263
+ }
56125
56264
 
56126
56265
  let alt = line.substr(16, 1);
56127
56266
  //if (alt !== " " && alt !== "A") continue;
@@ -56264,6 +56403,7 @@ class LoadPDB {
56264
56403
 
56265
56404
  // different residue
56266
56405
  //if(residueNum !== prevResidueNum) {
56406
+
56267
56407
  if(oriResidueNum !== prevOriResidueNum) {
56268
56408
  let residue = me.utilsCls.residueName2Abbr(resn);
56269
56409
  ic.residueId2Name[residueNum] = residue;
@@ -57011,7 +57151,7 @@ class Vastplus {
57011
57151
 
57012
57152
  // reinitialize the alignment
57013
57153
  $("#" + ic.pre + "dl_sequence2").html('');
57014
-
57154
+
57015
57155
  for(let j = 0, jl = nodeArray.length; j < jl; ++j) {
57016
57156
  let node = parseInt(nodeArray[j]);
57017
57157
  let segs = queryDataArray[node][0].segs;
@@ -57088,7 +57228,7 @@ class Vastplus {
57088
57228
  for(let j = 0, jl = nodeArray.length; j < jl; ++j) {
57089
57229
  chainpairStr += chainidpairArray[parseInt(nodeArray[j])] + '; ';
57090
57230
  }
57091
- console.log("Selected the alignment: " + chainpairStr);
57231
+ if(!me.bNode) console.log("Selected the alignment: " + chainpairStr);
57092
57232
 
57093
57233
  break;
57094
57234
  }
@@ -57097,7 +57237,7 @@ class Vastplus {
57097
57237
  for(let j = 0, jl = nodeArray.length; j < jl; ++j) {
57098
57238
  chainpairStr += chainidpairArray[parseInt(nodeArray[j])] + '; ';
57099
57239
  }
57100
- console.log("skipped the alignment: " + chainpairStr);
57240
+ if(!me.bNode) console.log("skipped the alignment: " + chainpairStr);
57101
57241
  }
57102
57242
  }
57103
57243
  }
@@ -60482,6 +60622,10 @@ class LoadScript {
60482
60622
  me.cfg.refseqid = id;
60483
60623
  await ic.mmdbParserCls.downloadRefseq(id);
60484
60624
  }
60625
+ else if(command.indexOf('load protein') !== -1) {
60626
+ me.cfg.protein = id;
60627
+ await ic.mmdbParserCls.downloadProteinname(id);
60628
+ }
60485
60629
  else if(command.indexOf('load seq_struct_ids ') !== -1) {
60486
60630
  ic.bSmithwm = false;
60487
60631
  ic.bLocalSmithwm = false;
@@ -61577,6 +61721,8 @@ class Selection {
61577
61721
  ic.graphStr = this.getGraphDataForDisplayed();
61578
61722
  }
61579
61723
 
61724
+ ic.saveFileCls.showTitle();
61725
+
61580
61726
  // don not redraw graphs after the selection changes
61581
61727
  /*
61582
61728
  if(ic.bGraph) ic.drawGraphCls.drawGraph(ic.graphStr, ic.pre + 'dl_graph');
@@ -66816,7 +66962,7 @@ class ResizeCanvas {
66816
66962
  //let itemArray = ['dl_selectannotations', 'dl_alignment', 'dl_2ddgm', 'dl_definedsets', 'dl_graph',
66817
66963
  // 'dl_linegraph', 'dl_scatterplot', 'dl_contactmap', 'dl_allinteraction', 'dl_copyurl',
66818
66964
  // 'dl_symmetry', 'dl_symd', 'dl_rmsd', 'dl_legend', 'dl_disttable'];
66819
- let itemArray = ['dl_2ddgm', 'dl_2dctn', 'dl_alignment', 'dl_sequence2', 'dl_definedsets', 'dl_setsmenu', 'dl_command', 'dl_setoperations', 'dl_vast', 'dl_foldseek', 'dl_mmtfid', 'dl_pdbid', 'dl_afid', 'dl_opmid', 'dl_pdbfile', 'dl_pdbfile_app', 'dl_rescolorfile', 'dl_customcolor', 'dl_align', 'dl_alignaf', 'dl_chainalign', 'dl_chainalign2', 'dl_chainalign3', 'dl_mutation', 'dl_mol2file', 'dl_sdffile', 'dl_xyzfile', 'dl_afmapfile', 'dl_urlfile', 'dl_mmciffile', 'dl_mmcifid', 'dl_mmdbid', 'dl_mmdbafid', 'dl_blast_rep_id', 'dl_yournote', 'dl_gi', 'dl_refseqid', 'dl_cid', 'dl_pngimage', 'dl_state', 'dl_fixedversion', 'dl_selection', 'dl_dsn6', 'dl_dsn6url', 'dl_clr', 'dl_symmetry', 'dl_symd', 'dl_contact', 'dl_hbonds', 'dl_realign', 'dl_realignbystruct', 'dl_allinteracton', 'dl_interactionsorted', 'dl_linegraph', 'dl_linegraphcolor', 'dl_scatterplot', 'dl_scatterploitcolor', 'dl_contactmap', 'dl_alignerrormap', 'dl_elecmap2fofc', 'dl_elecmapfofc', 'dl_emmap', 'dl_aroundsphere', 'dl_adjustmem', 'dl_selectplane', 'dl_addlabel', 'dl_addlabelselection', 'dl_labelColor', 'dl_distance', 'dl_stabilizer', 'dl_disttwosets', 'dl_distmanysets', 'dl_stabilizer_rm', 'dl_thickness', 'dl_thickness2', 'dl_addtrack', 'dl_addtrack_tabs', 'dl_saveselection', 'dl_copyurl', 'dl_selectannotations', 'dl_annotations_tabs', 'dl_anno_view_tabs', 'dl_annotations', 'dl_graph', 'dl_svgcolor', 'dl_area', 'dl_colorbyarea', 'dl_rmsd', 'dl_buriedarea', 'dl_propbypercentout', 'dl_propbybfactor', 'dl_legend', 'dl_disttable'];
66965
+ let itemArray = ['dl_2ddgm', 'dl_2dctn', 'dl_alignment', 'dl_sequence2', 'dl_definedsets', 'dl_setsmenu', 'dl_command', 'dl_setoperations', 'dl_vast', 'dl_foldseek', 'dl_mmtfid', 'dl_pdbid', 'dl_afid', 'dl_opmid', 'dl_pdbfile', 'dl_pdbfile_app', 'dl_rescolorfile', 'dl_customcolor', 'dl_align', 'dl_alignaf', 'dl_chainalign', 'dl_chainalign2', 'dl_chainalign3', 'dl_mutation', 'dl_mol2file', 'dl_sdffile', 'dl_xyzfile', 'dl_afmapfile', 'dl_urlfile', 'dl_mmciffile', 'dl_mmcifid', 'dl_mmdbid', 'dl_mmdbafid', 'dl_blast_rep_id', 'dl_yournote', 'dl_proteinname', 'dl_refseqid', 'dl_cid', 'dl_pngimage', 'dl_state', 'dl_fixedversion', 'dl_selection', 'dl_dsn6', 'dl_dsn6url', 'dl_clr', 'dl_symmetry', 'dl_symd', 'dl_contact', 'dl_hbonds', 'dl_realign', 'dl_realignbystruct', 'dl_allinteracton', 'dl_interactionsorted', 'dl_linegraph', 'dl_linegraphcolor', 'dl_scatterplot', 'dl_scatterploitcolor', 'dl_contactmap', 'dl_alignerrormap', 'dl_elecmap2fofc', 'dl_elecmapfofc', 'dl_emmap', 'dl_aroundsphere', 'dl_adjustmem', 'dl_selectplane', 'dl_addlabel', 'dl_addlabelselection', 'dl_labelColor', 'dl_distance', 'dl_stabilizer', 'dl_disttwosets', 'dl_distmanysets', 'dl_stabilizer_rm', 'dl_thickness', 'dl_thickness2', 'dl_addtrack', 'dl_addtrack_tabs', 'dl_saveselection', 'dl_copyurl', 'dl_selectannotations', 'dl_annotations_tabs', 'dl_anno_view_tabs', 'dl_annotations', 'dl_graph', 'dl_svgcolor', 'dl_area', 'dl_colorbyarea', 'dl_rmsd', 'dl_buriedarea', 'dl_propbypercentout', 'dl_propbybfactor', 'dl_legend', 'dl_disttable'];
66820
66966
 
66821
66967
  for(let i in itemArray) {
66822
66968
  let item = itemArray[i];
@@ -67461,6 +67607,26 @@ class SaveFile {
67461
67607
  return html;
67462
67608
  }
67463
67609
 
67610
+ printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt) { let ic = this.icn3d; ic.icn3dui;
67611
+ let ssText = '';
67612
+
67613
+ // print prev
67614
+ if(prevRealSsObj) {
67615
+ if(bHelix) {
67616
+ let helixType = 1;
67617
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67618
+ + prevRealSsObj.resi.toString().padStart(5, ' ') + ' ' + helixType + ssCnt.toString().padStart(36, ' ') + '\n';
67619
+ }
67620
+ else if(bSheet) {
67621
+ let sense = 0;
67622
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67623
+ + prevRealSsObj.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
67624
+ }
67625
+ }
67626
+
67627
+ return ssText;
67628
+ }
67629
+
67464
67630
  //getAtomPDB: function(atomHash, bPqr, bPdb, bNoChem) { let ic = this.icn3d, me = ic.icn3dui;
67465
67631
  getAtomPDB(atomHash, bPqr, bNoChem, bNoHeader, chainResi2pdb, pdbid) { let ic = this.icn3d, me = ic.icn3dui;
67466
67632
  let pdbStr = '';
@@ -67493,8 +67659,6 @@ class SaveFile {
67493
67659
 
67494
67660
  let calphaHash = me.hashUtilsCls.intHash(atomHash, ic.calphas);
67495
67661
  let helixStr = 'HELIX', sheetStr = 'SHEET';
67496
- let bHelixBegin = false, bHelixEnd = true;
67497
- let bSheetBegin = false, bSheetEnd = true;
67498
67662
 
67499
67663
  let stru2header = {};
67500
67664
  for(let stru in ic.structures) {
@@ -67502,48 +67666,82 @@ class SaveFile {
67502
67666
  }
67503
67667
 
67504
67668
  // if(!bNoSs) {
67505
- let prevResi, stru, chainid;
67669
+ let prevResi, stru;
67670
+ let ssArray = [];
67506
67671
  for(let i in calphaHash) {
67507
67672
  let atom = ic.atoms[i];
67508
67673
  stru = atom.structure;
67509
- chainid = atom.structure + '_' + atom.chain;
67674
+ atom.structure + '_' + atom.chain;
67510
67675
 
67511
- if(atom.ssbegin) {
67512
- if(atom.ss == 'helix') {
67513
- bHelixBegin = true;
67514
- if(bHelixEnd) stru2header[stru] += helixStr.padEnd(15, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67515
- + atom.resi.toString().padStart(5, ' ');
67516
- bHelixEnd = false;
67517
- prevResi = atom.resi;
67518
- }
67519
- else if(atom.ss == 'sheet') {
67520
- bSheetBegin = true;
67521
- if(bSheetEnd) stru2header[stru] += sheetStr.padEnd(17, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67522
- + atom.resi.toString().padStart(4, ' ');
67523
- bSheetEnd = false;
67524
- }
67676
+ let ssObj = {};
67677
+ ssObj.chain = atom.chain;
67678
+ ssObj.resn = atom.resn;
67679
+ ssObj.resi = atom.resi;
67680
+
67681
+ if(parseInt(atom.resi) > parseInt(prevResi) + 1) {
67682
+ ssObj.ss = ' ';
67683
+ ssArray.push(ssObj);
67684
+ }
67685
+
67686
+ if(atom.ss == 'helix') {
67687
+ ssObj.ss = 'H';
67688
+ ssArray.push(ssObj);
67689
+ }
67690
+ else if(atom.ss == 'sheet') {
67691
+ ssObj.ss = 'S';
67692
+ ssArray.push(ssObj);
67525
67693
  }
67526
67694
 
67527
67695
  if(atom.ssend) {
67528
- if(atom.ss == 'helix') {
67529
- bHelixEnd = true;
67530
- let residEnd = ic.resid2ncbi[chainid + '_' + atom.resi];
67531
- let residStart = ic.resid2ncbi[chainid + '_' + prevResi];
67532
- let helixLen = (residEnd && residStart) ? parseInt(residEnd.substr(residEnd.lastIndexOf('_') + 1)) - parseInt(residStart.substr(residStart.lastIndexOf('_') + 1)) : 0;
67533
- let helixType = 1;
67534
- if(bHelixBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67535
- + atom.resi.toString().padStart(5, ' ') + ' ' + helixType + helixLen.toString().padStart(36, ' ') + '\n';
67536
- bHelixBegin = false;
67537
- }
67538
- else if(atom.ss == 'sheet') {
67539
- bSheetEnd = true;
67540
- let sense = 0;
67541
- if(bSheetBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67542
- + atom.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
67543
- bSheetBegin = false;
67696
+ let ssObj2 = me.hashUtilsCls.cloneHash(ssObj);
67697
+ ssObj2.ss = ' ';
67698
+ ssArray.push(ssObj2);
67699
+ }
67700
+
67701
+ prevResi = atom.resi;
67702
+ }
67703
+
67704
+ let prevSs, prevRealSsObj, ssCnt = 0, bHelix = false, bSheet = false;
67705
+ for(let i = 0, il = ssArray.length; i < il; ++i) {
67706
+ let ssObj = ssArray[i];
67707
+
67708
+ if(ssObj.ss != prevSs) {
67709
+ // print prev
67710
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
67711
+
67712
+ // print current
67713
+ ssCnt = 0;
67714
+ bHelix = false;
67715
+ bSheet = false;
67716
+ prevRealSsObj = undefined;
67717
+
67718
+ if(ssObj.ss != ' ') {
67719
+ if(ssObj.ss == 'H') {
67720
+ bHelix = true;
67721
+ prevRealSsObj = ssObj;
67722
+ stru2header[stru] += helixStr.padEnd(15, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67723
+ + ssObj.resi.toString().padStart(5, ' ');
67724
+ }
67725
+ else if(ssObj.ss == 'S') {
67726
+ bSheet = true;
67727
+ prevRealSsObj = ssObj;
67728
+ stru2header[stru] += sheetStr.padEnd(17, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
67729
+ + ssObj.resi.toString().padStart(4, ' ');
67730
+ }
67544
67731
  }
67545
67732
  }
67733
+
67734
+ if(ssObj.ss != ' ') {
67735
+ ++ssCnt;
67736
+ prevRealSsObj = ssObj;
67737
+ }
67738
+
67739
+ prevSs = ssObj.ss;
67546
67740
  }
67741
+
67742
+ // print prev
67743
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
67744
+
67547
67745
  // add a new line in case the structure is a subset
67548
67746
  stru2header[stru] += '\n';
67549
67747
  // }
@@ -67898,13 +68096,13 @@ class SaveFile {
67898
68096
 
67899
68097
  //Show the title and PDB ID of the PDB structure at the beginning of the viewer.
67900
68098
  showTitle() {var ic = this.icn3d, me = ic.icn3dui;
67901
- if(ic.molTitle !== undefined && ic.molTitle !== '') {
67902
- let title = ic.molTitle;
68099
+ // if(ic.molTitle !== undefined && ic.molTitle !== '') {
68100
+ let title = (ic.molTitle) ? ic.molTitle : '';
67903
68101
 
67904
68102
  let titlelinkColor =(ic.opts['background'] == 'black') ? me.htmlCls.GREYD : 'black';
67905
68103
 
67906
68104
  if(ic.inputid === undefined) {
67907
- if(ic.molTitle.length > 40) title = ic.molTitle.substr(0, 40) + "...";
68105
+ if(title.length > 40) title = title.substr(0, 40) + "...";
67908
68106
 
67909
68107
  $("#" + ic.pre + "title").html(title);
67910
68108
  }
@@ -67924,31 +68122,38 @@ class SaveFile {
67924
68122
 
67925
68123
  $("#" + ic.pre + "title").html(title);
67926
68124
  }
67927
- else if(me.cfg.mmdbafid !== undefined) {
67928
- let structureArray = Object.keys(ic.structures); //me.cfg.mmdbafid.split(',');
68125
+ else { //if(me.cfg.mmdbafid !== undefined) {
68126
+ //let structureArray = Object.keys(ic.structures); //me.cfg.mmdbafid.split(',');
68127
+ let structureArray = Object.keys(me.utilsCls.getStructures(ic.dAtoms));
68128
+
67929
68129
  if(structureArray.length > 1) {
67930
- title = 'Multiple structures: ' + structureArray;
68130
+ title = 'Multiple structures: ';
68131
+ for(let i = 0, il = structureArray.length; i < il; ++i) {
68132
+ let url = (isNaN(structureArray[i]) && structureArray[i].length > 5) ? 'https://alphafold.ebi.ac.uk/entry/' + structureArray[i] : 'https://www.ncbi.nlm.nih.gov/structure/?term=' + structureArray[i];
68133
+ title += '<a href="' + url + '" style="color:' + titlelinkColor + '" target="_blank">' + structureArray[i] + '</a>';
68134
+ if(i < il - 1) title += ', ';
68135
+ }
67931
68136
  $("#" + ic.pre + "title").html(title);
67932
68137
  }
67933
68138
  else if(structureArray.length == 1) {
67934
68139
  //let url = this.getLinkToStructureSummary();
67935
- let url = (isNaN(ic.inputid) && ic.inputid.length > 5) ? 'https://alphafold.ebi.ac.uk/entry/' + ic.inputid : 'https://www.ncbi.nlm.nih.gov/structure/?term=' + ic.inputid;
68140
+ let url = (isNaN(structureArray[0]) && structureArray[0].length > 5) ? 'https://alphafold.ebi.ac.uk/entry/' + structureArray[0] : 'https://www.ncbi.nlm.nih.gov/structure/?term=' + structureArray[0];
67936
68141
 
67937
68142
  this.setStructureTitle(url, title, titlelinkColor);
67938
68143
  }
67939
68144
  }
67940
- else {
67941
- let url = this.getLinkToStructureSummary();
67942
- this.setStructureTitle(url, title, titlelinkColor);
67943
- }
67944
- }
67945
- else {
67946
- $("#" + ic.pre + "title").html("");
67947
- }
68145
+ // else {
68146
+ // let url = this.getLinkToStructureSummary();
68147
+ // this.setStructureTitle(url, title, titlelinkColor);
68148
+ // }
68149
+ // }
68150
+ // else {
68151
+ // $("#" + ic.pre + "title").html("");
68152
+ // }
67948
68153
  }
67949
68154
 
67950
68155
  setStructureTitle(url, title, titlelinkColor) {var ic = this.icn3d, me = ic.icn3dui;
67951
- if(ic.molTitle.length > 40) title = ic.molTitle.substr(0, 40) + "...";
68156
+ if(title.length > 40) title = title.substr(0, 40) + "...";
67952
68157
 
67953
68158
  let inputid = ic.inputid;
67954
68159
 
@@ -67974,7 +68179,7 @@ class SaveFile {
67974
68179
  let structureidArray = Object.keys(idHash);
67975
68180
  inputid = structureidArray.join(',');
67976
68181
 
67977
- text = inputid.toUpperCase();
68182
+ text = (me.cfg.refseqid || me.cfg.protein) ? ic.inputid : inputid.toUpperCase();
67978
68183
 
67979
68184
  //idName = (isNaN(inputid) && inputid.length > 5) ? "AlphaFold ID" : "PDB ID";
67980
68185
  if(bPdb && bAlphaFold) {
@@ -68000,7 +68205,12 @@ class SaveFile {
68000
68205
  }
68001
68206
  }
68002
68207
 
68003
- if(me.cfg.refseqid) idName = 'NCBI Protein Acc.';
68208
+ if(me.cfg.refseqid) {
68209
+ idName = 'NCBI Protein Acc.';
68210
+ }
68211
+ else if(me.cfg.protein) {
68212
+ idName = 'Protein/Gene Name';
68213
+ }
68004
68214
 
68005
68215
  if(!inputid || inputid.substr(0, 4) == ic.defaultPdbId) {
68006
68216
  $("#" + ic.pre + "title").html(title);
@@ -71272,7 +71482,7 @@ class iCn3DUI {
71272
71482
  //even when multiple iCn3D viewers are shown together.
71273
71483
  this.pre = this.cfg.divid + "_";
71274
71484
 
71275
- this.REVISION = '3.26.0';
71485
+ this.REVISION = '3.27.0';
71276
71486
 
71277
71487
  // In nodejs, iCn3D defines "window = {navigator: {}}"
71278
71488
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -71464,6 +71674,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
71464
71674
  }
71465
71675
  else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
71466
71676
  let stru_t = Object.keys(ic.structures)[0];
71677
+
71467
71678
  let chain_t = stru_t + '_' + me.cfg.masterchain;
71468
71679
  let domainidArray = me.cfg.matchedchains.split(',');
71469
71680
  let chainidArray = [];
@@ -71564,6 +71775,14 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
71564
71775
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
71565
71776
  await ic.mmdbParserCls.downloadRefseq(me.cfg.refseqid);
71566
71777
  }
71778
+ else if(me.cfg.protein !== undefined) {
71779
+ ic.inputid = me.cfg.protein;
71780
+
71781
+ // ic.bNCBI = true;
71782
+ ic.loadCmd = 'load protein ' + me.cfg.protein;
71783
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
71784
+ await ic.mmdbParserCls.downloadProteinname(me.cfg.protein);
71785
+ }
71567
71786
  else if(me.cfg.blast_rep_id !== undefined) {
71568
71787
  // ic.bNCBI = true;
71569
71788
  ic.inputid = me.cfg.query_id + ',' + me.cfg.blast_rep_id;
@@ -71571,7 +71790,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
71571
71790
  me.cfg.oriQuery_id = me.cfg.query_id;
71572
71791
  me.cfg.oriBlast_rep_id = me.cfg.blast_rep_id;
71573
71792
 
71574
- // custom seqeunce has query_id such as "Query_78989" in BLAST
71793
+ // custom sequence has query_id such as "Query_78989" in BLAST
71575
71794
  if(me.cfg.query_id.substr(0,5) !== 'Query' && me.cfg.rid === undefined) {
71576
71795
  // make it backward compatible for figure 2 in iCn3D paper: https://academic.oup.com/bioinformatics/article/36/1/131/5520951
71577
71796
  if(me.cfg.from == 'icn3d' && me.cfg.blast_rep_id == '1TSR_A' && me.cfg.query_id == 'NP_001108451.1') {