Saturday, December 3, 2016

New phytools version (>=0.5-62) on its way to CRAN

In advance of a workshop I'll be teaching next week at the Universidad Nacional del Comahue in (reputedly) beautiful Bariloche, Argentina, I will be trying to get a new version of phytools on CRAN. This update will have version number >=0.5.62 (TBD).

It has been over five months since I last submitted a phytools update to CRAN. Obviously, there have been a ton of updates in that time. Here are some:

  1. A bug fix in collapseTree.
  2. More user control of the plot method for phylo.toBackbone (here).
  3. Another update to backbonePhylo to permit multiple clades to have the same label.
  4. Various updates to phylo.to.map which helped enable this nice plot:
  5. A new phytools function for showing a barplot next to a plotted tree, plotTree.barplot (1, 2, 3).
  6. A new function, related to plotTree.barplot, to plot a boxplot next to a phylogeny (plotTree.boxplot). Also see this addition permitting the boxplot to be build using the ‘formula’ method.
  7. A simple update to phyl.pca to permit more columns than rows in the input data matrix.
  8. Update to plot.cophylo to permit sigmoidal linking lines.
  9. New function to resolve a polytomous node in all possible ways. (Also here.)
  10. Function to reorder the daughter edges of a multifurcation in all possible ways.
  11. New option to rotate polytomies for co-phylogenetic plotting using the algorithm developed for [10.] (here).
  12. Speed up & fixes for collapseTree.
  13. New option to get the variance and confidence intervals for reconstructed tip states obtained using anc.ML.
  14. New function to plot the likelihood surface for the phytools function rateshift.
  15. Update to the function add.color.bar to permit the gradient color legend to be plotted vertically as well as horizontally.
  16. Additional user control of the S3 plot method for objects of class "cophylo".
  17. Updates to tip label plotting and a new S3 summary method for "cophylo" class objects.
  18. A new phytools function to find all possible node rotations of all nodes in a tree.
  19. A new exhaustive search for the cophylo function for co-phylogenetic plotting.
  20. Some updates to fitMk to permit more user control of optimization.
  21. A small fix to pass optional arguments to fitMk within make.simmap.
  22. A fun animated optimization method for cophylo. The animation, shown below, shows the tree traversal and the node rotations of the tree gradually being improved by the algorithm:
  23. A bug fix for add.color.bar.
  24. A very simple new cospeciation test in phytools.
  25. A function to compute a modified version of Grafen’s edge lengths.
  26. A cool S3 density method for objects of class "multiSimmap".
  27. Some new methods and user-control of phylogenetic scattergram plotting using fancyTree.
  28. Some updates to permit more user control of line end types in plotSimmap.
  29. An extremely simple function (bd) to pull birth & death (species & extinction) rates from an object of class "birthdeath" computed by ape.
  30. A simple new function and print method to compute AIC weights.
  31. And, finally, a bunch of other miscellaneous updates to address issues raised when updating ape & phangorn.

I know this isn't comprehensive, but it is a survey reflecting the wide range of updates & changes to the package. Of course, now that phytools is on GitHub, it's super easy to track all the committed changes the package has seen.

I'll post again when the updated phytools makes it on CRAN!

Tuesday, November 29, 2016

Some updates to phytools

I just pushed a series of updates (1, 2, 3, 4) to fix some issues raised by the authors of ape and phangorn in advance of the submission of new CRAN versions of those two packages.

The first was that I had inadvertently corrupted an S3 method multi2di of ape when I created the function multi2di.simmap without exporting a method to the namespace. The other issues came up in R CMD check and included such things as failing to import various functions from dependencies, other problems with the namespace, errors in documenting various variables, the absence of a manual page for one function (likSurface.rateshift) that is exported by phytools, and a few problems with the R code of some new functions.

I too hope to update the version of phytools on CRAN as the current version dates to June.

The latest phytools version can be installed from GitHub using devtools as follows:

library(devtools)
install_github("liamrevell/phytools")

Since both phangorn & ape are in the process of being updated, but phytools depends on the latest version of neither, you may need to do:

install_github("liamrevell/phytools",upgrade_dependencies=FALSE)

That's it.

Friday, November 18, 2016

Updates to permit user control of line end types in plotSimmap

I recently made a couple of small updates to plotSimmap - firstly, to allow user control of the line end type (lend, as in par); and secondly, for type="fan", to plot the two edges originating from the root as a single segmented line.

Here is a quick example using the latest version of phytools on GitHub:

library(phytools)
packageVersion("phytools")
## [1] '0.5.59'
data(anoletree)
plot(anoletree,lwd=5,ftype="i",fsize=0.5)
## no colors provided. using the following legend:
##        CG        GB        TC        TG        Tr        Tw 
##   "black"     "red"  "green3"    "blue"    "cyan" "magenta"

plot of chunk unnamed-chunk-1

plot(anoletree,lwd=5,ftype="i",fsize=0.5,lend=0) ## curved
## no colors provided. using the following legend:
##        CG        GB        TC        TG        Tr        Tw 
##   "black"     "red"  "green3"    "blue"    "cyan" "magenta"

plot of chunk unnamed-chunk-1

plot(anoletree,lwd=5,ftype="i",fsize=0.5,lend=1) ## mitered
## no colors provided. using the following legend:
##        CG        GB        TC        TG        Tr        Tw 
##   "black"     "red"  "green3"    "blue"    "cyan" "magenta"

plot of chunk unnamed-chunk-1

Or as type="fan"

plot(anoletree,lwd=5,ftype="i",fsize=0.8,lend=1,type="fan")
## no colors provided. using the following legend:
##        CG        GB        TC        TG        Tr        Tw 
##   "black"     "red"  "green3"    "blue"    "cyan" "magenta"
cols<-setNames(palette()[1:length(unique(getStates(anoletree,
    "tips")))],
    sort(unique(getStates(anoletree,"tips"))))
add.simmap.legend(colors=cols,x=0.9*par()$usr[1],
    y=0.9*par()$usr[4],prompt=FALSE,fsize=0.9)

plot of chunk unnamed-chunk-2

Note that the 'pixelation' (aka. aliasing) is just an effect of the rendering and disappears if the plot is rendered as a PDF, e.g.:

Finally, the purpose of plotting the two lines originating at the root as a single segmented line is the eliminate what can be an ugly overlap of the two daughter edges when plotted separately:

plotTree(tree,type="fan",lwd=4,part=0.5,lend=1,fsize=0.5)

plot of chunk unnamed-chunk-3

or:

(rendered more nicely).

That's it.