Last data update: 2014.03.03

R: Get Branching Times From Parenthetic-Format Tree ('Newick')
getBtimesR Documentation

Get Branching Times From Parenthetic-Format Tree ('Newick')

Description

Reads a file containing an ultrametric tree in parenthetic format and returns a numeric vector of branching times, sorted from earliest to most recent.

Usage

getBtimes(file = NULL, string=NULL)

Arguments

file

a file containing a single tree in 'newick' (parenthetic) format

string

the name of an object containing a 'newick' tree character string

Details

This function requires the package ape. If ape has not been attached to the search path but exists in the R directory, it will automatically be loaded. If ape does not exist, you must install it by typing install.packages("ape") at the R prompt.

If tree is not ultrametric, an error message will be generated.

Value

a numeric vector of branching times

Author(s)

Dan Rabosky drabosky@umich.edu

See Also

getBtimes.batch

Examples

data(agamids)
write.table(agamids, file = 'example.tre', quote=FALSE, 
                row.names = FALSE, col.names = FALSE)
 # the preceding lines generate a file 'example.tre' that can be 
 # read by 'getBtimes'
 
 agbtimes <- getBtimes(file = 'example.tre')
 #or alternatively:
 agbtimes <- getBtimes(string = agamids)
 #agbtimes is now a numeric vector of branching times
 
 plotLtt(agbtimes) #plot log-lineages through time for agamid data
 gamStat(agbtimes) #calculate gamma statistic for agamid data 
 unlink('example.tre') #clean-up. 

Results