Viral Phylogenetics
Help 4 / 7
Generate Unrooted Tree

Use FastTree to generate a tree from alignment data

Now that we have run MSA on our dataset, we can perform Phylogenetic Inference: using the MSA and mathematical models of evolution, we can identify the evolutionary tree (i.e. phylogeny) that best describes the evolutionary relationships between the sequences in our MSA. It is important to note that the phylogeny we produce in this step will be unrooted. This means that while we can determine the relative evolutionary relationships between sequences, we cannot “root” the tree (and thus identify the date of the MRCA) because the directionality of time is not known. In an unrooted tree, branch lengths are in units of mutations instead of in units of time.

We will use FastTree to generate an unrooted phylogenetic tree to assess relative ancestral relationships between our samples.

  1. Try to take a look at the usage instructions.

  2. Now, generate our phylogenetic tree:

FastTree \
   -nt \
   -gtr \
   -gamma \
   ViralMSA_Out/sarscov2_sequences.fas.aln > sarscov2_sequences.unrooted_tree.nwk

Let’s make some sense of this command:

  • -nt specifies that our alignment is of nucleotides and not amino acids

  • -gtr implements use of a Generalized Time-Reversible (GTR) model of evolution for our tree. FastTree can be run with either the Jukes-Cantor or GTR model.

  • -gamma allows for rescaling of the branch lengths and computation of a Gamma2-based likelihood

  • sarscov2_sequences.msa.fas > sarscov2_sequences.unrooted_tree.nwk tells FastTree to take in our multiple sequence alignment file (from Step 1) as input and to output the unrooted phylogenetic tree to a file called sarscov2_sequences.unrooted_tree.nwk in the same directory. A .nwk file is in Newick format, which is often used to represent phylogenetic trees. It is a text-based way to represent the tree structure. You can read more about Newick format here.

  1. Use head to view the first 10 lines of the tree file:
head -10 sarscov2_sequences.unrooted_tree.nwk
  1. Now, let’s quickly visualize how this information makes a tree in the terminal using nw_display:
nw_display sarscov2_sequences.unrooted_tree.nwk

Why might we want to create an unrooted tree, over a rooted tree (with a common ancestor)?

  1. We can alternatively visualize our tree using webtools. First, use download to store the file locally:
download sarscov2_sequences.unrooted_tree.nwk
  1. Navigate to Taxonium to upload the file, and view your unrooted phylogenetic tree.
Loading...