# Inferring a phylogenetic tree from BLASTn

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?

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.

• You are right, my mistake, thanks! – David Young Aug 27 '19 at 3:17

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 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)