Skip to contents

Subsamples feature counts to equalize sequencing depth across samples.

Usage

mStat_rarefy_data(data.obj, depth = NULL)

Arguments

data.obj

A MicrobiomeStat data object, which is a list containing at minimum the following components:

  • feature.tab: A matrix of feature abundances (taxa/genes as rows, samples as columns)

  • meta.dat: A data frame of sample metadata (samples as rows)

Optional components include:

  • feature.ann: A matrix/data frame of feature annotations (e.g., taxonomy)

  • tree: A phylogenetic tree object (class "phylo")

  • feature.agg.list: Pre-aggregated feature tables by taxonomy

Data objects can be created using converters like mStat_convert_phyloseq_to_data_obj or importers like mStat_import_qiime2_as_data_obj.

depth

Numeric value or NULL. Rarefaction depth for rarefaction workflows. If NULL, uses the minimum sample depth.

Value

A MicrobiomeStat data object with rarefied feature table.

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)
} # }