Skip to contents

Performs differential abundance testing across all assays in a MultiAssayExperiment object using a specified statistical method such as limma_voom. The function updates each assay with its corresponding colData, fits the model using the provided formula, and combines the results into a unified table.

Usage

run_differential_abundance(
  expomicset,
  formula,
  abundance_col = "counts",
  method = "limma_voom",
  contrasts = NULL,
  scaling_method = "none",
  action = "add"
)

Arguments

expomicset

A MultiAssayExperiment containing assays to test.

formula

A model formula for the differential analysis (e.g., ~ group + batch).

abundance_col

Character. The name of the assay matrix to use for abundance values. Default is "counts".

method

Character. Differential analysis method to use. Currently supports "limma_voom" (default).

contrasts

A named list of contrasts for pairwise comparisons. Default is NULL (uses default group comparisons).

scaling_method

Character. Scaling method to apply before modeling. Options include "none" (default), "zscore", etc.

action

Character. Whether to "add" results to expomicset metadata or "get" the results as a data frame. Default is "add".

Value

Either the updated MultiAssayExperiment (if action = "add") or a tibble with differential abundance results (if action = "get").

Examples

if (FALSE) { # \dontrun{
expom <- run_differential_abundance(
  expomicset = expom,
  formula = ~ exposure_group,
  abundance_col = "counts",
  method = "limma_voom"
)
} # }