ape: Analyses of Phylogenetics and Evolution

Emmanuel Paradis, Simon P. Blomberg, Benjamin M. Bolker, Joseph W. Brown, Santiago Claramunt, Julien Claude, Hoa Sien Cuong, Richard Desper, Gilles Didier, Bernard Durand, Julien Y. Dutheil, Rj Ewing, Olivier Gascuel, Thomas Guillerme, Christoph Heibl, Anthony R. Ives, Bradley R. Jones, Franz‐Sebastian Krah, Daniel J. Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, G. Louvel, Éric Marcon, Rosemary M. McCloskey, Johan A. A. Nylander, Rainer Opgen-Rhein, Andrei-Alin Popescu, Manuela Royer‐Carenzi, Klaus Schliep, Korbinian Strimmer, Damien M. de VienneOpenalex Unknown 2002 · DOI · OpenAlex

Abstract

Functions for reading, writing, plotting, and manipulating phylogenetic trees, analyses of comparative data in a phylogenetic framework, ancestral character analyses, analyses of diversification and macroevolution, computing distances from DNA sequences, reading and writing nucleotide sequences as well as importing from BioConductor, and several tools such as Mantel's test, generalized skyline plots, graphical exploration of phylogenetic data (alex, trex, kronoviz), estimation of absolute evolutionary rates and clock-like trees using mean path lengths and penalized likelihood, dating trees with non-contemporaneous sequences, translating DNA into AA sequences, and assessing sequence alignments. Phylogeny estimation can be done with the NJ, BIONJ, ME, MVR, SDM, and triangle methods, and several methods handling incomplete distance matrices (NJ, BIONJ, MVR*, and the corresponding triangle method). Some functions call external applications (PhyML, Clustal, T-Coffee, Muscle) whose results are returned into R.

Introduction

The ape package provides a comprehensive suite for phylogenetic analysis. Source, p. 7

The ape package provides a comprehensive suite for phylogenetic analysis.

In the early stages of computational biology, phylogenetic analysis was a fragmented field. Researchers were often forced to navigate between disparate, incompatible standalone programs to perform tasks such as sequence alignment, tree estimation, and hypothesis testing. A significant challenge was the lack of a unified environment where statistical tests on traits—such as body size—could be performed while accounting for the non-independence of species due to common ancestry.

The 'ape' (Analyses of Phylogenetics and Evolution) package addresses this by integrating phylogenetics into the R statistical environment. By introducing standardized data objects, most notably the phylo class, 'ape' allows phylogenetic trees to be treated as formal statistical structures. This integration enables researchers to move seamlessly from raw genomic data to complex evolutionary models.

Methods and Data Structures

The package provides a vast library of methods, characterized by several key technical approaches:

Efficient Data Handling

'ape' utilizes bit-level coding for DNA (DNAbin) and amino acid (AAbin) sequences. This approach allows R to store and manipulate large genomic datasets in memory far more efficiently than standard character strings.

The AAbin class for efficient amino acid sequence storage.

Tree Estimation and Comparative Statics

While 'ape' can interface with external high-performance tools like PhyML for maximum likelihood estimation, it also contains native implementations of distance-based methods, including Neighbor-Joining (NJ), BIONJ, and Minimum Evolution (ME). Specialized versions (NJ, BIONJ) are included to handle incomplete distance matrices.

For comparative analysis, the package implements Phylogenetically Independent Contrasts (PIC) and Phylogenetic Generalized Linear Mixed Models (PGLMM). These methods are crucial for correcting "phylogenetic signal"—the statistical bias inherent in data from related species.

Molecular Dating

Sophisticated tools for "clock-like" tree estimation, such as chronos and chronopl, are included. These use penalized likelihood to estimate absolute evolutionary rates, even in the absence of a perfectly constant molecular clock.

Key Insights: The Tree as a Covariance Matrix

A fundamental insight provided by 'ape' is the representation of a phylogenetic tree as a variance-covariance matrix (vcv). This transformation allows evolutionary history to be incorporated directly into standard regression models. Furthermore, 'ape' acts as a bridge, wrapping external optimized C++ programs like Clustal, T-Coffee, or Muscle for alignment, and returning the results to R for statistical analysis. Interactive tools like alex (Alignment Explorer) and trex (Tree Explorer) facilitate the exploration of massive datasets.

Datasets and Results

The package documentation highlights several benchmark datasets:

  • woodmouse: 15 Cytochrome b gene sequences for demonstrating sequence manipulation.
  • bird.orders & bird.families: Phylogenies based on Sibley and Ahlquist’s DNA-DNA hybridization work.
  • carnivora: 112 observations across 17 variables for analyzing trait evolution.
  • hivtree: A clock-like phylogeny of 193 HIV-1 sequences used for population size estimation via skyline plots.

'ape' supports 28 different models of DNA evolution and provides robust metrics for tree comparison, such as the Robinson-Foulds distance. The ace (Ancestral Character Estimation) function allows for the reconstruction of ancestral states for both continuous and discrete traits.

Limitations and Conclusion

While 'ape' is highly efficient, some functions may become computationally expensive as tree sizes reach tens of thousands of tips. Additionally, 'ape' focuses primarily on frequentist and likelihood-based methods; Bayesian inference is typically handled by complementary tools like BEAST.

In conclusion, 'ape' serves as the foundational infrastructure for modern comparative biology. Its continued development ensures that R remains a primary platform for evolutionary data science, providing the essential tools for reading, manipulating, and analyzing the history of life.

Summary updated

Abstract

Functions for reading, writing, plotting, and manipulating phylogenetic trees, analyses of comparative data in a phylogenetic framework, ancestral character analyses, analyses of diversification and macroevolution, computing distances from DNA sequences, reading and writing nucleotide sequences as well as importing from BioConductor, and several tools such as Mantel's test, generalized skyline plots, graphical exploration of phylogenetic data (alex, trex, kronoviz), estimation of absolute evolutionary rates and clock-like trees using mean path lengths and penalized likelihood, dating trees with non-contemporaneous sequences, translating DNA into AA sequences, and assessing sequence alignments. Phylogeny estimation can be done with the NJ, BIONJ, ME, MVR, SDM, and triangle methods, and several methods handling incomplete distance matrices (NJ*, BIONJ*, MVR*, and the corresponding triangle method). Some functions call external applications (PhyML, Clustal, T-Coffee, Muscle) whose results are returned into R.
BibTeX
@inproceedings{paradis2002ape,
  author = {Emmanuel Paradis and Simon P. Blomberg and Benjamin M. Bolker and Joseph W. Brown and Santiago Claramunt and Julien Claude and Hoa Sien Cuong and Richard Desper and Gilles Didier and Bernard Durand and Julien Y. Dutheil and RJ Ewing and Olivier Gascuel and Thomas Guillerme and Christoph Heibl and Anthony R. Ives and Bradley R. Jones and Franz‐Sebastian Krah and Daniel J. Lawson and Vincent Lefort and Pierre Legendre and Jim Lemon and G. Louvel and Éric Marcon and Rosemary M. McCloskey and Johan A. A. Nylander and Rainer Opgen-Rhein and Andrei-Alin Popescu and Manuela Royer‐Carenzi and Klaus Schliep and Korbinian Strimmer and Damien M. de Vienne and Damien de Vienne and Daniel John Lawson},
  title = {{ape: Analyses of Phylogenetics and Evolution}},
  booktitle = {Openalex Unknown},
  year = {2002},
  doi = {10.32614/cran.package.ape},
}
Figure