Comparative and Evolutionary Genomics: Trees and Selection

Multiple sequence alignment · RAxML and IQ-TREE · dN/dS · Positively selected genes

Published 2026 · Last updated 2026-09-27 · Hailu Zhou

Comparative genomics is where sequence becomes history. Two questions dominate the analysis: what is the tree, and what selection shaped the branches? Both are inference problems with real error bars, and both are routinely reported with more confidence than the data support. The discipline that pays off is treating alignment, tree, and selection as a pipeline whose weakest link caps the whole result.

Alignment is the foundation, and most errors start here

MAFFT is the workhorse for nucleotide and protein alignment, with strategies that trade speed for accuracy depending on dataset size and divergence1. For coding sequences, the correct approach is codon-aware: align the protein translation and back-translate, or use a codon-aware aligner such as PRANK or MACSE, so that gaps do not break reading frames. Frameshift-inducing gaps silently corrupt every downstream dN/dS estimate.

Then filter. Trim unreliable columns with Gblocks or trimAl, mask low-complexity regions, and inspect the alignment by eye for the classic artifacts: misaligned homopolymer runs, shifted conserved motifs, and collapsed paralogs. If two sequences in your alignment are actually paralogs rather than orthologs, the tree will be wrong in a way that no downstream method can repair. Orthology assignment is a separate inference step, not an assumption.

Tree inference: maximum likelihood and its diagnostics

Maximum likelihood is the default for modern phylogenetics. RAxML performs fast maximum-likelihood inference with bootstrap support and scales to thousands of taxa2. IQ-TREE adds model selection, ultrafast bootstrap, and the ability to test partition schemes automatically3; its ModelFinder component tests substitution models and rate heterogeneity across sites without manual iteration. Both handle partitioned analyses, which you should use when genes or codon positions evolve differently.

Diagnostics matter more than the point estimate. Report bootstrap or ultrafast bootstrap values and understand what they measure — support for a clade under resampling, not a posterior probability. Check for long-branch attraction by rerunning with a site-heterogeneous model or by removing the offending taxa. Root the tree with an appropriate outgroup, and if you also need divergence times, enforce a molecular clock with a tool like BEAST or MCMCTree rather than reading branch lengths as time.

dN/dS: the ratio that is easy to compute and easy to overread

The nonsynonymous-to-synonymous substitution rate ratio, dN/dS (also written ω), is the standard selection statistic, formalized in the codon-based likelihood framework by Goldman and Yang4. Interpretation: ω < 1 indicates purifying selection, ω = 1 neutrality, ω > 1 positive selection. The critical point is that ω is an average and the average almost never exceeds one, even in genes with strongly selected sites, because most sites are constrained. A gene-wide ω of 0.2 says nothing about whether one codon is under positive selection.

Also beware of what ω cannot see. It cannot distinguish relaxed constraint from positive selection (both raise ω), it is confounded by alignment error and saturation at high divergence, and it says nothing about non-coding regulatory adaptation. Pair ω analyses with branch-length or population-genetic evidence before claiming adaptation.

Finding positively selected sites and genes

PAML's codeml implements site models (M1a vs M2a, M7 vs M8) with likelihood ratio tests and Bayes empirical Bayes identification of selected codons; branch-site models extend this to selected lineages, which is what you want for lineage-specific adaptation5. HyPhy provides the complementary framework, including FEL and MEME for site-level inference and RELAX for detecting relaxed selection6. Run multiple methods; a site detected by both PAML BEB and HyPhy MEME at a stringent posterior threshold is a defensible candidate.

At genome scale, the practical unit is the gene-family tree, and the results are almost always dominated by alignment quality. Genes called positively selected in one alignment can vanish when the alignment is rebuilt. Sensitivity analysis over alignment parameters is not optional; it is the result.

An honest workflow

Comparative genomics rewards skepticism. The tree and the selection signal are both hypotheses, and the job is to make them survive the obvious objections before publishing them.

References

  1. Katoh K, Standley DM. MAFFT multiple sequence alignment software version 7: improvements in performance and usability. Mol Biol Evol. 2013;30(4):772-780.
  2. Stamatakis A. RAxML version 8: a tool for phylogenetic analysis and post-analysis of large phylogenies. Bioinformatics. 2014;30(9):1312-1313.
  3. Nguyen LT, Schmidt HA, von Haeseler A, Minh BQ. IQ-TREE: a fast and effective stochastic algorithm for estimating maximum-likelihood phylogenies. Mol Biol Evol. 2015;32(1):268-274.
  4. Goldman N, Yang Z. A codon-based model of nucleotide substitution for protein-coding DNA sequences. Mol Biol Evol. 1994;11(5):725-736.
  5. Yang Z. PAML 4: phylogenetic analysis by maximum likelihood. Mol Biol Evol. 2007;24(8):1586-1591.
  6. Pond SLK, Frost SDW, Muse SV. HyPhy: hypothesis testing using phylogenies. Bioinformatics. 2005;21(5):676-679.
  7. Capella-Gutiérrez S, Silla-Martínez JM, Gabaldón T. trimAl: a tool for automated alignment trimming in large-scale phylogenetic analyses. Bioinformatics. 2009;25(15):1972-1973.
  8. Talavera G, Castresana J. Improvement of phylogenies after removing divergent and ambiguously aligned blocks from protein sequence alignments. Syst Biol. 2007;56(4):564-577.
  9. Kalyaanamoorthy S, Minh BQ, Wong TKF, et al. ModelFinder: fast model selection for accurate phylogenetic estimates. Nat Methods. 2017;14(6):587-589.
  10. Minh BQ, Schmidt HA, Chernomor O, et al. IQ-TREE 2: new models and efficient methods for phylogenetic inference in the genomic era. Mol Biol Evol. 2020;37(5):1530-1534.