Skip to contents

This function takes an input object containing an OTU table and optionally a specified rarefaction depth. If no depth is specified, the smallest column sum is chosen as the depth. It rarefies the data to the specified depth and returns the object with the rarefied OTU table.

Usage

mStat_rarefy_data(data.obj, depth = NULL)

Arguments

data.obj

A list object in a format specific to MicrobiomeStat, which can include components such as feature.tab (matrix), feature.ann (matrix), meta.dat (data.frame), tree, and feature.agg.list (list). The data.obj can be converted from other formats using several functions from the MicrobiomeStat package, including: 'mStat_convert_DGEList_to_data_obj', 'mStat_convert_DESeqDataSet_to_data_obj', 'mStat_convert_phyloseq_to_data_obj', 'mStat_convert_SummarizedExperiment_to_data_obj', 'mStat_import_qiime2_as_data_obj', 'mStat_import_mothur_as_data_obj', 'mStat_import_dada2_as_data_obj', and 'mStat_import_biom_as_data_obj'. Alternatively, users can construct their own data.obj. Note that not all components of data.obj may be required for all functions in the MicrobiomeStat package.

depth

Depth at which to rarefy; if not provided, defaults to the smallest column sum.

Value

The input object with the rarefied OTU table added.

Examples

if (FALSE) { # \dontrun{
# Load required libraries and data
library(vegan)
data(peerj32.obj)
# Perform aggregation to create feature.agg.list with Phylum and Family
peerj32.obj <- mStat_aggregate_by_taxonomy(peerj32.obj, c("Phylum", "Family"))
# Perform rarefication, remove all-zero rows and update feature.agg.list
rarefy_peerj32.obj <- mStat_rarefy_data(data.obj = peerj32.obj)
} # }