Skip to contents

Input / Output

Read and write BIOM, FASTA, Newick, and tabular data. Includes tools to convert to/from other popular formats like phyloseq, TreeSummarizedExperiment, and QIIME 2.

as_rbiom()
Convert a variety of data types to an rbiom object.
read_biom()
Parse counts, metadata, taxonomy, and phylogeny from a BIOM file.
read_fasta()
Parse a fasta file into a named character vector.
read_tree()
Read a newick formatted phylogenetic tree.
write_mothur() write_qiime2()
Export data to QIIME 2 or mothur.
write_biom() write_metadata() write_counts() write_taxonomy() write_fasta() write_tree() write_xlsx()
Save an rbiom object to a file.
convert_to_SE() convert_to_TSE() convert_to_phyloseq() convert_to_animalcules()
Convert biom data to an external package class.

The rbiom Object

The rbiom object serves as the core container for data, providing user-friendly accessors for $counts, $metadata, $taxonomy, $tree, and $sequences.

rbiom_objects
Working with rbiom Objects.
as.list(<rbiom>)
Convert an rbiom object to a base R list.
as.matrix(<rbiom>)
Convert an rbiom object to a simple count matrix.

Sample Metadata

Access and manipulate sample metadata directly from the rbiom object using familiar dplyr-like verbs.

pull(<rbiom>)
Map sample names to metadata field values.
with(<rbiom>) within(<rbiom>)
Evaluate expressions on metadata.
mutate(<rbiom>) rename(<rbiom>)
Create, modify, and delete metadata fields.
glimpse(<rbiom>)
Get a glimpse of your metadata.

Subsetting

Filter samples based on metadata conditions or apply functions to subsets of the data (split-apply-combine).

subset(<rbiom>) `[`(<rbiom>) na.omit(<rbiom>) subset_taxa()
Subset an rbiom object by sample names, OTU names, metadata, or taxonomy.
slice(<rbiom>) slice_head(<rbiom>) slice_tail(<rbiom>) slice_min(<rbiom>) slice_max(<rbiom>) slice_sample(<rbiom>)
Subset to a specific number of samples.
bdply() blply()
Apply a function to each subset of an rbiom object.

Taxa Abundance

Aggregates counts to specific taxonomic ranks (e.g. Genus, Phylum) to test for differential abundance and generate visualizations like stacked bar charts, heatmaps, and boxplots.

taxa_boxplot()
Visualize BIOM data with boxplots.
taxa_clusters()
Cluster samples by taxa abundances k-means.
taxa_corrplot()
Visualize taxa abundance with scatterplots and trendlines.
taxa_heatmap()
Display taxa abundances as a heatmap.
taxa_map()
Map OTUs names to taxa names at a given rank.
taxa_table() taxa_matrix()
Taxa abundances per sample.
taxa_stacked()
Display taxa abundances as a stacked bar graph.
taxa_stats()
Test taxa abundances for associations with metadata.
taxa_sums() taxa_means() taxa_apply()
Get summary taxa abundances.

Alpha Diversity

Calculate within-sample diversity metrics (Shannon, Simpson, Richness, etc.) and correlate them with metadata using boxplots and statistical tests.

adiv_boxplot()
Visualize alpha diversity with boxplots.
adiv_corrplot()
Visualize alpha diversity with scatterplots and trendlines.
adiv_stats()
Test alpha diversity for associations with metadata.
adiv_table() adiv_matrix() adiv_vector()
Calculate the alpha diversity of each sample.
sample_sums() sample_apply()
Summarize the taxa observations in each sample.

Beta Diversity

Compare samples to one another using distance metrics (Bray-Curtis, UniFrac, etc.) and visualize patterns with Ordinations (PCoA, NMDS) and clustering.

bdiv_boxplot()
Visualize BIOM data with boxplots.
bdiv_clusters()
Cluster samples by beta diversity k-means.
bdiv_corrplot()
Visualize beta diversity with scatterplots and trendlines.
bdiv_heatmap()
Display beta diversities in an all vs all grid.
bdiv_ord_plot()
Ordinate samples and taxa on a 2D plane based on beta diversity distances.
bdiv_ord_table()
Calculate PCoA and other ordinations, including taxa biplots and statistics.
bdiv_stats()
Test beta diversity for associations with metadata.
bdiv_table() bdiv_matrix() bdiv_distmat()
Distance / dissimilarity between samples.

Rarefaction Plots

Visualize how sequencing depth affects diversity metrics and taxa discovery (rarefaction curves).

rare_corrplot()
Visualize rarefaction curves with scatterplots and trendlines.
rare_multiplot()
Combines rare_corrplot and rare_stacked into a single figure.
rare_stacked()
Visualize the number of observations per sample.

Transforming Counts

Normalize and transform count data, including rarefaction to a fixed depth, converting to relative abundance, and inflation/rescaling.

rarefy()
Rarefy Counts to a Constant Depth
biom_inflate()
Inflate Relative Abundances to Integer Counts
biom_relativize()
Relativize Counts to Proportions
biom_rescale()
Rescale Counts to a Specific Range
suggest_rarefy_depth()
Suggest Rarefaction Depth
suggest_inflate_depths()
Suggest Inflation Depths
biom_merge()
Combine several rbiom objects into one.

Low Level Functions

Generic statistical and plotting functions that work on standard R data structures (matrices, data.frames, trees) rather than rbiom objects.

distmat_ord_table()
Run ordinations on a distance matrix.
distmat_stats()
Run statistics on a distance matrix vs a categorical or numeric variable.
stats_boxplot()
Visualize categorical metadata effects on numeric values.
stats_corrplot()
Visualize regression with scatterplots and trendlines.
stats_table()
Run non-parametric statistics on a data.frame.
tree_subset()
Create a subtree by specifying tips to keep.
plot_heatmap()
Create a heatmap with tracks and dendrograms from any matrix.

Datasets

Built-in microbiome datasets for testing and examples.

hmp50
Human Microbiome Project - demo dataset (n = 50)
gems
Global Enteric Multicenter Study (n = 1,006)
babies
Longitudinal Stool Samples from Infants (n = 2,684)

Deprecated Functions

Functions that have been superseded by newer alternatives.