Learn R Programming

⚠️There's a newer version (2.2.0) of this package.Take me there.

rbiom

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, subsetting, visualizations, and statistical analysis. All CPU intensive operations are written in C.

Reference material is available online at https://cmmr.github.io/rbiom/index.html

Source code can be found at https://github.com/cmmr/rbiom

Installation

The latest stable version can be installed from CRAN.

install.packages("pak")
pak::pak("rbiom")

The development version is available on GitHub.

pak::pak("cmmr/rbiom")

Usage

Import and rarefy abundance counts.

library(rbiom)

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

Explore associations with metadata.

bdiv_ord_plot(biom, stat.by = "Body Site", facet.by = "Sex")

adiv_boxplot(biom, x = "Sex", adiv = c("otu", "shan"), stat.by = "Body Site")

taxa_corrplot(biom, x = "Age", layers = "ptc", taxa = 2, stat.by = "bod")

Summarize counts by taxonomic rank.

taxa_heatmap(biom, taxa = 30, tracks = c("body", "age"))

taxa_stacked(biom, rank = "Phylum")

taxa_table(biom, 'Phylum')
#> # A tibble: 294 × 8
#>    .rank  .sample .taxa          .abundance   Age   BMI `Body Site`   Sex   
#>    <fct>  <chr>   <fct>               <dbl> <dbl> <dbl> <fct>         <fct> 
#>  1 Phylum HMP01   Firmicutes            856    22    20 Buccal mucosa Female
#>  2 Phylum HMP01   Bacteroidetes         199    22    20 Buccal mucosa Female
#>  3 Phylum HMP01   Actinobacteria         16    22    20 Buccal mucosa Female
#>  4 Phylum HMP01   Proteobacteria         72    22    20 Buccal mucosa Female
#>  5 Phylum HMP01   Fusobacteria           32    22    20 Buccal mucosa Female
#>  6 Phylum HMP01   Tenericutes             0    22    20 Buccal mucosa Female
#>  7 Phylum HMP02   Firmicutes            803    24    23 Buccal mucosa Male  
#>  8 Phylum HMP02   Bacteroidetes         192    24    23 Buccal mucosa Male  
#>  9 Phylum HMP02   Actinobacteria         52    24    23 Buccal mucosa Male  
#> 10 Phylum HMP02   Proteobacteria         96    24    23 Buccal mucosa Male  
#> # ℹ 284 more rows

Copy Link

Version

Install

install.packages('rbiom')

Monthly Downloads

25,998

Version

2.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel P. Smith

Last Published

March 18th, 2025

Functions in rbiom (2.1.2)

adiv_matrix

Create a matrix of samples x alpha diversity metrics.
babies

Longitudinal Stool Samples from Infants (n = 2,684)
as_rbiom

Convert a variety of data types to an rbiom object.
adiv_corrplot

Visualize alpha diversity with scatterplots and trendlines.
as.list.rbiom

Convert an rbiom object to a base R list.
bdiv_boxplot

Visualize BIOM data with boxplots.
adiv_stats

Test alpha diversity for associations with metadata.
adiv_boxplot

Visualize alpha diversity with boxplots.
bdiv_table

Distance / dissimilarity between samples.
bdiv_ord_plot

Ordinate samples and taxa on a 2D plane based on beta diversity distances.
bdiv_clusters

Cluster samples by beta diversity k-means.
bdiv_stats

Test beta diversity for associations with metadata.
bdiv_heatmap

Display beta diversities in an all vs all grid.
biom_merge

Combine several rbiom objects into one.
bdply

Apply a function to each subset of an rbiom object.
convert_to

Convert biom data to an external package class.
bdiv_ord_table

Calculate PCoA and other ordinations, including taxa biplots and statistics.
bdiv_corrplot

Visualize beta diversity with scatterplots and trendlines.
distmat_ord_table

Run ordinations on a distance matrix.
distmat_stats

Run statistics on a distance matrix vs a categorical or numeric variable.
documentation_plot_return

documentation_plot_return
documentation_dist_test

documentation_dist_test
documentation_clusters

documentation_clusters
documentation_biom.rbiom

documentation_biom.rbiom
documentation_rank.2

documentation_rank.2
documentation_cmp

documentation_cmp
documentation_heatmap

documentation_heatmap
documentation_default

documentation_default
documentation_return.biom

documentation_return.biom
pull.rbiom

Map sample names to metadata field values.
export

Export data to QIIME 2 or mothur.
gems

Global Enteric Multicenter Study (n = 1,006)
glimpse.rbiom

Get a glimpse of your metadata.
documentation_taxa.4

documentation_taxa.4
plot_heatmap

Create a heatmap with tracks and dendrograms from any matrix.
modify_metadata

Create, modify, and delete metadata fields.
documentation_rank.NULL

documentation_rank.NULL
hmp50

Human Microbiome Project - demo dataset (n = 50)
rbiom-package

rbiom: Read/Write, Transform, and Summarize BIOM Data
read_biom

Parse counts, metadata, taxonomy, and phylogeny from a BIOM file.
rarefy

Rarefy OTU counts.
rare_stacked

Visualize the number of observations per sample.
rarefy_cols

Transform a counts matrix.
rbiom-deprecated

Deprecated functions in package rbiom.
read_fasta

Parse a fasta file into a named character vector.
rbiom_objects

Working with rbiom Objects.
rare_multiplot

Combines rare_corrplot and rare_stacked into a single figure.
rare_corrplot

Visualize rarefaction curves with scatterplots and trendlines.
read_tree

Read a newick formatted phylogenetic tree.
slice_metadata

Subset to a specific number of samples.
subset

Subset an rbiom object by sample names, OTU names, metadata, or taxonomy.
sample_sums

Summarize the taxa observations in each sample.
stats_boxplot

Visualize categorical metadata effects on numeric values.
stats_corrplot

Visualize regression with scatterplots and trendlines.
speed

Speed Ups.
stats_table

Run non-parametric statistics on a data.frame.
reexports

Objects exported from other packages
taxa_boxplot

Visualize BIOM data with boxplots.
taxa_heatmap

Display taxa abundances as a heatmap.
taxa_stats

Test taxa abundances for associations with metadata.
taxa_corrplot

Visualize taxa abundance with scatterplots and trendlines.
taxa_map

Map OTUs names to taxa names at a given rank.
with

Evaluate expressions on metadata.
taxa_sums

Get summary taxa abundances.
taxa_stacked

Display taxa abundances as a stacked bar graph.
taxa_table

Taxa abundances per sample.
tree_subset

Create a subtree by specifying tips to keep.
taxa_clusters

Cluster samples by taxa abundances k-means.
write_biom

Save an rbiom object to a file.
as.matrix.rbiom

Convert an rbiom object to a simple count matrix.
adiv_table

Calculate the alpha diversity of each sample.