Wednesday, October 10, 2012

New test version of phytools (v0.2-02) with xkcdTree and new version of pgls.Ives

I just posted a new non-CRAN version of phytools (version 0.2-02). To install, just download phytools_0.2-02.tar.gz and install from source:

> install.packages("phytools_0.2-02.tar.gz",type="source", repos=NULL)
...
* installing *source* package 'phytools' ...
...
* DONE (phytools)
> require(phytools)
Loading required package: phytools
Loading required package: ape
...

With respect to phytools v0.2-01 this version has two additions:

1) An update to pgls.Ives. pgls.Ives implements the method of Ives et al. (2007) for phylogenetic regression with error in the estimation of species means. Basically, I was discovering that sometimes optimization failed due to the (arbitrarily specified) lower bounds required for σy2 and σx2 by the optimization method, optim(...,method="L-BFGS-B"). I have now decreased the default value for these bounds (by a factor of 10e-4) and also allow user control. Other aspects of control of optim are still not under user control, so I will change that. The function now also returns convergence and message from optim (basically optim's report on whether or not it thinks it has converged).

2) I have added the function xkcdTree to the phytools package. I documented xkcdTree in several prior posts (1, 2, 3, 4, 5) and I won't repeat that documentation here. Suffice it to say that the function plots a phylogenetic tree in the style of xkcd style graph (in other words, hand drawn with a particular all-caps style of font). I decided to develop this function on a whim and without any real intention of adding it to phytools, but it generated a huge amount of traffic to my blog (with many visitors coming from several a number of tweets that my posts on this function stimulated, see below).


Consequently, I have added the function to phytools with the following caveats:
a) phytools users wanting to plot xkcd style trees with phytools will first need to download and install the font 'xkcd.ttf' (just search for it);
b) users will also have to download and install the CRAN package extrafont and its dependencies - phytools will not load these dependencies of xkcdTree automatically; and
c) at least Windows users of R will have to download and install Ghostscript - this is required to embed the xkcd font into the PDF file with your tree.

Hopefully, xkcdTree will return a sensible error if you try to run it but have not taken one of the above three steps!

xkcdTree can be called on its own, or through fancyTree(...,type="xkcd").

With respect to the latest CRAN release of phytools, this new package version also has two more new functions: fastAnc and matchNodes (see 1 & 2), as well as updates to a number of other functions that now call fastAnc instead of the much slower (and sometimes quite inaccurate) anc.ML.

5 comments:

  1. I have little experience installing from source and I am getting this warning:

    "Installing package(s) into ‘C:/Users/Andres/Documents/R/win-library/2.15’
    (as ‘lib’ is unspecified)
    ERROR: dependency 'rgl' is not available for package 'phytools'
    * removing 'C:/Users/Andres/Documents/R/win-library/2.15/phytools'
    Warning messages:
    1: running command 'C:/PROGRA~1/R/R-215~1.1/bin/x64/R CMD INSTALL -l "C:/Users/Andres/Documents/R/win-library/2.15" "phytools_0.2-02.tar.gz"' had status 1
    2: In install.packages("phytools_0.2-02.tar.gz", type = "source", repos = NULL) :
    installation of package ‘phytools_0.2-02.tar.gz’ had non-zero exit status
    "

    I am using the desktop as working directory, and the downloaded file is there.
    Windows, R version 2.15.1

    ReplyDelete
  2. Hi Andres.

    OK - this is probably because installing from a source file on your local computer (rather than from CRAN) means that dependencies will not be automatically be downloaded and installed.

    My advice is to install the previous version of phytools from CRAN using (in a fresh session of R):

    install.packages("phytools") # then select repository

    Then, you can install the new version from source and you can be assured that all the dependencies will be there (since they have not changed from the latest CRAN version):

    install.packages("phytools_0.2-02.tar.gz",type="source", repos=NULL)
    library(phytools)
    packageVersion("phytools")

    Let us know if that works. - Liam

    ReplyDelete
    Replies
    1. Hi Liam,

      It worked :D

      Now:
      > packageVersion("phytools")
      [1] ‘0.2.0’

      Thank you very much.

      Delete
    2. Andres - If you have updated to the release linked from this post, then you should see:

      > packageVersion("phytools")
      [1] '0.2-02'

      or maybe:

      > packageVersion("phytools")
      [1] '0.2.2'

      What you're seeing is the latest CRAN version (which is fine, if you don't need fastAnc & xkcdTree).

      - Liam

      Delete

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