Phylogenetics & Evolution

Lesson 13 of 13 · 11 min

Putting It Together and Where to Go Next

Across this module you have touched every stage of a phylogenetic study. The goal now is to see those stages as one repeatable pipeline that you can point at any gene or any clade, and to know which doors open next when a single gene tree is no longer enough.

One repeatable pipeline

The full workflow is nine steps: establish homology, collect sequences, align, trim ambiguous columns, select a substitution model, infer a tree by maximum likelihood or Bayesian inference, quantify support, calibrate the tree to time, and visualize the result. In practice most of the middle steps collapse into two or three commands, because tools like IQ-TREE fold model selection, tree search, and support into a single run.

bash
#!/usr/bin/env bash
set -euo pipefail

# 0. Input: FASTA of orthologous sequences for one gene.
# Homology/orthology is settled upstream (reciprocal BLAST, OrthoFinder).
IN=candidates.fasta

# 1. Multiple sequence alignment
mafft --auto --thread 4 "$IN" > aligned.fasta

# 2. Trim poorly aligned columns
trimal -in aligned.fasta -out trimmed.fasta -automated1

# 3. Model selection + ML tree + support in one run
#    -m MFP  : ModelFinder Plus picks the best model by BIC
#    -B 1000 : 1000 ultrafast bootstrap replicates
#    -alrt   : 1000 SH-aLRT replicates
iqtree2 -s trimmed.fasta -m MFP -B 1000 -alrt 1000 -T AUTO --prefix mygene

# 4. Time-calibrate the ML topology (least-squares dating, LSD2).
#    No outgroup is given, so LSD2 also estimates the root position.
iqtree2 -s trimmed.fasta -te mygene.treefile -m GTR+F+R4 \
        --date dates.tsv --date-ci 100 --prefix mygene_dated -T AUTO

# 5. Visualize: open mygene_dated.timetree.nwk in FigTree, iTOL, or ggtree
IQ-TREE 2.2.2.7 for MacOS 64-bit built Jun  3 2023

ModelFinder
-----------
Best-fit model according to BIC: GTR+F+R4
List of models sorted by BIC scores:
  GTR+F+R4     37012.446
  GTR+F+R3     37048.911
  GTR+F+G4     37115.300

Ultrafast bootstrap (1000 replicates)
SH-aLRT (1000 replicates)
Log-likelihood of the tree: -18397.842

Analysis results written to:
  IQ-TREE report:                mygene.iqtree
  Maximum-likelihood tree:       mygene.treefile
  Ultrafast bootstrap splits:    mygene.splits.nex
Date root position: -94.7 (95% CI [-108.2, -82.5])

Warning: ultrafast bootstrap and SH-aLRT are not on the same scale as the classic nonparametric bootstrap. Treat a branch as well supported only when UFBoot is at least 95 and SH-aLRT is at least 80.

Scaling to phylogenomics

With hundreds of genes you have two strategies. Concatenation glues all alignments into one supermatrix and infers a single tree, which is powerful but assumes every gene shares the same history. Coalescent methods such as ASTRAL instead take one tree per gene and estimate a species tree that is statistically consistent under incomplete lineage sorting, so gene-tree and species-tree discordance becomes signal rather than noise.

bash
# Estimate one ML gene tree per locus first (loop omitted), then
# concatenate them into one file, one Newick tree per line:
cat gene_trees/*.treefile > all_gene_trees.nwk

# Coalescent species tree from unrooted gene trees.
# ASTRAL writes progress and scores to stderr; capture it in a log.
# Branch support here is local posterior probability, not bootstrap.
java -jar astral.5.7.8.jar \
     -i all_gene_trees.nwk \
     -o species_tree.nwk 2> astral.log

# Inspect the run log (taxa count, gene-tree count, quartet score)
cat astral.log
Number of gene trees read: 412
Number of taxa: 27
...
Final normalized quartet score is: 0.8731
Branches annotated with local posterior probability.
Species tree written to species_tree.nwk
Optimal tree inferred in 11.94 seconds.

Try it yourself: pull a small multi-gene dataset from TreeBASE or the IQ-TREE example alignments, run the pipeline above on three genes, build both a concatenated tree and an ASTRAL species tree, and note every branch where the two topologies disagree. When your run spans dozens of commands, wrap it in Snakemake or Nextflow so the whole analysis reruns from raw FASTA with one command and pinned tool versions.

To keep practicing on real data, mine TreeBASE and the Open Tree of Life for published matrices, and explore transcriptome sets like 1KP for plant phylogenomics. For depth, work through Ziheng Yang's Molecular Evolution: A Statistical Approach, The Phylogenetic Handbook edited by Lemey and colleagues, and Felsenstein's Inferring Phylogenies as your standing references.