Friday, March 16, 2012

Rerooting Trees

One of the things I did for today's presentation was to obtain a consensus tree from MrBayes. Since MrBayes estimates unrooted trees, I can choose the proper outgroup with which to root my tree. You can do this in programs like FigTree, but this is an R blog, after all. There is a package called geiger, which contains the necessary functions to do this.

> tree = read.nexus("Trees.nex")

I typically like to include multiple outgroups, and the easiest way to specify the outgroup might be by specifying the node number instead of the tip labels. If you plot the tree and the node labels like so

> plot(tree)
> nodelabels()

you can find the number of the root that specifies the clade of the outgroup. To root, you can use a function in ape, root.

> rerooted = root(chaettree, node = 99)

Nice and simple.

No comments:

Post a Comment