Thursday, October 26, 2017

Some simple annotation methods for phylogenetic trees

I've created a figure for an upcoming seminar in which I will review our 2015 Evolution in which I show the placement in Poe et al. (2017) of the (probably) extinct giant anole Anolis roosevelti in relation to the Puerto Rican giant Anolis cuvieri and the main clade of Puerto Rican anoles.

Here is the figure showing some basic tricks of annotation in R:

library(phytools)
tree<-read.nexus(
    "http://www.stevenpoe.net/uploads/3/7/3/4/37343605/anolepapermcctree.txt")
node.pr<-findMRCA(tree,c("crsl","strt"))
tree<-paintSubTree(tree,node.pr,"2")
node.cuv<-which(tree$tip.label=="cuvi")
tree<-paintBranches(tree,node.cuv,"2")
cols<-setNames(c("black","blue"),1:2)
plot(tree,cols,type="fan",part=0.5,lwd=2,ftype="off",ylim=c(0,0.075),
    xlim=c(-0.075,0.1))
xy<-add.arrow(tree=tree,tip="cuvi",arrl=0.006,col="blue")
text(0.99*xy$x0,1.01*xy$y0,"Anolis cuvieri",font=3,pos=4)
xy<-add.arrow(tree=tree,tip="roos",arrl=0.006,col="red")
text(0.99*xy$x0,1.01*xy$y0,"Anolis roosevelti",font=3,pos=4)
ii<-getDescendants(tree,node.pr)
ii<-ii[ii<=Ntip(tree)]
obj<-get("last_plot.phylo",envir=.PlotPhyloEnv)
text(x=mean(obj$xx[ii]),y=mean(obj$yy[ii]),"Puerto Rican clade",
    adj=c(1,-0.5))
points(obj$xx[node.pr],obj$yy[node.pr],cex=1.2,pch=21,bg="blue")

plot of chunk unnamed-chunk-1

A higher quality version can be seen here, or by clicking on the plot below:

No comments:

Post a Comment

Note: due to the very large amount of spam, all comments are now automatically submitted for moderation.