mcknight_residuals_pq: Depth-robust alpha diversity residuals (McKnight / Mikryukov)

View source: R/normalize_pq.R

mcknight_residuals_pqR Documentation

Depth-robust alpha diversity residuals (McKnight / Mikryukov)

Description

lifecycle-experimental

Computes the residuals from a linear regression of \log(\text{richness}) against \log(\text{sequencing depth}) as a depth-robust alpha diversity metric (Mikryukov et al. 2023; McKnight et al. 2018, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5061/dryad.tn8qs35")}). This avoids discarding data through rarefaction.

Usage

mcknight_residuals_pq(physeq, add_to_sam_data = TRUE)

Arguments

physeq

(required) a phyloseq-class object obtained using the phyloseq package.

add_to_sam_data

(logical, default TRUE) if TRUE, a column mcknight_residuals is added to sample_data(physeq) and the augmented phyloseq object is returned. If FALSE, the numeric residuals vector is returned.

Value

Either a phyloseq object with an augmented sample_data (default) or a named numeric vector of residuals.

Author(s)

Adrien Taudière

Examples

data_f_res <- mcknight_residuals_pq(data_fungi_mini)
head(sample_data(data_f_res)$mcknight_residuals)

MiscMetabar documentation built on June 8, 2026, 5:07 p.m.