Friday, June 24, 2016

Interactive version of phylo.toBackbone

I just created a new interactive version of the phytools function phylo.toBackbone, which creates a backbone phylogeny in which some clades are represented as triangles. This tree can then we plotted with an S3 plot method for the object class "backbonePhylo". Most of the code changes can be seen here. The updates are kind of hacky - principally because the original version of this appears to have been coded by me in 2013.

In previous versions of this function (e.g., 1, 2) the user had to supply the backbone tree as input along with a translation table. This is still possible, or course; however the current version allows the user to collapse clades into triangles by clicking on the fully plotted tree. This should be a nice feature for some users.

Obviously, interactive mode is kind of difficult to demonstrate - consequently I have embedded a screenshot video of a demo at the bottom. The following is just an illustration of the product. Remember for publication to save to PDF (or another line art format) to avoid aliasing, particularly on the edges of the triangles.

library(phytools)
packageVersion("phytools")
## [1] '0.5.38'
obj
## 
## Backbone phylogenetic tree with 15 subtrees and 14 resolved internal nodes.
## 
## Labels: t40, t10, t27, t13, t39, ...
## Diversities: 1, 1, 1, 1, 1, ...
plot(obj) ## defaults

plot of chunk unnamed-chunk-1

cols ## color some of the clades
##  Clade 1  Clade 2  Clade 4 
##  "black"    "red" "green3"
par(cex=0.8) ## change font size
par(font=3) ## change font type
plot(obj,col=cols,vscale=0.7)

plot of chunk unnamed-chunk-1

Here is the interactive demo:

3 comments:

  1. No puedo ver el video, dice que es un video privado.

    ReplyDelete
  2. Thank you Liam!
    I have an issue with this function phylo.toBackbone. When I click on 'click to stop' after having named all collapsed clades, it doesn't recognize my click as a stop signal. It thinks I've selected the closest to the stop-box node. So I have no way to stop it...
    I'm using Mac by the way, maybe, this is the issue?

    ReplyDelete

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