Answers.Body: <p>If you look into the <code>get_seqrecs()</code> function, you will see that this function is not extracting hsps to use in the following steps but the hsps are used in order to filter out low score BLAST alignments. The function accepts a blast alignment result and a threshold, and if the hsp score is above the supplied threshold the whole sequence (not just the hsp) would be the output. Your intuition is correct, the whole sequence should go in the MSA step.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T03:17:30.877Z
Answers.Text: You are right, my mistake, thanks!
Answers.UserDisplayName: David Young
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-25T18:55:17.497Z
Answers.LastActivityDate: 2019-08-25T19:50:37.030Z
Answers.LastEditDate: 2019-08-25T19:50:37.030Z
Answers.UserDisplayName: haci
Answers.Body: <p>Firsly an .aln file feed into PhylML is fine, unless you can program in Python.</p>
  
  <p>Precisely what level of tree building you need depends on its end purpose. Here's past example of a similar question <a href="https://bioinformatics.stackexchange.com/questions/3377/how-to-find-build-the-evolutionary-history-of-a-protein-from-its-sequence/6928#6928">here</a> using NCBI Blast.</p>
  
  <p>Building trees (nj and parsimony) is one of the features of NCBI's Blast. Here's how to do it</p>
  
  <ol>
  <li>Go to Blast here, <a href="https://blast.ncbi.nlm.nih.gov/Blast.cgi" rel="nofollow noreferrer">https://blast.ncbi.nlm.nih.gov/Blast.cgi</a></li>
  <li>Enter your sequence into the box (it doesn't accept PDB codes alone)</li>
  <li>Enter the protein database - when I first did this calculation I used SwissProt, thinking there would be alot of sequences - I then used "nr"
  Under the algorithm parameters enter "50" (default is too many)</li>
  <li>Hit "Blast"</li>
  <li>Once the search is complete at the top of the page are the hyperlinks: "Other reports: Search Summary [Taxonomy reports] [Distance tree of results]"</li>
  <li>Click on "Distance tree of results"</li>
  <li>This will automatically aligning your sequences and produce, in this case a parsimony based tree, but there is also the option of a nj tree (recommended) </li>
  <li>Click "Tool", "Download", "PDF" ...</li>
  </ol>
  
  <p><strong>Notes</strong></p>
  
  <ul>
  <li>If you want probabilistic trees, PhylML is certainly one of them,  Blast remains quite central to building the alignment. </li>
  <li>With regards building partial genome trees, this will depend on what organism you are studing</li>
  <li>With regards Blast HSPs being treated individually, again it depends on what you question is and generally refers to advanced phylogenetics</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-25T22:33:09.407Z
Answers.LastActivityDate: 2019-08-25T22:46:13.620Z
Answers.LastEditDate: 2019-08-25T22:46:13.620Z
Answers.UserDisplayName: M__
Body: <p>I am trying to infer a phylogenetic tree from a Blastn output and from what I have understood, what I should do is 1) extract the alignments and re-align them using Muscle, then 2) feed the .aln file into <strong>PhyML</strong>. 
  Is this correct? </p>
  
  <p>Or should I be extracting the hsps from each alignment as suggested here <a href="https://biopython.org/wiki/Phylo" rel="nofollow noreferrer">https://biopython.org/wiki/Phylo</a>? I don't quite understand why the hsps are extracted here, shouldn't the whole sequences be compared in the multiple alignment?</p>
  
Tags: <phylogenetics><phylogeny><blastn>
Title: Inferring a phylogenetic tree from BLASTn
ThreadText: # Inferring a phylogenetic tree from BLASTn
  
  (Asked by: username_0 on 2019-08-25)
  
  I am trying to infer a phylogenetic tree from a Blastn output and from what I have understood, what I should do is 1) extract the alignments and re-align them using Muscle, then 2) feed the .aln file into **PhyML**.
  Is this correct?
  
  Or should I be extracting the hsps from each alignment as suggested here <https://biopython.org/wiki/Phylo>? I don't quite understand why the hsps are extracted here, shouldn't the whole sequences be compared in the multiple alignment?
  
  **Tags:** phylogenetics, phylogeny, blastn
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-08-25. Score: 0 | Accepted answer
  
  If you look into the `get_seqrecs()` function, you will see that this function is not extracting hsps to use in the following steps but the hsps are used in order to filter out low score BLAST alignments. The function accepts a blast alignment result and a threshold, and if the hsp score is above the supplied threshold the whole sequence (not just the hsp) would be the output. Your intuition is correct, the whole sequence should go in the MSA step.
  
  > **Comments:**
  > **username_0**: You are right, my mistake, thanks!  
  
  ---
  
  ### Answer by username_2 on 2019-08-25. Score: 0
  
  Firsly an .aln file feed into PhylML is fine, unless you can program in Python.
  
  Precisely what level of tree building you need depends on its end purpose. Here's past example of a similar question [here](https://bioinformatics.stackexchange.com/questions/3377/how-to-find-build-the-evolutionary-history-of-a-protein-from-its-sequence/6928#6928) using NCBI Blast.
  
  Building trees (nj and parsimony) is one of the features of NCBI's Blast. Here's how to do it
  
  1. Go to Blast here, <https://blast.ncbi.nlm.nih.gov/Blast.cgi>
  2. Enter your sequence into the box (it doesn't accept PDB codes alone)
  3. Enter the protein database - when I first did this calculation I used SwissProt, thinking there would be alot of sequences - I then used "nr"
     Under the algorithm parameters enter "50" (default is too many)
  4. Hit "Blast"
  5. Once the search is complete at the top of the page are the hyperlinks: "Other reports: Search Summary [Taxonomy reports] [Distance tree of results]"
  6. Click on "Distance tree of results"
  7. This will automatically aligning your sequences and produce, in this case a parsimony based tree, but there is also the option of a nj tree (recommended)
  8. Click "Tool", "Download", "PDF" ...
  
  **Notes**
  
  * If you want probabilistic trees, PhylML is certainly one of them, Blast remains quite central to building the alignment.
  * With regards building partial genome trees, this will depend on what organism you are studing
  * With regards Blast HSPs being treated individually, again it depends on what you question is and generally refers to advanced phylogenetics
  
  
  ---
  
  