Monday, March 18, 2013

New option in fancyTree for visualizing the uncertainty of ancestral states

A few weeks ago I posted about visualizing uncertainty in ancestral state reconstructions using phenogram. Well, this seems like a neat thing to be able to do easily, so I have added it as a new method in fancyTree, my grab-bag of phylogeny plotting methods for the phytools package. Since I already discussed this method in my earlier post, I won't repeat that here. However, I will mention something about the handy function do.call. This function allows use to execute another function and give that function it's arguments in a named list. This is useful because what it effectively can be used for is to pass the arguments of a three-dot (...) list, modify them or remove certain arguments, if we want, and then pass to another function. Look inside the latest version of fancyTree to see what I mean.

Although you can download the source code for the new fancyTree function here - since it depends on the latest update of the phytools function phenogram, I would recommend instead that users interested in this function install the latest phytools build from source (phytools 0.2-28).

Here's a quick demo:

> require(phytools)
> packageVersion("phytools")
[1] ‘0.2.28’
> tree<-pbtree(n=30)
> x<-fastBM(tree)
> fancyTree(tree,type="phenogram95",x=x)

Most, but not all, of the phenogram options can be passed to fancyTree(...,type="phenogram95") - although the defaults are different (as evident above).

1 comment: