transform_pq: Unified dispatcher for all OTU-table transformations and...

View source: R/normalize_pq.R

transform_pqR Documentation

Unified dispatcher for all OTU-table transformations and normalisations

Description

lifecycle-experimental

Single entry-point for all count-table transformations available in MiscMetabar. Ecological methods ("tss", "hellinger", "clr", "rclr", "log1p", "z", "pa", "rank") are delegated to vegan::decostand(). Library-size normalisation methods ("rarefy", "srs", "gmpr", "css", "tmm", "vst") and the McKnight log-log residual method ("mcknight_residuals") are delegated to their dedicated ⁠*_pq()⁠ functions. All ... arguments are forwarded to the underlying function.

Usage

transform_pq(
  physeq,
  method = c("tss", "hellinger", "clr", "rclr", "log1p", "z", "pa", "rank",
    "normalize_prop", "rarefy", "srs", "gmpr", "css", "tmm", "vst", "mcknight_residuals"),
  pseudocount = 1,
  ...
)

Arguments

physeq

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

method

(character, default "tss") transformation to apply. One of:

"tss"

Total Sum Scaling — divide by library size.

"hellinger"

Square-root of proportions. Good for ordination.

"clr"

Centred log-ratio (adds pseudocount to handle zeros).

"rclr"

Robust CLR (adds pseudocount to handle zeros).

"log1p"

\log(1 + x) transformation.

"z"

Per-taxon z-score standardisation.

"pa"

Presence/absence (0/1).

"rank"

Replace counts by within-sample ranks.

"normalize_prop"

TSS × constant + log, via normalize_prop_pq().

"rarefy"

Rarefaction to equal depth, via rarefy_pq().

"srs"

Scaling with Ranked Subsampling, via srs_pq(). Requires the SRS package.

"gmpr"

Geometric Mean of Pairwise Ratios, via gmpr_pq().

"css"

Cumulative Sum Scaling, via css_pq(). Requires the metagenomeSeq package.

"tmm"

Trimmed Mean of M-values, via tmm_pq(). Requires the edgeR package.

"vst"

Variance Stabilising Transformation, via vst_pq(). Requires the DESeq2 package.

"mcknight_residuals"

Log-log depth residuals added to sample_data, via mcknight_residuals_pq().

pseudocount

(numeric, default 1) added before "clr" / "rclr" to avoid non-positive values. Ignored for all other methods.

...

Additional arguments forwarded to the underlying function (vegan::decostand(), rarefy_pq(), srs_pq(), etc.).

Value

A new phyloseq-class object with a transformed otu_table (and augmented sample_data for "mcknight_residuals").

Author(s)

Adrien Taudière

See Also

normalize_prop_pq(), rarefy_pq(), srs_pq(), gmpr_pq(), css_pq(), tmm_pq(), vst_pq(), mcknight_residuals_pq(), as_binary_otu_table(), vegan::decostand()

Examples



data_f_tss <- transform_pq(data_fungi_mini, method = "tss")
sample_sums(data_f_tss)


MiscMetabar documentation built on Nov. 16, 2026, 5:06 p.m.