Travis-CI Build Status CRAN_Status_Badge

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

Source code can be found at


The latest stable version can be downloaded from CRAN.


The development version is available on GitHub.




infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
biom <- read.biom(infile)

# Rarefy to 1000 reads per sample
biom <- rarefy(biom, depth=1000)

# Summarize counts by phylum
phyla <- taxa.rollup(biom, 'Phylum')

# Work with metadata
table(biom$metadata$Sex, biom$metadata$Body.Site)
sprintf("Mean age: %.1f", mean(biom$metadata$Age))

# Draw the phylogenetic tree

# Get unifrac distance matrix
dm <- beta.div(biom, 'unifrac')

Several functions will by default use all available CPU cores. To limit the number of cores used, you can set the numThreads option:

RcppParallel::setThreadOptions(numThreads = 4)

Try the rbiom package in your browser

Any scripts or data that you put into this service are public.

rbiom documentation built on Nov. 5, 2021, 9:11 a.m.