Thursday, February 9, 2017

New package for creating phylogenies 'free-hand' in R: physketch

I have started working on a new mini-project, called physketch with the intention of creating a variety of “free-hand” functions that will allow the user to draw trees on the screen in R which then will be turned into objects of class "phylo" for use in other functions or methods.

The inspiration for this comes from the function that I wrote about a week ago to draw a phylogeny on top of a raster image of a plotted tree, along with some other related methods that I have in mind.

The package - though consisting so far of only this one function (renamed phylo.tracer) can already be downloaded & installed from GitHub using devtools. I added a couple of features to the function. In particular, it can now take either a file name of an image in .jpg format or a raster image as input (consequentially depending on the package jpeg, and it now by default overlays grid lines on the plotted raster image to help the user more easily identify the branching points of common ancestors on the tree.

Here is a quick demo - first of the installation from GitHub:


Now a demo (similar to what I showed before: 1, 2) of this method with its new features:


and, of course, the result:


plot of chunk unnamed-chunk-3

Note that the tip order changes depending on the the order in which tips are added to the tree - but, rest assured, the topology & branch lengths are correct.

Finally, this example comes from Kocot et al. (2011).

No comments:

Post a Comment