This package is a toolkit for working with Biological Observation Matrix (BIOM) files. Features include reading/writing all BIOM formats, rarefaction, alpha diversity, beta diversity (including UniFrac), summarizing counts by taxonomic level, and sample subsetting. Standalone functions for reading, writing, and subsetting phylogenetic trees are also provided. All CPU intensive operations are encoded in C with multi-thread support.
Reference material is available online at https://cmmr.github.io/rbiom/index.html
Source code can be found at https://github.com/cmmr/rbiom
The latest stable version can be downloaded from CRAN.
install.packages("rbiom")
The development version is available on GitHub.
install.packages("remotes")
::install_github("cmmr/rbiom") remotes
library(rbiom)
<- system.file("extdata", "hmp50.bz2", package = "rbiom")
infile <- read.biom(infile)
biom
# Rarefy to 1000 reads per sample
<- rarefy(biom, depth=1000)
biom
# Summarize counts by phylum
<- taxa.rollup(biom, 'Phylum')
phyla 1:4,1:6]
phyla[
# Work with metadata
table(biom$metadata$Sex, biom$metadata$Body.Site)
sprintf("Mean age: %.1f", mean(biom$metadata$Age))
# Draw the phylogenetic tree
plot(biom$phylogeny)
# Get unifrac distance matrix
<- beta.div(biom, 'unifrac') dm
Several functions will by default use all available CPU cores. To limit the number of cores used, you can set the numThreads option:
::setThreadOptions(numThreads = 4) RcppParallel