Hi Simon.
By this, do you mean the age of the start of the edge leading to the
MRCA of a set of taxa? This is easy using phytools.
If you want to get this age as the height above the root:
H<-nodeHeights(tree)
## tips are the species in the clade, or a subset of the species
## such that the MRCA of tips is the MRCA of the clade
nn<-findMRCA(tree,tips)
h<-H[tree$edge==phytools:::getAncestors(tree,nn,"parent")][1]
Use of getAncestors requires a recent non-CRAN version of phytools -
otherwise you can load phangorn & substitute Ancestors.
If you want the time from the present in an ultrametric tree, just do:
H<-max(H)-H
and then repeat the same.
All the best, Liam
Liam J. Revell, Assistant Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org
On 2/13/2014 12:16 AM, Simon Greenhill wrote:
Hi all,
What's the easiest way to get the stem age of a given clade of a tree?
Many thanks,
Simon
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/