Overview
In comparative plant demography and life history research, a phylogenetic tree is often essential for accounting for evolutionary relationships among species.
This guide demonstrates how to create and visualise a phylogeny for species in the COMPADRE Plant Matrix Database, using the V.PhyloMaker2 package.
We will:
- Extract a species list from COMPADRE.
- Build a phylogeny using the R package V.PhyloMaker2.
- Check and adjust the tree (e.g. make ultrametric and binary as needed).
- Plot the tree in a radial layout for easy visualisation.
- Save the output for future analyses.
The steps outlined here are particularly useful for users preparing data for phylogenetic comparative methods (e.g., PGLS, phylogenetic signal analyses).
Prerequisites
# Install packages if not already installed
# install.packages("Rcompadre")
# devtools::install_github("jinyizju/V.PhyloMaker2")
library(V.PhyloMaker2)
library(Rcompadre)
library(dplyr)
library(ape)
Step 1: Fetch COMPADRE data
compadre <- cdb_fetch("compadre")
Step 2: Extract species list
We then build a unique species list that contains the genus, species, and family for each entry. This is the minimal information required by V.PhyloMaker2 to construct the phylogeny.
At this point you could modify the code to subset the data further - for example to include only the species in your analysis.
speciesList <- cdb_metadata(compadre) %>%
select(Genus, Species, Family) %>%
distinct() %>%
mutate(Species = paste(Genus, Species)) %>%
select(Species, Genus, Family)
Step 3: Build the phylogeny
The function builds the phylogeny with 3 scenarios. We recommend Scenario 3 (S3), which maximally resolves the phylogeny by inserting all species as polytomies within their genera, and attaches genera to the family backbone as polytomies if genus-level relationships are missing. This produces the most fully-resolved tree possible given the input data.
result <- phylo.maker(speciesList, scenarios = "S3")
Step 4: Check and adjust the tree
It is good practice to check if the tree meets the assumptions of your downstream analyses.
- Ultrametric trees are required for some evolutionary models (e.g., Brownian motion trait evolution).
- Binary trees ensure no nodes have more than two descendants, as required by many phylogenetic algorithms.
if (!is.ultrametric(tree)) {
tree <- chronos(tree)
}
tree <- multi2di(tree)
Step 5: Plot the phylogeny
The fan
type plots the tree radially, which is often clearer for large phylogenies. Adjust cex
to control label size.
plot.phylo(tree, type = "fan", cex = 0.5, main = "COMPADRE Phylogeny (Scenario 3)")
Step 6: Save outputs
save(result, tree, file = "CompadrePhylogeny.Rdata")
The resulting tree should be treated as a working phylogeny. It reflects the best structure possible given the available backbone and taxonomic information but does not necessarily replace published phylogenies for specific clades, which may be more accurate.
Users should be aware of potential mismatches or errors in species names. You may wish to clean or check your species list against authoritative taxonomies (e.g. The Plant List).
References
- Jin, Y., & Qian, H. (2022). V.PhyloMaker2: an updated and enlarged R package that can generate very large phylogenies for vascular plants. Plant Diversity, 44(4), 335-339.