ace2tg.R

ace2tg.R takes output from the ace function of the ape package and saves ancestral character states in a list format that can easily be read by TreeExtender.pl.

Dependencies

ace2tg.R is a R function. It requires that you have a recent version of R installed. In addition, ace2tg.R uses code from the ape and geiger packages, so make sure you have these installed. They can be obtained from CRAN.

Using the program

The program is a R function that must be called from within R. The following three lines of R code show how to use it.

source("ace2tg.R")
anc <- ace(var, phy, type = "continuous", method = "ML")
ace2tg(anc, phy, var, file = "output.txt")

The first line reads the file ace2tg.R, which puts the function ace2tg into memory. The second line does the ancestral state estimation of a continuous variable (var) along a phylogeny (phy) and stores the result in a new variable (anc). The third line calls the function ace2tg, passess it the ace output (anc), the phylogeny (phy) and the original variable (var). The function saves the list file to output.txt.