Skip to contents

Run a supported differential abundance method on a microbiome_dataset and return a standardized differential_abundance_result object.

Usage

run_differential_abundance(
  object,
  formula,
  group = NULL,
  method = c("ancombc", "ancombc2", "maaslin2"),
  taxonomic_rank = NULL,
  random_effects = NULL,
  coefficient = NULL,
  p_adj_method = "holm",
  prv_cut = 0.1,
  lib_cut = 0,
  struc_zero = FALSE,
  neg_lb = FALSE,
  tol = 1e-05,
  max_iter = 100,
  conserve = FALSE,
  alpha = 0.05,
  global = FALSE,
  n_cl = 1,
  verbose = FALSE,
  normalization = "TSS",
  transform = "LOG",
  analysis_method = "LM",
  standardize = FALSE
)

Arguments

object

A microbiome_dataset object.

formula

Model formula passed to the differential abundance method.

group

Optional grouping variable used by the method.

method

Differential abundance method. Supports "ancombc", "ancombc2", and "maaslin2".

taxonomic_rank

Optional taxonomy rank used to aggregate the microbiome data before modeling.

random_effects

Optional random-effects formula used by methods that support mixed-effects models.

coefficient

Optional coefficient name extracted from the fitted model. When omitted, the first non-intercept coefficient is used.

p_adj_method

Multiple-testing correction method.

prv_cut

Prevalence cutoff passed to ANCOMBC::ancombc().

lib_cut

Library-size cutoff passed to ANCOMBC::ancombc().

struc_zero

Whether to detect structural zeros.

neg_lb

Whether to use the negative lower bound option.

tol

Numerical tolerance passed to ANCOMBC::ancombc().

max_iter

Maximum iteration count passed to ANCOMBC::ancombc().

conserve

Whether to use the conservative variance estimate.

alpha

Significance cutoff passed to ANCOMBC::ancombc().

global

Whether to run the global test.

n_cl

Number of parallel workers passed to ANCOMBC::ancombc().

verbose

Whether to print method progress.

normalization

Normalization method passed to Maaslin2::Maaslin2().

transform

Transformation passed to Maaslin2::Maaslin2().

analysis_method

Modeling backend passed to Maaslin2::Maaslin2().

standardize

Whether to standardize metadata in Maaslin2::Maaslin2().

Value

A differential_abundance_result object.

Examples

data("demo_crossomics", package = "microbiomedataset")

demo_object <- prune_taxa(
  demo_crossomics$microbiome_data,
  variable_id = demo_crossomics$microbiome_data@variable_info$variable_id[1:40]
)

da_result <- run_differential_abundance(
  object = demo_object,
  formula = "study_group",
  method = "ancombc"
)
#> 'ancombc' has been fully evolved to 'ancombc2'. 
#> Explore the enhanced capabilities of our refined method!
#> Loading required package: foreach
#> Loading required package: rngtools
da_result
#> differential_abundance_result
#> Method: ancombc
#> Taxonomic rank: 
#> Group: study_group1
#> Rows: 40