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.module.js CHANGED
@@ -5357,23 +5357,23 @@ class ParasCls {
5357
5357
  //this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * ( + 0.81)/(1.14 + 0.81)),
5358
5358
  // hydrophobic
5359
5359
  // https://en.m.wikipedia.org/wiki/Hydrophobicity_scales#Wimley%E2%80%93White_whole_residue_hydrophobicity_scales
5360
- 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.85 + 1.85)/(0 + 1.85)),
5361
- 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.13 + 1.85)/(0 + 1.85)),
5362
- 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.94 + 1.85)/(0 + 1.85)),
5363
- 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.56 + 1.85)/(0 + 1.85)),
5364
- 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.31 + 1.85)/(0 + 1.85)),
5365
- 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.24 + 1.85)/(0 + 1.85)),
5366
- 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.23 + 1.85)/(0 + 1.85)),
5360
+ 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-2.09 + 2.09) / (0 + 2.09)),
5361
+ 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.71 + 2.09) / (0 + 2.09)),
5362
+ 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.25 + 2.09) / (0 + 2.09)),
5363
+ 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.12 + 2.09) / (0 + 2.09)),
5364
+ 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.71 + 2.09) / (0 + 2.09)),
5365
+ 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.67 + 2.09) / (0 + 2.09)),
5366
+ 'VAL': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.46 + 2.09) / (0 + 2.09)),
5367
+ 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.02 + 2.09) / (0 + 2.09)),
5367
5368
 
5368
5369
  // polar
5369
- 'GLY': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.01 + 0.58)/(0 + 0.58)),
5370
- 'VAL': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.07 + 0.58)/(0 + 0.58)),
5371
- 'SER': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.13 + 0.58)/(0 + 0.58)),
5372
- 'THR': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.14 + 0.58)/(0 + 0.58)),
5373
- 'ALA': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.17 + 0.58)/(0 + 0.58)),
5374
- 'ASN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.42 + 0.58)/(0 + 0.58)),
5375
- 'PRO': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.45 + 0.58)/(0 + 0.58)),
5376
- 'GLN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.58 + 0.58)/(0 + 0.58))
5370
+ 'PRO': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.14 + 1.15) / (0 + 1.15)),
5371
+ 'THR': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.25 + 1.15) / (0 + 1.15)),
5372
+ 'SER': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.46 + 1.15) / (0 + 1.15)),
5373
+ 'ALA': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.50 + 1.15) / (0 + 1.15)),
5374
+ 'GLN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.77 + 1.15) / (0 + 1.15)),
5375
+ 'ASN': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-0.85 + 1.15) / (0 + 1.15)),
5376
+ 'GLY': this.thr().setHSL(1/6.0, 1, 0.5 + 0.5 * (-1.15 + 1.15) / (0 + 1.15))
5377
5377
  };
5378
5378
 
5379
5379
  this.normalizedHPColors = {
@@ -5391,59 +5391,58 @@ class ParasCls {
5391
5391
  //this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * ( + 0.81)/(1.14 + 0.81)),
5392
5392
  // hydrophobic
5393
5393
  // https://en.m.wikipedia.org/wiki/Hydrophobicity_scales#Wimley%E2%80%93White_whole_residue_hydrophobicity_scales
5394
- // 0.65 ~ -1.85: white ~ green
5395
- 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.85 + 1.85)/2.5),
5396
- 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.13 + 1.85)/2.5),
5397
- 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.94 + 1.85)/2.5),
5398
- 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.56 + 1.85)/2.5),
5399
- 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.31 + 1.85)/2.5),
5400
- 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.24 + 1.85)/2.5),
5401
- 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.23 + 1.85)/2.5),
5394
+ // 1.15 ~ -2.09: white ~ green
5395
+ 'TRP': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-2.09 + 2.09) / 3.24),
5396
+ 'PHE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.71 + 2.09) / 3.24),
5397
+ 'LEU': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.25 + 2.09) / 3.24),
5398
+ 'ILE': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-1.12 + 2.09) / 3.24),
5399
+ 'TYR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.71 + 2.09) / 3.24),
5400
+ 'MET': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.67 + 2.09) / 3.24),
5401
+ 'VAL': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.46 + 2.09) / 3.24),
5402
+ 'CYS': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (-0.02 + 2.09) / 3.24),
5402
5403
 
5403
5404
  // polar
5404
- 'GLY': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.01 + 1.85)/2.5),
5405
- 'VAL': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.07 + 1.85)/2.5),
5406
- 'SER': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.13 + 1.85)/2.5),
5407
- 'THR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.14 + 1.85)/2.5),
5408
- 'ALA': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.17 + 1.85)/2.5),
5409
- 'ASN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.42 + 1.85)/2.5),
5410
- 'PRO': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.45 + 1.85)/2.5),
5411
- 'GLN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.58 + 1.85)/2.5)
5405
+ 'PRO': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.14 + 2.09) / 3.24),
5406
+ 'THR': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.25 + 2.09) / 3.24),
5407
+ 'SER': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.46 + 2.09) / 3.24),
5408
+ 'ALA': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.50 + 2.09) / 3.24),
5409
+ 'GLN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.77 + 2.09) / 3.24),
5410
+ 'ASN': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (0.85 + 2.09) / 3.24),
5411
+ 'GLY': this.thr().setHSL(1/3.0, 1, 0.5 + 0.5 * (1.15 + 2.09) / 3.24)
5412
5412
  };
5413
5413
 
5414
5414
  this.hydrophobicValues = {
5415
- // charged residues
5415
+ // charged residues, larger than max polar (1.15)
5416
5416
  ' G': 3, ' A': 3, ' T': 3,
5417
5417
  ' C': 3, ' U': 3, ' DG': 3,
5418
5418
  ' DA': 3, ' DT': 3, ' DC': 3,
5419
5419
  ' DU': 3, 'G': 3, 'A': 3,
5420
5420
  'T': 3, 'C': 3, 'U': 3,
5421
5421
  'DG': 3, 'DA': 3, 'DT': 3,
5422
- 'DC': 3, 'DU': 3, 'ARG': 1,
5423
- 'LYS': 1, 'ASP': 3, 'GLU': 3,
5422
+ 'DC': 3, 'DU': 3, 'ARG': 1.5,
5423
+ 'LYS': 1.5, 'ASP': 3, 'GLU': 3,
5424
5424
  'HIS': 2,
5425
5425
 
5426
- // + 0.81)/(1.14 + 0.81)),
5427
5426
  // hydrophobic
5428
5427
  // https://en.m.wikipedia.org/wiki/Hydrophobicity_scales#Wimley%E2%80%93White_whole_residue_hydrophobicity_scales
5429
- // 0.65 ~ -1.85: white ~ green
5430
- 'TRP': -1.85,
5431
- 'PHE': -1.13,
5432
- 'TYR': -0.94,
5433
- 'LEU': -0.56,
5434
- 'ILE': -0.31,
5435
- 'CYS': -0.24,
5436
- 'MET': -0.23,
5428
+ // 1.15 ~ -2.09: white ~ green
5429
+ 'TRP': -2.09,
5430
+ 'PHE': -1.71,
5431
+ 'LEU': -1.25,
5432
+ 'ILE': -1.12,
5433
+ 'TYR': -0.71,
5434
+ 'MET': -0.67,
5435
+ 'VAL': -0.46,
5436
+ 'CYS': -0.02,
5437
5437
 
5438
5438
  // polar
5439
- 'GLY': 0.01,
5440
- 'VAL': 0.07,
5441
- 'SER': 0.13,
5442
- 'THR': 0.14,
5443
- 'ALA': 0.17,
5444
- 'ASN': 0.42,
5445
- 'PRO': 0.45,
5446
- 'GLN': 0.58
5439
+ 'PRO': 0.14,
5440
+ 'THR': 0.25,
5441
+ 'SER': 0.46,
5442
+ 'ALA': 0.50,
5443
+ 'GLN': 0.77,
5444
+ 'ASN': 0.85,
5445
+ 'GLY': 1.15
5447
5446
  };
5448
5447
 
5449
5448
  this.residueAbbrev = {
@@ -6829,8 +6828,8 @@ class ClickMenu {
6829
6828
  me.htmlCls.dialogCls.openDlg('dl_esmfold', 'Sequence to structure prediction with ESMFold');
6830
6829
  });
6831
6830
 
