joey711/phyloseq — pull request #228 by joey711 (2013-07-30 07:00:36+00:00)
Title: v1.5.20 Bugfixes, `read_tree_greengenes`, and a `replace` optional parameter to rarefy_even_depth()

Solves Issues:
https://github.com/joey711/phyloseq/issues/223
and
https://github.com/joey711/phyloseq/issues/224

Specifically:

-- read_tree_greengenes() is a new function created specifically to address the problem
created when the greengenes consortium chose to publish their official release trees
with semicolon-delimited node labels, even though semicolons are also a special newick character.
The semicolons only appear when a node has more than one taxonomic rank assigned to it,
which is rare in the smaller (lower OTU similarity threshold) trees, but a big problem
in all the most commonly used trees, e.g. 97% tree.
The hard part was identifying the precise cause of the problem. Now that it is precisely known,
the offending delimiters are temporarily replaced so that the standard parser `read.tree`
can create the phylo object, then they are reinstated.
Unit tests have been added to check that this works properly on a GreenGenes release tree
that otherwise breaks `read.tree`.
This also solves 224
https://github.com/joey711/phyloseq/issues/224

-- Fixed a bug in which the highest taxonomic rank fails in `tax_glom`
This was a bug resulting from the automatic coercion of single-column
matrix subsetting to a vector. Simply changing the relevant line
of code in `tax_glom` such that [, , drop=FALSE],
solve this issue, Issue 223
https://github.com/joey711/phyloseq/issues/223
Unit tests have been added that should catch this in the future.

-- rarefy_even_depth() new option to sample without replacement.
Two implications to consider are that
(1) sampling with replacement is faster and more memory efficient
as currently implemented;
(2) sampling with replacement means that there is a chance that the
number of reads for a given OTU in a given sample could be larger
than the original count value. This is in contrast to sampling without replacement
where the original count value is the maximum possible.
Prior to this phyloseq version,
this `replace` parameter did not exist and sampling with replacement was the only
random subsampling implemented in the `rarefy_even_depth` function.
This prior behavior was selected for computational efficiency, but
differs from the behavior of analogous functions in related packages
(e.g. rarefying in QIIME).