Phylogenetic tree calibration

Silvia Castiglione, Carmela Serio, Pasquale Raia

scaleTree tool

The function scaleTree is a useful tool to deal with phylogenetic age calibration written around Gene Hunt’s scalePhylo function (http://paleobiology.si.edu/staff/individuals/hunt.cfm). It rescales branches and leaves of the tree according to species and/or nodes calibration ages (meant as distance from the youngest tip within the tree).

If only species ages are supplied (argument tip.ages), the function changes leaves length, leaving node ages and internal branch lengths unaltered. When node ages are supplied (argument node.ages), the function shifts nodes position along their own branches while keeping other nodes and species positions unchanged.

sp.ages
#>    t9   t73   t11   t43   t78   t46   t52   t26 
#> 1.250 1.205 0.000 2.430 3.150 1.050 0.000 1.550
scaleTree(tree,tip.ages=sp.ages)->treeS1
nod.ages
#>   98  152  123   85  118  127  164  143 
#> 10.7  0.7  1.2 12.6  5.1  5.8 18.8 12.8
scaleTree(tree,node.ages=nod.ages)->treeS2

It may happen that species and/or node ages to be calibrated are older than the age of their ancestors. In such cases, after moving the species (node) to its target age, the function reassembles the phylogeny above it by assigning the same branch length (set through the argument min.branch) to the all the branches along the species (node) path, so that the tree is well-conformed and ancestor-descendants relationships remain unchanged. In this way changes to the original tree topology only pertain to the path along the “calibrated” species.

c(sp.ages,nod.ages)
#>   t1   96 
#> 20.5 15.6
scaleTree(tree,tip.ages = sp.ages,node.ages = nod.ages,min.branch = 1)->treeS

Guided examples

# load the RRphylo example dataset including Felids tree
data("DataFelids")
DataFelids$treefel->tree

# get species and nodes ages 
# (meant as distance from the youngest species, that is the Recent in this case)
max(nodeHeights(tree))->H
H-dist.nodes(tree)[(Ntip(tree)+1),(Ntip(tree)+1):(Ntip(tree)+Nnode(tree))]->age.nodes
H-diag(vcv(tree))->age.tips

# apply Pagel's lambda transformation to change node ages only 
rescale(tree,"lambda",0.8)->tree1

# apply scaleTree to the transformed phylogeny, by setting
# the original ages at nodes as node.ages
scaleTree(tree1,node.ages=age.nodes)->treeS1

# change leaf length of 10 sampled species
tree->tree2
set.seed(14)
sample(tree2$tip.label,10)->sam.sp
age.tips[sam.sp]->age.sam
age.sam[which(age.sam>0.1)]<-age.sam[which(age.sam>0.1)]-1.5
age.sam[which(age.sam<0.1)]<-age.sam[which(age.sam<0.1)]+0.2
tree2$edge.length[match(match(sam.sp,tree$tip.label),tree$edge[,2])]<-age.sam

# apply scaleTree to the transformed phylogeny, by setting
# the original ages at sampled tips as tip.ages
scaleTree(tree2,tip.ages=age.tips[sam.sp])->treeS2

# apply Pagel's kappa transformation to change both species and node ages, 
# including the age at the tree root
rescale(tree,"kappa",0.5)->tree3

# apply scaleTree to the transformed phylogeny, by setting
# the original ages at nodes as node.ages
scaleTree(tree1,tip.ages = age.tips,node.ages=age.nodes)->treeS3