Recently, we wanted to test whether a specific trait evolves under different evolutionary models for different subclades of a tree. In our case genome size in amphibians. To fit Brownian motion and Ornstein-Uhlenbeck models, we used Julien Clavel’s mvMORPH R package.
Tree: pruned amphibian tree originally from Pyron 2014
Data: genome sizes (c-values) for amphibian species from Liedtke et al. 2018
library(mvMORPH)
# install from CRAN or most recent release from github: https://github.com/JClavel/mvMORPH
# make sure dependencies are installed too!
### load data:
amphibia_cval<-read.csv("./data/amphibia_cval.csv", row.names = 1, sep=";")
### load tree:
amphibia.tree<-read.tree("./data/amphibia.tre")
### match tree and data order
amphibia_cval<-amphibia_cval[amphibia.tree$tip.label,]
all(rownames(amphibia_cval)==amphibia.tree$tip.label)
## [1] TRUE
### log transform variable to be normally distributed
amphibia_logC<-log10(amphibia_cval$median_c); names(amphibia_logC)<-rownames(amphibia_cval) # log10 transform data
### plot phenogram to vizualize trait distribution
phenogram(amphibia.tree, amphibia_logC, ftype = "off", ylab="genome size [log10(c-value)]")