Skip to contents

Unified front-end for transforming abundance after summarising either taxa or samples.

Usage

transform_abundance_by(
  object,
  by = c("taxa", "samples"),
  group_by,
  what = c("sum_intensity", "mean_intensity", "median_intensity"),
  method = c("relative", "log", "presence_absence", "clr"),
  pseudocount = 1,
  na_remove = TRUE,
  ...
)

Arguments

object

A microbiome_dataset object.

by

Transformation target, either "taxa" or "samples".

group_by

Taxonomy rank or sample metadata column used for grouping.

what

Aggregation method used before transformation.

method

Transformation method.

pseudocount

A pseudocount added before transformations that require strictly positive values.

na_remove

Should taxa with missing rank be removed before summarisation when by = "taxa"?

...

Other parameters passed to transform_counts().

Value

A transformed microbiome_dataset object.

Examples

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

x0 <- prune_taxa(global_patterns, variable_id = global_patterns@variable_info$variable_id[1:200])
x <- transform_abundance_by(
  object = x0,
  by = "taxa",
  group_by = "Genus",
  what = "sum_intensity",
  method = "relative"
)
attr(x@expression_data, "transform_method")
#> [1] "relative"