6832
- me.myEventCls.onIds("#" + me.pre + "mn1_gi", "click", function(e) { me.icn3d; //e.preventDefault();
6833
- me.htmlCls.dialogCls.openDlg('dl_gi', 'Please input protein gi');
6831
+ me.myEventCls.onIds("#" + me.pre + "mn1_proteinname", "click", function(e) { me.icn3d; //e.preventDefault();
6832
+ me.htmlCls.dialogCls.openDlg('dl_proteinname', 'Please input protein or gene name');
6834
6833
  });
6835
6834
 
6836
6835
  me.myEventCls.onIds("#" + me.pre + "mn1_cid", "click", function(e) { me.icn3d; //e.preventDefault();
@@ -6932,17 +6931,17 @@ class ClickMenu {
6932
6931
  thisClass.setLogCmd("export pdb hydrogen", true);
6933
6932
  });
6934
6933
 
6935
- me.myEventCls.onIds("#" + me.pre + "m1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6934
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportIgstrand", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6936
6935
  ic.refnumCls.exportRefnum('igstrand');
6937
6936
  thisClass.setLogCmd("export refnum igstrand", true);
6938
6937
  });
6939
6938
 
6940
- me.myEventCls.onIds("#" + me.pre + "m1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6939
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportKabat", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6941
6940
  ic.refnumCls.exportRefnum('kabat');
6942
6941
  thisClass.setLogCmd("export refnum kabat", true);
6943
6942
  });
6944
6943
 
6945
- me.myEventCls.onIds("#" + me.pre + "m1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6944
+ me.myEventCls.onIds("#" + me.pre + "mn1_exportImgt", "click", async function(e) { let ic = me.icn3d; //e.preventDefault();
6946
6945
  ic.refnumCls.exportRefnum('imgt');
6947
6946
  thisClass.setLogCmd("export refnum imgt", true);
6948
6947
  });
@@ -9355,10 +9354,16 @@ class SetMenu {
9355
9354
  let html = "";
9356
9355
 
9357
9356
  html += "<ul class='icn3d-mn-item'>";
9358
- //html += "<li><a href='https://www.ncbi.nlm.nih.gov/structure' target='_blank'>Search Structure " + me.htmlCls.wifiStr + "</a></li>";
9359
- html += this.getMenuUrl('mn1_searchstru', "https://www.ncbi.nlm.nih.gov/structure", "Search Structure " + me.htmlCls.wifiStr, 1, 1);
9357
+
9358
+ html += this.getMenuText('mn1_searchgrooup', 'Search Structure ' + me.htmlCls.wifiStr, undefined, 1, 1);
9359
+ html += "<ul>";
9360
+ html += this.getMenuUrl('mn1_searchstru', 'https://www.ncbi.nlm.nih.gov/structure', 'PDB Structures ' + me.htmlCls.wifiStr, undefined, 2);
9361
+ html += this.getLink('mn1_proteinname', 'AlphaFold Structures ' + me.htmlCls.wifiStr, undefined, 2);
9362
+ html += this.getMenuUrl('mn1_afdatabase', 'https://alphafold.ebi.ac.uk', 'AlphaFold UniProt Database ' + me.htmlCls.wifiStr, undefined, 2);
9363
+ html += "</ul>";
9364
+ html += "</li>";
9360
9365
 
9361
- html += this.getMenuText('mn1_searchsimilar', 'Search Similar', undefined, undefined, 1);
9366
+ html += this.getMenuText('mn1_searchsimilar', 'Search Similar' + me.htmlCls.wifiStr, undefined, undefined, 1);
9362
9367
  html += "<ul>";
9363
9368
  html += this.getLink('mn1_vastplus', 'NCBI VAST+ (PDB Complex)' + me.htmlCls.wifiStr, undefined, 2);
9364
9369
  html += this.getLink('mn1_vast', 'NCBI VAST (PDB Chain)' + me.htmlCls.wifiStr, undefined, 2);
@@ -9379,7 +9384,6 @@ class SetMenu {
9379
9384
 
9380
9385
  html += this.getLink('mn1_afid', 'UniProt ID ' + me.htmlCls.wifiStr, undefined, 3);
9381
9386
  html += this.getLink('mn1_refseqid', 'NCBI Protein Accession ' + me.htmlCls.wifiStr, undefined, 3);
9382
- // html += this.getLink('mn1_proteinname', 'Protein Name ' + me.htmlCls.wifiStr, undefined, 3);
9383
9387
  html += "</ul>";
9384
9388
 
9385
9389
 
@@ -9421,10 +9425,11 @@ class SetMenu {
9421
9425
  html += "</ul>";
9422
9426
  html += "</li>";
9423
9427
 
9424
- html += this.getMenuText('mn1_fold', 'AlphaFold/ESM', undefined, undefined, 1);
9428
+ //html += this.getMenuText('mn1_fold', 'AlphaFold/ESM', undefined, undefined, 1);
9429
+ html += this.getMenuText('mn1_fold', 'Predict by Seq.', undefined, undefined, 1);
9425
9430
  html += "<ul>";
9426
- html += this.getLink('mn1_alphafold', 'AlphaFold2 via ColabFold', undefined, 2);
9427
9431
  html += this.getLink('mn1_esmfold', 'ESMFold', undefined, 2);
9432
+ html += this.getLink('mn1_alphafold', 'AlphaFold2 via ColabFold', undefined, 2);
9428
9433
  html += "</ul>";
9429
9434
 
9430
9435
 
@@ -11242,6 +11247,9 @@ class Dialog {
11242
11247
  if(me.cfg.align) {
11243
11248
  position ={ my: "left top", at: "left top+90", of: "#" + me.pre + "canvas", collision: "none" };
11244
11249
  }
11250
+ else if(id === me.pre + 'dl_mmdbafid') {
11251
+ position ={ my: "left top", at: "left top+130", of: "#" + me.pre + "canvas", collision: "none" };
11252
+ }
11245
11253
  else {
11246
11254
  position ={ my: "left top", at: "left top+50", of: "#" + me.pre + "canvas", collision: "none" };
11247
11255
  }
@@ -11775,7 +11783,7 @@ class SetDialog {
11775
11783
 
11776
11784
  html += me.htmlCls.divStr + "dl_esmfold' style='max-width:600px;' class='" + dialogClass + "'>";
11777
11785
  html += this.addNotebookTitle('dl_esmfold', 'Sequence to structure prediction with ESMFold');
11778
- 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> ";
11786
+ 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> ";
11779
11787
  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>";
11780
11788
  html += me.htmlCls.buttonStr + "run_esmfold'>ESMFold</button> ";
11781
11789
  html += "</div>";
@@ -11787,10 +11795,10 @@ class SetDialog {
11787
11795
  html += me.htmlCls.buttonStr + "applyyournote'>Save</button>";
11788
11796
  html += "</div>";
11789
11797
 
11790
- html += me.htmlCls.divStr + "dl_gi' class='" + dialogClass + "'>";
11791
- html += this.addNotebookTitle('dl_gi', 'Please input an NCBI gi');
11792
- html += "Protein gi: " + me.htmlCls.inputTextStr + "id='" + me.pre + "gi' value='1310960' size=8> ";
11793
- html += me.htmlCls.buttonStr + "reload_gi'>Load</button>";
11798
+ html += me.htmlCls.divStr + "dl_proteinname' class='" + dialogClass + "'>";
11799
+ html += this.addNotebookTitle('dl_proteinname', 'Please input a protein/gene name');
11800
+ html += "Protein/Gene name: " + me.htmlCls.inputTextStr + "id='" + me.pre + "proteinname' value='TP53' size=8> ";
11801
+ html += me.htmlCls.buttonStr + "reload_proteinname'>Search</button>";
11794
11802
  html += "</div>";
11795
11803
 
11796
11804
  html += me.htmlCls.divStr + "dl_cid' class='" + dialogClass + "'>";
@@ -13780,12 +13788,19 @@ class Events {
13780
13788
  }
13781
13789
 
13782
13790
  let esmfold_fasta = $("#" + me.pre + "esmfold_fasta").val();
13783
- let pdbid;
13791
+ let pdbid = 'stru--';
13784
13792
 
13785
13793
  if(esmfold_fasta.indexOf('>') != -1) { //FASTA with header
13786
13794
  let pos = esmfold_fasta.indexOf('\n');
13787
13795
  ic.esmTitle = esmfold_fasta.substr(1, pos - 1).trim();
13788
- pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
13796
+ if(ic.esmTitle.indexOf('|') != -1) { // uniprot
13797
+ let idArray = ic.esmTitle.split('|');
13798
+ pdbid = (idArray.length > 2) ? idArray[1] : ic.esmTitle;
13799
+ }
13800
+ else { // NCBI
13801
+ pdbid = (ic.esmTitle.indexOf(' ') != -1) ? ic.esmTitle.substr(0, ic.esmTitle.indexOf(' ')) : ic.esmTitle;
13802
+ }
13803
+
13789
13804
  if(pdbid.length < 6) pdbid = pdbid.padEnd(6, '-');
13790
13805
 
13791
13806
  esmfold_fasta = esmfold_fasta.substr(pos + 1);
@@ -13794,8 +13809,8 @@ class Events {
13794
13809
  // remove new lines
13795
13810
  esmfold_fasta = esmfold_fasta.replace(/\s/g, '');
13796
13811
 
13797
- if(esmfold_fasta.length > 1024) {
13798
- alert("Your seqeunce is larger than 1024 characters. Please consider to split it as described at https://github.com/facebookresearch/esm/issues/21.");
13812
+ if(esmfold_fasta.length > 400) {
13813
+ alert("Your sequence is larger than 400 characters. Please consider to split it as described at https://github.com/facebookresearch/esm/issues/21.");
13799
13814
  return;
13800
13815
  }
13801
13816
 
@@ -13804,6 +13819,11 @@ class Events {
13804
13819
  thisClass.setLogCmd("Run ESMFold with the sequence " + esmfold_fasta, false);
13805
13820
 
13806
13821
  let esmData = await me.getAjaxPostPromise(esmUrl, esmfold_fasta, true, alertMess, undefined, true, 'text');
13822
+
13823
+ ic.bInputfile = true;
13824
+ ic.InputfileType = 'pdb';
13825
+ ic.InputfileData = (ic.InputfileData) ? ic.InputfileData + '\nENDMDL\n' + esmData : esmData;
13826
+
13807
13827
  ic.bEsmfold = true;
13808
13828
  let bAppend = true;
13809
13829
  await ic.pdbParserCls.loadPdbData(esmData, pdbid, undefined, bAppend, undefined, undefined, undefined, ic.bEsmfold);
@@ -13842,12 +13862,12 @@ class Events {
13842
13862
  });
13843
13863
 
13844
13864
 
13845
- me.myEventCls.onIds("#" + me.pre + "reload_gi", "click", function(e) { let ic = me.icn3d;
13865
+ me.myEventCls.onIds("#" + me.pre + "reload_proteinname", "click", function(e) { let ic = me.icn3d;
13846
13866
  e.preventDefault();
13847
13867
  if(!me.cfg.notebook) dialog.dialog( "close" );
13848
- thisClass.setLogCmd("load gi " + $("#" + me.pre + "gi").val(), false);
13868
+ thisClass.setLogCmd("load protein " + $("#" + me.pre + "proteinname").val(), false);
13849
13869
  let urlTarget = (ic.structures && Object.keys(ic.structures).length > 0) ? '_blank' : '_self';
13850
- window.open(hostUrl + '?gi=' + $("#" + me.pre + "gi").val(), urlTarget);
13870
+ window.open(hostUrl + '?protein=' + $("#" + me.pre + "proteinname").val(), urlTarget);
13851
13871
  });
13852
13872
 
13853
13873
  me.myEventCls.onIds("#" + me.pre + "reload_refseq", "click", function(e) { let ic = me.icn3d;
@@ -15429,8 +15449,17 @@ class AlignSeq {
15429
15449
 
15430
15450
  let chainHash = {};
15431
15451
  if (alignChainArray !== undefined) {
15452
+
15432
15453
  for (let i = 0, il = alignChainArray.length; i < il; ++i) {
15433
- chainHash[alignChainArray[i]] = 1;
15454
+ let chainid = alignChainArray[i];
15455
+
15456
+ // make sure some residues are aligned
15457
+ if(ic.alnChainsSeq[chainid] && ic.alnChainsSeq[chainid].length > 0) {
15458
+ chainHash[chainid] = 1;
15459
+ }
15460
+ else {
15461
+ return { "sequencesHtml": sequencesHtml, "maxSeqCnt": maxSeqCnt };
15462
+ }
15434
15463
  }
15435
15464
  }
15436
15465
 
@@ -15445,7 +15474,7 @@ class AlignSeq {
15445
15474
  let bHighlightChain;
15446
15475
  let index = 0, prevResCnt2nd = 0;
15447
15476
  let firstChainid, oriChainid;
15448
-
15477
+ console.log("alignChainArray.length: " + alignChainArray.length);
15449
15478
  // for(let i in ic.alnChains) {
15450
15479
  for (let m = 0, ml = alignChainArray.length; m < ml; ++m) {
15451
15480
  let i = alignChainArray[m];
@@ -15622,7 +15651,7 @@ class AlignSeq {
15622
15651
  //sequencesHtml += "<div class='icn3d-residueLine' style='white-space:nowrap;'><div class='icn3d-seqTitle' chain='" + i + "' anno='" + j + "'>" + annotitle + "</div>" + resiHtmlArray[j] + "<br/></div>";
15623
15652
  sequencesHtml += "<div class='icn3d-residueLine' style='white-space:nowrap;'><div class='icn3d-seqTitle' anno='" + j + "'>" + annotitle + "</div>" + resiHtmlArray[j] + "<br/></div>";
15624
15653
  }
15625
-
15654
+
15626
15655
  sequencesHtml += '<div class="icn3d-seqTitle icn3d-link icn3d-blue" chain="' + i + '" anno="sequence" title="' + title + '">' + chainidTmp + ' </div><span class="icn3d-seqLine">' + seqHtml + '</span><br/>';
15627
15656
 
15628
15657
  if (index > 0) prevResCnt2nd += seqLength;
@@ -36461,13 +36490,13 @@ class SetOption {
36461
36490
  html += "<div>";
36462
36491
 
36463
36492
  if(colorType == 'normalized hydrophobic') {
36464
- html += "Dark green (W, F, Y, L, I, C, M): Hydrophobic<br>";
36465
- html += "Light green (G, V, S, T, A, N, P, Q): Polar<br>";
36493
+ html += "Dark green (W, F, L, I, Y, M, V, C): Hydrophobic<br>";
36494
+ html += "Light green (P, T, S, A, Q, N, G): Polar<br>";
36466
36495
  html += "Grey: Charged, not hydrophobic<br><br>";
36467
36496
  }
36468
36497
  else {
36469
- html += "Green (W, F, Y, L, I, C, M): Hydrophobic<br>";
36470
- html += "Yellow (G, V, S, T, A, N, P, Q): Polar<br>";
36498
+ html += "Green (W, F, L, I, Y, M, V, C): Hydrophobic<br>";
36499
+ html += "Yellow (P, T, S, A, Q, N, G): Polar<br>";
36471
36500
  html += "Red: Negatively Charged<br>";
36472
36501
  html += "Blue: Positively Charged<br><br>";
36473
36502
  }
@@ -40026,7 +40055,7 @@ class Domain3d {
40026
40055
  return {subdomains: subdomains, substruct: substruct, pos2resi: pos2resi };
40027
40056
  } // end c2b_NewSplitChain
40028
40057
 
40029
- getDomainJsonForAlign(atoms) { let ic = this.icn3d, me = ic.icn3dui;
40058
+ getDomainJsonForAlign(atoms, bForceOneDomain) { let ic = this.icn3d, me = ic.icn3dui;
40030
40059
  let result = this.c2b_NewSplitChain(atoms);
40031
40060
 
40032
40061
  let subdomains = result.subdomains;
@@ -40037,6 +40066,8 @@ class Domain3d {
40037
40066
  let residueArray = Object.keys(residueHash);
40038
40067
  let chnid = residueArray[0].substr(0, residueArray[0].lastIndexOf('_'));
40039
40068
 
40069
+ if(bForceOneDomain) subdomains = [];
40070
+
40040
40071
  //the whole structure is also considered as a large domain
40041
40072
  //if(subdomains.length == 0) {
40042
40073
  //subdomains.push([parseInt(ic.chainsSeq[chnid][0].resi), parseInt(ic.chainsSeq[chnid][ic.chainsSeq[chnid].length - 1].resi)]);
@@ -41894,7 +41925,7 @@ class ShowAnno {
41894
41925
  dataObj['targets'] = me.cfg.blast_rep_id + ':' + target_from_to_array.join(':');
41895
41926
  }
41896
41927
 
41897
- // get seqeunce
41928
+ // get sequence
41898
41929
  if(ic.blastAcxn) {
41899
41930
  let chainid = me.cfg.afid + '_A';
41900
41931
  let seq = '';
@@ -41925,7 +41956,7 @@ class ShowAnno {
41925
41956
  idArray.push(me.cfg.query_id);
41926
41957
  }
41927
41958
 
41928
- // get seqeunce
41959
+ // get sequence
41929
41960
  if(ic.blastAcxn) {
41930
41961
  let chainid = me.cfg.afid + '_A';
41931
41962
  let seq = '';
@@ -42252,7 +42283,7 @@ class ShowAnno {
42252
42283
  let data = ic.seqStructAlignData;
42253
42284
  if(data.data !== undefined) {
42254
42285
  query = data.data[0].query;
42255
- // if target is seqeunce, the key is not chnid
42286
+ // if target is sequence, the key is not chnid
42256
42287
  //target = data.data[0].targets[chnid];
42257
42288
  let keys = Object.keys(data.data[0].targets);
42258
42289
  target = data.data[0].targets[keys[0]];
@@ -42264,7 +42295,7 @@ class ShowAnno {
42264
42295
  evalue = target.scores.e_value.toPrecision(2);
42265
42296
  if(evalue > 1e-200) evalue = parseFloat(evalue).toExponential();
42266
42297
  target.scores.bit_score;
42267
- // if target is seqeunce, the key is not chnid
42298
+ // if target is sequence, the key is not chnid
42268
42299
  // targetSeq = data.targets[chnid].seqdata;
42269
42300
  let keys = Object.keys(data.targets);
42270
42301
  targetSeq = data.targets[keys[0]].seqdata;
@@ -43708,7 +43739,7 @@ class HlSeq {
43708
43739
  //});
43709
43740
 
43710
43741
  // remove possible text selection
43711
- // the following code caused the scroll of seqeunce window to the top, remove it for now
43742
+ // the following code caused the scroll of sequence window to the top, remove it for now
43712
43743
  /*
43713
43744
  if(window.getSelection) {
43714
43745
  if(window.getSelection().empty) { // Chrome
@@ -45296,26 +45327,22 @@ class LineGraph {
45296
45327
 
45297
45328
  let pdbAjaxArray = [];
45298
45329
  for(let k = 0, kl = ic.refpdbArray.length; k < kl; ++k) {
45299
- //let urlpdb = me.htmlCls.baseUrl + "icn3d/refpdb/" + ic.refpdbArray[k] + ".pdb";
45300
- let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + ic.refpdbArray[k];
45330
+ //let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refpdbid=" + ic.refpdbArray[k];
45331
+ let urlpdb = me.htmlCls.baseUrl + "mmcifparser/mmcifparser.cgi?refjsonid=" + ic.refpdbArray[k];
45301
45332
 
45302
45333
  let pdbAjax = me.getAjaxPromise(urlpdb, 'text');
45303
45334
 
45304
45335
  pdbAjaxArray.push(pdbAjax);
45305
45336
  }
45306
45337
 
45307
- try {
45338
+ // try {
45308
45339
  let allPromise = Promise.allSettled(pdbAjaxArray);
45309
45340
  ic.pdbDataArray = await allPromise;
45310
45341
  await thisClass.parseRefPdbData(ic.pdbDataArray);
45311
- }
45312
- catch(err) {
45313
- if(!me.bNode) alert("Error in retrieveing reference PDB data...");
45314
- //alert("Error in retrieveing reference PDB data...");
45315
- return;
45316
- }
45317
-
45318
45342
  // }
45343
+ // catch(err) {
45344
+ // if(!me.bNode) alert("Error in retrieveing reference PDB data...");
45345
+ // return;
45319
45346
  // }
45320
45347
  }
45321
45348
 
@@ -45327,7 +45354,8 @@ class LineGraph {
45327
45354
  let ajaxArray = [];
45328
45355
  let domainidpairArray = [];
45329
45356
 
45330
- let urltmalign = me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
45357
+ me.htmlCls.baseUrl + "tmalign/tmalign.cgi";
45358
+ let urlalign = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi";
45331
45359
 
45332
45360
  if(!ic.resid2domainid) ic.resid2domainid = {};
45333
45361
  //ic.resid2domainid = {};
@@ -45407,6 +45435,9 @@ class LineGraph {
45407
45435
 
45408
45436
  for(let k = 0, kl = domainAtomsArray.length; k < kl; ++k) {
45409
45437
  let pdb_target = ic.saveFileCls.getAtomPDB(domainAtomsArray[k], undefined, undefined, undefined, undefined, struct);
45438
+ let bForceOneDomain = true;
45439
+ let jsonStr_t = ic.domain3dCls.getDomainJsonForAlign(domainAtomsArray[k], bForceOneDomain);
45440
+
45410
45441
  // ig strand for any subset will have the same k, use the number of residue to separate them
45411
45442
  let atomFirst = ic.firstAtomObjCls.getFirstAtomObj(domainAtomsArray[k]);
45412
45443
  let atomLast = ic.firstAtomObjCls.getLastAtomObj(domainAtomsArray[k]);
@@ -45416,14 +45447,19 @@ class LineGraph {
45416
45447
  ic.domainid2pdb[domainid] = pdb_target;
45417
45448
 
45418
45449
  for(let index = 0, indexl = dataArray.length; index < indexl; ++index) {
45419
- let struct2 = ic.defaultPdbId + index;
45420
- //let pdb_query = (me.bNode) ? dataArray[index] : dataArray[index].value; //[0];
45421
- let pdb_query = dataArray[index].value; //[0];
45422
- let header = 'HEADER ' + struct2 + '\n';
45423
- pdb_query = header + pdb_query;
45424
-
45425
- let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
45426
- let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
45450
+ // let struct2 = ic.defaultPdbId + index;
45451
+ // let pdb_query = dataArray[index].value; //[0];
45452
+ // let header = 'HEADER ' + struct2 + '\n';
45453
+ // pdb_query = header + pdb_query;
45454
+ let jsonStr_q = dataArray[index].value; //[0];
45455
+
45456
+ // TM-align is not good when you align a full structure with the strand-only structure. VAST is better in this case.
45457
+ // let dataObj = {'pdb_query': pdb_query, 'pdb_target': pdb_target, "queryid": ic.refpdbArray[index]};
45458
+ // let alignAjax = me.getAjaxPostPromise(urltmalign, dataObj);
45459
+
45460
+ let dataObj = {'domains1': jsonStr_q, 'domains2': jsonStr_t};
45461
+ let alignAjax = me.getAjaxPostPromise(urlalign, dataObj);
45462
+
45427
45463
  ajaxArray.push(alignAjax);
45428
45464
 
45429
45465
  domainidpairArray.push(domainid + "|" + ic.refpdbArray[index]);
@@ -45438,8 +45474,8 @@ class LineGraph {
45438
45474
  // let allPromise = Promise.allSettled(ajaxArray);
45439
45475
  // dataArray2 = await allPromise;
45440
45476
 
45441
- //split arrays into chunks of 100 jobs
45442
- let n = (me.bNode) ? 96 : 96;
45477
+ //split arrays into chunks of 96 jobs or me.cfg.maxajax jobs
45478
+ let n = (me.cfg.maxajax) ? me.cfg.maxajax : 96;
45443
45479
 
45444
45480
  for(let i = 0, il = parseInt((ajaxArray.length - 1) / n + 1); i < il; ++i) {
45445
45481
  let currAjaxArray = [];
@@ -45502,6 +45538,7 @@ class LineGraph {
45502
45538
  let thisClass = this;
45503
45539
 
45504
45540
  let tmscoreThreshold = 0.4; // 0.4; //0.5;
45541
+ let rmsdThreshold = 10;
45505
45542
 
45506
45543
  // find the best alignment for each chain
45507
45544
  let domainid2score = {}, domainid2segs = {}, chainid2segs = {};
@@ -45529,8 +45566,15 @@ class LineGraph {
45529
45566
 
45530
45567
  if(queryData.length == 0) continue;
45531
45568
 
45532
- if(queryData[0].score < tmscoreThreshold || queryData[0].num_res < minResidues) {
45533
- continue;
45569
+ if(!bRound1) {
45570
+ if(queryData[0].score < tmscoreThreshold || queryData[0].num_res < minResidues) {
45571
+ continue;
45572
+ }
45573
+ }
45574
+ else {
45575
+ if(queryData[0].super_rmsd > rmsdThreshold || queryData[0].num_res < minResidues) {
45576
+ continue;
45577
+ }
45534
45578
  }
45535
45579
 
45536
45580
  //let domainid_index = domainidpairArray[i].split(',');
@@ -45539,42 +45583,63 @@ class LineGraph {
45539
45583
  let refpdbname = domainidpairArray[i].substr(domainidpairArray[i].indexOf('|') + 1);
45540
45584
  //let chainid = domainid.split('-')[0];
45541
45585
 
45586
+ if(!bRound1) {
45587
+ if(!me.bNode) console.log("refpdbname " + refpdbname + " TM-score: " + queryData[0].score);
45588
+ }
45589
+ else {
45590
+ if(!me.bNode) console.log("refpdbname " + refpdbname + " RMSD: " + queryData[0].super_rmsd);
45591
+ }
45592
+
45542
45593
  // Ig-like domains: B (2150, 2150a, 2150b), C (3150, 3250), E (7150, 7250), F (8150, 8250) strands
45543
45594
  // Ig domain may require G (7050). But we'll leave that out for now.
45544
- let bBstrand = false, bCstrand = false, bEstrand = false, bFstrand = false;
45545
- for(let i = 0, il = queryData[0].segs.length; i < il; ++i) {
45546
- let seg = queryData[0].segs[i];
45595
+ if(!bRound1) {
45596
+ let bBstrand = false, bCstrand = false, bEstrand = false, bFstrand = false;
45597
+ for(let i = 0, il = queryData[0].segs.length; i < il; ++i) {
45598
+ let seg = queryData[0].segs[i];
45547
45599
 
45548
- if(seg.q_start.indexOf('2150') != -1 || seg.q_start.indexOf('2250') != -1) {
45549
- bBstrand = true;
45550
- }
45551
- else if(seg.q_start.indexOf('3150') != -1 || seg.q_start.indexOf('3250') != -1) {
45552
- bCstrand = true;
45553
- }
45554
- else if(seg.q_start.indexOf('7150') != -1 || seg.q_start.indexOf('7250') != -1) {
45555
- bEstrand = true;
45556
- }
45557
- else if(seg.q_start.indexOf('8150') != -1 || seg.q_start.indexOf('8250') != -1) {
45558
- bFstrand = true;
45600
+ if(seg.q_start.indexOf('2150') != -1 || seg.q_start.indexOf('2250') != -1) {
45601
+ bBstrand = true;
45602
+ }
45603
+ else if(seg.q_start.indexOf('3150') != -1 || seg.q_start.indexOf('3250') != -1) {
45604
+ bCstrand = true;
45605
+ }
45606
+ else if(seg.q_start.indexOf('7150') != -1 || seg.q_start.indexOf('7250') != -1) {
45607
+ bEstrand = true;
45608
+ }
45609
+ else if(seg.q_start.indexOf('8150') != -1 || seg.q_start.indexOf('8250') != -1) {
45610
+ bFstrand = true;
45611
+ }
45612
+
45613
+ //if(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand) break;
45614
+ if(bBstrand && bCstrand && bEstrand && bFstrand) break;
45559
45615
  }
45560
45616
 
45561
- //if(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand) break;
45562
- if(bBstrand && bCstrand && bEstrand && bFstrand) break;
45617
+ //if(!(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand)) continue;
45618
+ if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
45619
+ if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are missing in the domain " + domainid + "...");
45620
+ continue;
45621
+ }
45563
45622
  }
45564
45623
 
45565
- //if(!(bBstrand && bCstrand && bEstrand && bFstrand && bGstrand)) continue;
45566
- if(!(bBstrand && bCstrand && bEstrand && bFstrand)) {
45567
- if(!me.bNode) console.log("Some of the Ig strands B, C, E, F are missing in the domain " + domainid + "...");
45568
- continue;
45624
+ if(!bRound1) {
45625
+ if(!domainid2score.hasOwnProperty(domainid) || queryData[0].score > domainid2score[domainid]) {
45626
+ domainid2score[domainid] = queryData[0].score;
45627
+
45628
+ ic.domainid2refpdbname[domainid] = refpdbname;
45629
+ domainid2segs[domainid] = queryData[0].segs;
45630
+ ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
45631
+ ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
45632
+ }
45569
45633
  }
45570
-
45571
- if(!domainid2score.hasOwnProperty(domainid) || queryData[0].score > domainid2score[domainid]) {
45572
- domainid2score[domainid] = queryData[0].score;
45573
-
45574
- ic.domainid2refpdbname[domainid] = refpdbname;
45575
- domainid2segs[domainid] = queryData[0].segs;
45576
- ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
45577
- ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
45634
+ else {
45635
+ if(!domainid2score.hasOwnProperty(domainid) || queryData[0].super_rmsd < domainid2score[domainid]) {
45636
+ domainid2score[domainid] = queryData[0].super_rmsd;
45637
+
45638
+ ic.domainid2refpdbname[domainid] = refpdbname;
45639
+ domainid2segs[domainid] = queryData[0].segs;
45640
+ ic.domainid2ig2kabat[domainid] = queryData[0].ig2kabat;
45641
+ ic.domainid2ig2imgt[domainid] = queryData[0].ig2imgt;
45642
+ }
45578
45643
  }
45579
45644
  }
45580
45645
 
@@ -48991,7 +49056,7 @@ class ChainalignParser {
48991
49056
  let hAtomsAll = {};
48992
49057
 
48993
49058
  if(ic.bFullUi && ic.q_rotation !== undefined && !me.cfg.resnum && !me.cfg.resdef) {
48994
- // set multiple seqeunce alignment from ic.qt_start_end
49059
+ // set multiple sequence alignment from ic.qt_start_end
48995
49060
  hAtomsAll = this.setMsa(chainidArray);
48996
49061
  }
48997
49062
 
@@ -49051,7 +49116,7 @@ class ChainalignParser {
49051
49116
  ic.qt_start_end = [];
49052
49117
 
49053
49118
  let mmdbid2cnt = {}, mmdbidpairHash = {};
49054
-
49119
+
49055
49120
  let bFoundAlignment = false;
49056
49121
  for(let i = 0, il = dataArray.length; i < il; ++i) {
49057
49122
  // let align = (me.bNode) ? dataArray[i] : dataArray[i].value;//[0];
@@ -49312,7 +49377,7 @@ class ChainalignParser {
49312
49377
  let chainid = chainidArray[i];
49313
49378
  let pos = chainid.indexOf('_');
49314
49379
  let struct = chainid.substr(0, pos);
49315
- if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
49380
+ //if(struct != ic.defaultPdbId) struct = struct.toUpperCase();
49316
49381
 
49317
49382
  if(!struct2cnt.hasOwnProperty(struct)) {
49318
49383
  struct2cnt[struct] = 1;
@@ -49531,6 +49596,7 @@ class ChainalignParser {
49531
49596
 
49532
49597
  processAlign(align, index, queryData, bEqualMmdbid, bEqualChain, bNoAlert) { let ic = this.icn3d, me = ic.icn3dui;
49533
49598
  let bAligned = false;
49599
+
49534
49600
  if((!align || align.length == 0) && !bNoAlert) {
49535
49601
  let serverName = (me.cfg.aligntool == 'tmalign') ? 'TM-align' : 'VAST';
49536
49602
 
@@ -49715,14 +49781,14 @@ class ChainalignParser {
49715
49781
  ic.ParserUtilsCls.showLoading();
49716
49782
 
49717
49783
  let allPromise = Promise.allSettled(ajaxArray);
49718
- try {
49784
+ // try {
49719
49785
  let dataArray = await allPromise;
49720
49786
  await thisClass.parseMMdbAfData(dataArray, structArray, bQuery, vastplusAtype);
49721
49787
  if(vastplusAtype === undefined) ic.ParserUtilsCls.hideLoading();
49722
- }
49723
- catch(err) {
49724
- alert("There are some problems in retrieving the coordinates...");
49725
- }
49788
+ // }
49789
+ // catch(err) {
49790
+ // alert("There are some problems in retrieving the coordinates...");
49791
+ // }
49726
49792
  // });
49727
49793
 
49728
49794
  // return ic.deferredMmdbaf.promise();
@@ -50361,6 +50427,73 @@ class MmdbParser {
50361
50427
  //await ic.loadScriptCls.loadScript(me.cfg.command, undefined, true);
50362
50428
  }
50363
50429
 
50430
+ async downloadProteinname(protein) { let ic = this.icn3d, me = ic.icn3dui;
50431
+ me.icn3d.bCid = undefined;
50432
+
50433
+ // get RefSeq ID from protein name
50434
+ let url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?protein2acc=" + protein;
50435
+
50436
+ let accJson = await me.getAjaxPromise(url, 'jsonp');
50437
+
50438
+ let accArray = accJson.acc;
50439
+
50440
+ if(accArray.length == 0) {
50441
+ if(!me.bNode) alert('The protein/gene name ' + protein + ' can not be mapped to RefSeq proteins...');
50442
+ return;
50443
+ }
50444
+
50445
+ let ajaxArray = [];
50446
+ for(let index = 0, indexl = accArray.length; index < indexl; ++index) {
50447
+ let refseqid = accArray[index];
50448
+ url = me.htmlCls.baseUrl + "vastdyn/vastdyn.cgi?refseq2uniprot=" + refseqid;
50449
+
50450
+ let ajax = me.getAjaxPromise(url, 'jsonp');
50451
+
50452
+ ajaxArray.push(ajax);
50453
+ }
50454
+
50455
+ let allPromise = Promise.allSettled(ajaxArray);
50456
+ let dataArray = await allPromise;
50457
+
50458
+ ajaxArray = [];
50459
+ let afidArray = [];
50460
+ for(let i = 0, il = dataArray.length; i < il; ++i) {
50461
+ let data = dataArray[i].value;
50462
+
50463
+ if(data && data.uniprot) {
50464
+ let afid = data.uniprot;
50465
+ url = "https://alphafold.ebi.ac.uk/files/AF-" + afid + "-F1-model_" + ic.AFUniprotVersion + ".pdb";
50466
+ ic.ParserUtilsCls.setYourNote(me.cfg.protein + '(NCBI Protein/Gene) in iCn3D');
50467
+
50468
+ let ajax = me.getAjaxPromise(url, 'text', true);
50469
+ ajaxArray.push(ajax);
50470
+ afidArray.push(afid);
50471
+ }
50472
+ }
50473
+
50474
+ allPromise = Promise.allSettled(ajaxArray);
50475
+ dataArray = await allPromise;
50476
+
50477
+ for(let i = 0, il = dataArray.length; i < il; ++i) {
50478
+ let data = dataArray[i].value;
50479
+ me.cfg.afid = afidArray[i];
50480
+
50481
+ if(data) {
50482
+ // add UniProt ID into the header
50483
+ let header = 'HEADER ' + me.cfg.afid + '\n';
50484
+ data = header + data;
50485
+ await ic.opmParserCls.parseAtomData(data, me.cfg.afid, undefined, 'pdb', undefined);
50486
+
50487
+ break;
50488
+ }
50489
+ }
50490
+
50491
+ if(!me.cfg.afid) {
50492
+ if(!me.bNode) alert('The protein/gene name ' + protein + ' can not be mapped to AlphaFold structures...');
50493
+ return;
50494
+ }
50495
+ }
50496
+
50364
50497
  getNoData(mmdbid, bGi) { let ic = this.icn3d, me = ic.icn3dui;
50365
50498
  if(bGi) {
50366
50499
  alert("This gi " + mmdbid + " has no corresponding 3D structure...");
@@ -51437,6 +51570,9 @@ class PdbParser {
51437
51570
  if(me.cfg.refseqid) {
51438
51571
  ic.ParserUtilsCls.setYourNote(me.cfg.refseqid.toUpperCase() + '(NCBI Protein Acc.) in iCn3D');
51439
51572
  }
51573
+ else if(me.cfg.protein) {
51574
+ ic.ParserUtilsCls.setYourNote(me.cfg.protein + '(NCBI Protein/Gene) in iCn3D');
51575
+ }
51440
51576
  else {
51441
51577
  ic.ParserUtilsCls.setYourNote(pdbid.toUpperCase() + '(AlphaFold) in iCn3D');
51442
51578
  }
@@ -52372,6 +52508,7 @@ class RealignParser {
52372
52508
  async realignOnStructAlign(bReverse) { let ic = this.icn3d, me = ic.icn3dui;
52373
52509
  // each 3D domain should have at least 3 secondary structures
52374
52510
  let minSseCnt = (me.cfg.aligntool != 'tmalign') ? 3 : 0;
52511
+
52375
52512
  let struct2domain = {};
52376
52513
  for(let struct in ic.structures) {
52377
52514
  struct2domain[struct] = {};
@@ -52382,7 +52519,7 @@ class RealignParser {
52382
52519
  let sseCnt = 0;
52383
52520
  for(let serial in atoms) {
52384
52521
  if(ic.atoms[serial].ssbegin) ++sseCnt;
52385
- if(sseCnt == minSseCnt) {
52522
+ if(sseCnt > minSseCnt) {
52386
52523
  struct2domain[struct][chainid] = atoms;
52387
52524
  break;
52388
52525
  }
@@ -52414,7 +52551,6 @@ class RealignParser {
52414
52551
  let chainid2 = chainidArray2[j];
52415
52552
 
52416
52553
  let alignAjax;
52417
-
52418
52554
  if(me.cfg.aligntool != 'tmalign') {
52419
52555
  let jsonStr_q = ic.domain3dCls.getDomainJsonForAlign(struct2domain[struct2][chainid2]);
52420
52556
 
@@ -52453,7 +52589,7 @@ class RealignParser {
52453
52589
 
52454
52590
  async realignOnStructAlignMsa(nameArray) { let ic = this.icn3d, me = ic.icn3dui;
52455
52591
  // each 3D domain should have at least 3 secondary structures
52456
- let minSseCnt = 3;
52592
+ let minSseCnt = (me.cfg.aligntool != 'tmalign') ? 3 : 0;
52457
52593
  let chainid2domain = {};
52458
52594
 
52459
52595
  for(let i = 0, il = nameArray.length; i < il; ++i) {
@@ -52462,7 +52598,7 @@ class RealignParser {
52462
52598
  let sseCnt = 0;
52463
52599
  for(let serial in atoms) {
52464
52600
  if(ic.atoms[serial].ssbegin) ++sseCnt;
52465
- if(sseCnt == minSseCnt) {
52601
+ if(sseCnt > minSseCnt) {
52466
52602
  chainid2domain[chainid] = atoms;
52467
52603
  break;
52468
52604
  }
@@ -52562,7 +52698,7 @@ class RealignParser {
52562
52698
  let pos = chainidArray[i].indexOf('_');
52563
52699
  let mmdbid = chainidArray[i].substr(0, pos); //.toUpperCase();
52564
52700
 
52565
- if(!bRealign) mmdbid = mmdbid.toUpperCase();
52701
+ // if(!bRealign) mmdbid = mmdbid.toUpperCase();
52566
52702
 
52567
52703
  if(i == 0) {
52568
52704
  mmdbid_t = mmdbid;
@@ -52741,14 +52877,12 @@ class RealignParser {
52741
52877
  for(let j = 0, jl = resiArray.length; j < jl; ++j) {
52742
52878
  if(resiArray[j].indexOf('-') != -1) {
52743
52879
  let startEnd = resiArray[j].split('-');
52744
-
52745
52880
  for(let k = parseInt(startEnd[0]); k <= parseInt(startEnd[1]); ++k) {
52746
52881
  // from VAST neighbor page, use NCBI residue number
52747
52882
  //if(me.cfg.usepdbnum === false) k += base - 1;
52748
52883
 
52749
52884
  //let seqIndex = k - base;
52750
52885
  let seqIndex = ic.setSeqAlignCls.getPosFromResi(chainid, k);
52751
-
52752
52886
  // if(ic.bNCBI) {
52753
52887
  // let atom = ic.firstAtomObjCls.getFirstAtomObj(ic.residues[chainid + '_' + k]);
52754
52888
  // if(atom && atom.resiNCBI) seqIndex = atom.resiNCBI - 1;
@@ -52765,9 +52899,9 @@ class RealignParser {
52765
52899
  }
52766
52900
  }
52767
52901
  else { // one residue
52902
+
52768
52903
  //let k = parseInt(resiArray[j]);
52769
52904
  let k = resiArray[j];
52770
-
52771
52905
  // from VAST neighbor page, use NCBI residue number
52772
52906
  //if(me.cfg.usepdbnum === false) k += base - 1;
52773
52907
 
@@ -54585,7 +54719,7 @@ class ParserUtils {
54585
54719
  if(ic.bAnnoShown) await ic.showAnnoCls.showAnnotations();
54586
54720
  }
54587
54721
 
54588
- // Realign by seqeunce alignment with the residues in "segment", i.e., transmembrane helix
54722
+ // Realign by sequence alignment with the residues in "segment", i.e., transmembrane helix
54589
54723
  let segment = data.segment; // e.g., " 361- 379 ( 359- 384)", the first range is trnasmembrane range,
54590
54724
  //the second range is the range of the helix
54591
54725
  let range = segment.replace(/ /gi, '').split('(')[0]; //361-379
@@ -55691,22 +55825,23 @@ class SetSeqAlign {
55691
55825
  }
55692
55826
 
55693
55827
  getPosFromResi(chainid, resi) { let ic = this.icn3d; ic.icn3dui;
55694
- /*
55695
- let pos = undefined; //parseInt(resi);
55696
-
55697
- for(let i = 0, il = ic.chainsSeq[chainid].length; i < il; ++i) {
55698
- if(ic.chainsSeq[chainid][i].resi == resi) {
55699
- pos = i;
55700
- break;
55701
- }
55702
- }
55703
- */
55704
55828
  let residNCBI = ic.resid2ncbi[chainid + '_' + resi];
55705
55829
  let pos = undefined;
55830
+
55706
55831
  if(residNCBI) {
55707
55832
  let resiNCBI = residNCBI.substr(residNCBI.lastIndexOf('_') + 1);
55708
55833
  pos = resiNCBI - 1;
55709
55834
  }
55835
+ // else {
55836
+ // //let il = ic.chainsSeq[chainid].length;
55837
+ // let il = (ic.chainsSeq[chainid]) ? ic.chainsSeq[chainid].length : 0;
55838
+ // for(let i = 0; i < il; ++i) {
55839
+ // if(ic.chainsSeq[chainid][i].resi == resi) {
55840
+ // pos = i;
55841
+ // break;
55842
+ // }
55843
+ // }
55844
+ // }
55710
55845
 
55711
55846
  return pos;
55712
55847
  }
@@ -56398,7 +56533,7 @@ class SetSeqAlign {
56398
56533
 
56399
56534
  //mmdbid1 = ic.mmdbid_t;
56400
56535
  mmdbid1 = chainidArray[0].substr(0, pos1); //.toUpperCase();
56401
- mmdbid2 = chainid.substr(0, pos2); //.toUpperCase();
56536
+ mmdbid2 = chainid.substr(0, pos2); //.toUpperCase()mergeTwoSeqForAll;
56402
56537
 
56403
56538
  chain1 = chainidArray[0].substr(pos1 + 1);
56404
56539
  chain2 = chainid.substr(pos2 + 1);
@@ -56793,7 +56928,7 @@ class LoadPDB {
56793
56928
  getStructureId(id, moleculeNum, bMutation) { let ic = this.icn3d; ic.icn3dui;
56794
56929
  let structure = id;
56795
56930
 
56796
- if(id == ic.defaultPdbId || bMutation) { // bMutation: side chain prediction
56931
+ if(id == ic.defaultPdbId || bMutation || ic.structures.hasOwnProperty(id)) { // bMutation: side chain prediction
56797
56932
  structure = (moleculeNum === 1) ? id : id + moleculeNum.toString();
56798
56933
  }
56799
56934
 
@@ -56861,7 +56996,7 @@ class LoadPDB {
56861
56996
  let prevMissingChain = '';
56862
56997
  let CSerial, prevCSerial, OSerial, prevOSerial;
56863
56998
 
56864
- let bHeader = false;
56999
+ let bHeader = false, bFirstAtom = true;
56865
57000
 
56866
57001
  for (let i in lines) {
56867
57002
  let line = lines[i];
@@ -57022,7 +57157,11 @@ class LoadPDB {
57022
57157
  ic.pmid = line.substr(19).trim();
57023
57158
  }
57024
57159
  } else if (record === 'ATOM ' || record === 'HETATM') {
57025
- structure = this.getStructureId(id, moleculeNum, bMutation);
57160
+ if(bFirstAtom) {
57161
+ structure = this.getStructureId(id, moleculeNum, bMutation);
57162
+
57163
+ bFirstAtom = false;
57164
+ }
57026
57165
 
57027
57166
  let alt = line.substr(16, 1);
57028
57167
  //if (alt !== " " && alt !== "A") continue;
@@ -57165,6 +57304,7 @@ class LoadPDB {
57165
57304
 
57166
57305
  // different residue
57167
57306
  //if(residueNum !== prevResidueNum) {
57307
+
57168
57308
  if(oriResidueNum !== prevOriResidueNum) {
57169
57309
  let residue = me.utilsCls.residueName2Abbr(resn);
57170
57310
  ic.residueId2Name[residueNum] = residue;
@@ -57912,7 +58052,7 @@ class Vastplus {
57912
58052
 
57913
58053
  // reinitialize the alignment
57914
58054
  $("#" + ic.pre + "dl_sequence2").html('');
57915
-
58055
+
57916
58056
  for(let j = 0, jl = nodeArray.length; j < jl; ++j) {
57917
58057
  let node = parseInt(nodeArray[j]);
57918
58058
  let segs = queryDataArray[node][0].segs;
@@ -57989,7 +58129,7 @@ class Vastplus {
57989
58129
  for(let j = 0, jl = nodeArray.length; j < jl; ++j) {
57990
58130
  chainpairStr += chainidpairArray[parseInt(nodeArray[j])] + '; ';
57991
58131
  }
57992
- console.log("Selected the alignment: " + chainpairStr);
58132
+ if(!me.bNode) console.log("Selected the alignment: " + chainpairStr);
57993
58133
 
57994
58134
  break;
57995
58135
  }
@@ -57998,7 +58138,7 @@ class Vastplus {
57998
58138
  for(let j = 0, jl = nodeArray.length; j < jl; ++j) {
57999
58139
  chainpairStr += chainidpairArray[parseInt(nodeArray[j])] + '; ';
58000
58140
  }
58001
- console.log("skipped the alignment: " + chainpairStr);
58141
+ if(!me.bNode) console.log("skipped the alignment: " + chainpairStr);
58002
58142
  }
58003
58143
  }
58004
58144
  }
@@ -61383,6 +61523,10 @@ class LoadScript {
61383
61523
  me.cfg.refseqid = id;
61384
61524
  await ic.mmdbParserCls.downloadRefseq(id);
61385
61525
  }
61526
+ else if(command.indexOf('load protein') !== -1) {
61527
+ me.cfg.protein = id;
61528
+ await ic.mmdbParserCls.downloadProteinname(id);
61529
+ }
61386
61530
  else if(command.indexOf('load seq_struct_ids ') !== -1) {
61387
61531
  ic.bSmithwm = false;
61388
61532
  ic.bLocalSmithwm = false;
@@ -62478,6 +62622,8 @@ class Selection {
62478
62622
  ic.graphStr = this.getGraphDataForDisplayed();
62479
62623
  }
62480
62624
 
62625
+ ic.saveFileCls.showTitle();
62626
+
62481
62627
  // don not redraw graphs after the selection changes
62482
62628
  /*
62483
62629
  if(ic.bGraph) ic.drawGraphCls.drawGraph(ic.graphStr, ic.pre + 'dl_graph');
@@ -67717,7 +67863,7 @@ class ResizeCanvas {
67717
67863
  //let itemArray = ['dl_selectannotations', 'dl_alignment', 'dl_2ddgm', 'dl_definedsets', 'dl_graph',
67718
67864
  // 'dl_linegraph', 'dl_scatterplot', 'dl_contactmap', 'dl_allinteraction', 'dl_copyurl',
67719
67865
  // 'dl_symmetry', 'dl_symd', 'dl_rmsd', 'dl_legend', 'dl_disttable'];
67720
- 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'];
67866
+ 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'];
67721
67867
 
67722
67868
  for(let i in itemArray) {
67723
67869
  let item = itemArray[i];
@@ -68362,6 +68508,26 @@ class SaveFile {
68362
68508
  return html;
68363
68509
  }
68364
68510
 
68511
+ printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt) { let ic = this.icn3d; ic.icn3dui;
68512
+ let ssText = '';
68513
+
68514
+ // print prev
68515
+ if(prevRealSsObj) {
68516
+ if(bHelix) {
68517
+ let helixType = 1;
68518
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68519
+ + prevRealSsObj.resi.toString().padStart(5, ' ') + ' ' + helixType + ssCnt.toString().padStart(36, ' ') + '\n';
68520
+ }
68521
+ else if(bSheet) {
68522
+ let sense = 0;
68523
+ ssText += prevRealSsObj.resn.padStart(5, ' ') + prevRealSsObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68524
+ + prevRealSsObj.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
68525
+ }
68526
+ }
68527
+
68528
+ return ssText;
68529
+ }
68530
+
68365
68531
  //getAtomPDB: function(atomHash, bPqr, bPdb, bNoChem) { let ic = this.icn3d, me = ic.icn3dui;
68366
68532
  getAtomPDB(atomHash, bPqr, bNoChem, bNoHeader, chainResi2pdb, pdbid) { let ic = this.icn3d, me = ic.icn3dui;
68367
68533
  let pdbStr = '';
@@ -68394,8 +68560,6 @@ class SaveFile {
68394
68560
 
68395
68561
  let calphaHash = me.hashUtilsCls.intHash(atomHash, ic.calphas);
68396
68562
  let helixStr = 'HELIX', sheetStr = 'SHEET';
68397
- let bHelixBegin = false, bHelixEnd = true;
68398
- let bSheetBegin = false, bSheetEnd = true;
68399
68563
 
68400
68564
  let stru2header = {};
68401
68565
  for(let stru in ic.structures) {
@@ -68403,48 +68567,82 @@ class SaveFile {
68403
68567
  }
68404
68568
 
68405
68569
  // if(!bNoSs) {
68406
- let prevResi, stru, chainid;
68570
+ let prevResi, stru;
68571
+ let ssArray = [];
68407
68572
  for(let i in calphaHash) {
68408
68573
  let atom = ic.atoms[i];
68409
68574
  stru = atom.structure;
68410
- chainid = atom.structure + '_' + atom.chain;
68575
+ atom.structure + '_' + atom.chain;
68411
68576
 
68412
- if(atom.ssbegin) {
68413
- if(atom.ss == 'helix') {
68414
- bHelixBegin = true;
68415
- if(bHelixEnd) stru2header[stru] += helixStr.padEnd(15, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68416
- + atom.resi.toString().padStart(5, ' ');
68417
- bHelixEnd = false;
68418
- prevResi = atom.resi;
68419
- }
68420
- else if(atom.ss == 'sheet') {
68421
- bSheetBegin = true;
68422
- if(bSheetEnd) stru2header[stru] += sheetStr.padEnd(17, ' ') + atom.resn.padStart(3, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68423
- + atom.resi.toString().padStart(4, ' ');
68424
- bSheetEnd = false;
68425
- }
68577
+ let ssObj = {};
68578
+ ssObj.chain = atom.chain;
68579
+ ssObj.resn = atom.resn;
68580
+ ssObj.resi = atom.resi;
68581
+
68582
+ if(parseInt(atom.resi) > parseInt(prevResi) + 1) {
68583
+ ssObj.ss = ' ';
68584
+ ssArray.push(ssObj);
68585
+ }
68586
+
68587
+ if(atom.ss == 'helix') {
68588
+ ssObj.ss = 'H';
68589
+ ssArray.push(ssObj);
68590
+ }
68591
+ else if(atom.ss == 'sheet') {
68592
+ ssObj.ss = 'S';
68593
+ ssArray.push(ssObj);
68426
68594
  }
68427
68595
 
68428
68596
  if(atom.ssend) {
68429
- if(atom.ss == 'helix') {
68430
- bHelixEnd = true;
68431
- let residEnd = ic.resid2ncbi[chainid + '_' + atom.resi];
68432
- let residStart = ic.resid2ncbi[chainid + '_' + prevResi];
68433
- let helixLen = (residEnd && residStart) ? parseInt(residEnd.substr(residEnd.lastIndexOf('_') + 1)) - parseInt(residStart.substr(residStart.lastIndexOf('_') + 1)) : 0;
68434
- let helixType = 1;
68435
- if(bHelixBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68436
- + atom.resi.toString().padStart(5, ' ') + ' ' + helixType + helixLen.toString().padStart(36, ' ') + '\n';
68437
- bHelixBegin = false;
68438
- }
68439
- else if(atom.ss == 'sheet') {
68440
- bSheetEnd = true;
68441
- let sense = 0;
68442
- if(bSheetBegin) stru2header[stru] += atom.resn.padStart(5, ' ') + atom.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68443
- + atom.resi.toString().padStart(4, ' ') + ' ' + sense + '\n';
68444
- bSheetBegin = false;
68597
+ let ssObj2 = me.hashUtilsCls.cloneHash(ssObj);
68598
+ ssObj2.ss = ' ';
68599
+ ssArray.push(ssObj2);
68600
+ }
68601
+
68602
+ prevResi = atom.resi;
68603
+ }
68604
+
68605
+ let prevSs, prevRealSsObj, ssCnt = 0, bHelix = false, bSheet = false;
68606
+ for(let i = 0, il = ssArray.length; i < il; ++i) {
68607
+ let ssObj = ssArray[i];
68608
+
68609
+ if(ssObj.ss != prevSs) {
68610
+ // print prev
68611
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
68612
+
68613
+ // print current
68614
+ ssCnt = 0;
68615
+ bHelix = false;
68616
+ bSheet = false;
68617
+ prevRealSsObj = undefined;
68618
+
68619
+ if(ssObj.ss != ' ') {
68620
+ if(ssObj.ss == 'H') {
68621
+ bHelix = true;
68622
+ prevRealSsObj = ssObj;
68623
+ stru2header[stru] += helixStr.padEnd(15, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68624
+ + ssObj.resi.toString().padStart(5, ' ');
68625
+ }
68626
+ else if(ssObj.ss == 'S') {
68627
+ bSheet = true;
68628
+ prevRealSsObj = ssObj;
68629
+ stru2header[stru] += sheetStr.padEnd(17, ' ') + ssObj.resn.padStart(3, ' ') + ssObj.chain.replace(/_/gi, '').substr(0, 2).padStart(2, ' ')
68630
+ + ssObj.resi.toString().padStart(4, ' ');
68631
+ }
68445
68632
  }
68446
68633
  }
68634
+
68635
+ if(ssObj.ss != ' ') {
68636
+ ++ssCnt;
68637
+ prevRealSsObj = ssObj;
68638
+ }
68639
+
68640
+ prevSs = ssObj.ss;
68447
68641
  }
68642
+
68643
+ // print prev
68644
+ stru2header[stru] += this.printPrevSecondary(bHelix, bSheet, prevRealSsObj, ssCnt);
68645
+
68448
68646
  // add a new line in case the structure is a subset
68449
68647
  stru2header[stru] += '\n';
68450
68648
  // }
@@ -68799,13 +68997,13 @@ class SaveFile {
68799
68997
 
68800
68998
  //Show the title and PDB ID of the PDB structure at the beginning of the viewer.
68801
68999
  showTitle() {var ic = this.icn3d, me = ic.icn3dui;
68802
- if(ic.molTitle !== undefined && ic.molTitle !== '') {
68803
- let title = ic.molTitle;
69000
+ // if(ic.molTitle !== undefined && ic.molTitle !== '') {
69001
+ let title = (ic.molTitle) ? ic.molTitle : '';
68804
69002
 
68805
69003
  let titlelinkColor =(ic.opts['background'] == 'black') ? me.htmlCls.GREYD : 'black';
68806
69004
 
68807
69005
  if(ic.inputid === undefined) {
68808
- if(ic.molTitle.length > 40) title = ic.molTitle.substr(0, 40) + "...";
69006
+ if(title.length > 40) title = title.substr(0, 40) + "...";
68809
69007
 
68810
69008
  $("#" + ic.pre + "title").html(title);
68811
69009
  }
@@ -68825,31 +69023,38 @@ class SaveFile {
68825
69023
 
68826
69024
  $("#" + ic.pre + "title").html(title);
68827
69025
  }
68828
- else if(me.cfg.mmdbafid !== undefined) {
68829
- let structureArray = Object.keys(ic.structures); //me.cfg.mmdbafid.split(',');
69026
+ else { //if(me.cfg.mmdbafid !== undefined) {
69027
+ //let structureArray = Object.keys(ic.structures); //me.cfg.mmdbafid.split(',');
69028
+ let structureArray = Object.keys(me.utilsCls.getStructures(ic.dAtoms));
69029
+
68830
69030
  if(structureArray.length > 1) {
68831
- title = 'Multiple structures: ' + structureArray;
69031
+ title = 'Multiple structures: ';
69032
+ for(let i = 0, il = structureArray.length; i < il; ++i) {
69033
+ 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];
69034
+ title += '<a href="' + url + '" style="color:' + titlelinkColor + '" target="_blank">' + structureArray[i] + '</a>';
69035
+ if(i < il - 1) title += ', ';
69036
+ }
68832
69037
  $("#" + ic.pre + "title").html(title);
68833
69038
  }
68834
69039
  else if(structureArray.length == 1) {
68835
69040
  //let url = this.getLinkToStructureSummary();
68836
- 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;
69041
+ 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];
68837
69042
 
68838
69043
  this.setStructureTitle(url, title, titlelinkColor);
68839
69044
  }
68840
69045
  }
68841
- else {
68842
- let url = this.getLinkToStructureSummary();
68843
- this.setStructureTitle(url, title, titlelinkColor);
68844
- }
68845
- }
68846
- else {
68847
- $("#" + ic.pre + "title").html("");
68848
- }
69046
+ // else {
69047
+ // let url = this.getLinkToStructureSummary();
69048
+ // this.setStructureTitle(url, title, titlelinkColor);
69049
+ // }
69050
+ // }
69051
+ // else {
69052
+ // $("#" + ic.pre + "title").html("");
69053
+ // }
68849
69054
  }
68850
69055
 
68851
69056
  setStructureTitle(url, title, titlelinkColor) {var ic = this.icn3d, me = ic.icn3dui;
68852
- if(ic.molTitle.length > 40) title = ic.molTitle.substr(0, 40) + "...";
69057
+ if(title.length > 40) title = title.substr(0, 40) + "...";
68853
69058
 
68854
69059
  let inputid = ic.inputid;
68855
69060
 
@@ -68875,7 +69080,7 @@ class SaveFile {
68875
69080
  let structureidArray = Object.keys(idHash);
68876
69081
  inputid = structureidArray.join(',');
68877
69082
 
68878
- text = inputid.toUpperCase();
69083
+ text = (me.cfg.refseqid || me.cfg.protein) ? ic.inputid : inputid.toUpperCase();
68879
69084
 
68880
69085
  //idName = (isNaN(inputid) && inputid.length > 5) ? "AlphaFold ID" : "PDB ID";
68881
69086
  if(bPdb && bAlphaFold) {
@@ -68901,7 +69106,12 @@ class SaveFile {
68901
69106
  }
68902
69107
  }
68903
69108
 
68904
- if(me.cfg.refseqid) idName = 'NCBI Protein Acc.';
69109
+ if(me.cfg.refseqid) {
69110
+ idName = 'NCBI Protein Acc.';
69111
+ }
69112
+ else if(me.cfg.protein) {
69113
+ idName = 'Protein/Gene Name';
69114
+ }
68905
69115
 
68906
69116
  if(!inputid || inputid.substr(0, 4) == ic.defaultPdbId) {
68907
69117
  $("#" + ic.pre + "title").html(title);
@@ -72173,7 +72383,7 @@ class iCn3DUI {
72173
72383
  //even when multiple iCn3D viewers are shown together.
72174
72384
  this.pre = this.cfg.divid + "_";
72175
72385
 
72176
- this.REVISION = '3.26.0';
72386
+ this.REVISION = '3.27.0';
72177
72387
 
72178
72388
  // In nodejs, iCn3D defines "window = {navigator: {}}"
72179
72389
  this.bNode = (Object.keys(window).length < 2) ? true : false;
@@ -72365,6 +72575,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
72365
72575
  }
72366
72576
  else if(me.cfg.resdef !== undefined && me.cfg.matchedchains !== undefined) {
72367
72577
  let stru_t = Object.keys(ic.structures)[0];
72578
+
72368
72579
  let chain_t = stru_t + '_' + me.cfg.masterchain;
72369
72580
  let domainidArray = me.cfg.matchedchains.split(',');
72370
72581
  let chainidArray = [];
@@ -72465,6 +72676,14 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
72465
72676
  me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
72466
72677
  await ic.mmdbParserCls.downloadRefseq(me.cfg.refseqid);
72467
72678
  }
72679
+ else if(me.cfg.protein !== undefined) {
72680
+ ic.inputid = me.cfg.protein;
72681
+
72682
+ // ic.bNCBI = true;
72683
+ ic.loadCmd = 'load protein ' + me.cfg.protein;
72684
+ me.htmlCls.clickMenuCls.setLogCmd(ic.loadCmd, true);
72685
+ await ic.mmdbParserCls.downloadProteinname(me.cfg.protein);
72686
+ }
72468
72687
  else if(me.cfg.blast_rep_id !== undefined) {
72469
72688
  // ic.bNCBI = true;
72470
72689
  ic.inputid = me.cfg.query_id + ',' + me.cfg.blast_rep_id;
@@ -72472,7 +72691,7 @@ iCn3DUI.prototype.show3DStructure = async function(pdbStr) { let me = this;
72472
72691
  me.cfg.oriQuery_id = me.cfg.query_id;
72473
72692
  me.cfg.oriBlast_rep_id = me.cfg.blast_rep_id;
72474
72693
 
72475
- // custom seqeunce has query_id such as "Query_78989" in BLAST
72694
+ // custom sequence has query_id such as "Query_78989" in BLAST
72476
72695
  if(me.cfg.query_id.substr(0,5) !== 'Query' && me.cfg.rid === undefined) {
72477
72696
  // make it backward compatible for figure 2 in iCn3D paper: https://academic.oup.com/bioinformatics/article/36/1/131/5520951
72478
72697
  if(me.cfg.from == 'icn3d' && me.cfg.blast_rep_id == '1TSR_A' && me.cfg.query_id == 'NP_001108451.1') {