Skip to contents

This function takes a MultiAssayExperiment of microbial read counts and aggregates them by one or more grouping vars within a unit.

Usage

get_summary_table(dat, group_vars = NULL)

Arguments

dat

A MultiAssayExperiment object specially formatted as an animalcules output.

group_vars

A character string or character vector of covariates found in colData(dat) to use in grouping counts. The variables should be listed in order of desired grouping. Default is NULL, which does not rely on a grouping variable and instead produces statistics for the entirety of the data.

Value

A data.frame of the grouping columns, mean_reads, sd_reads, min_reads, max_reads and num_total.

Examples

in_dat <- system.file("extdata/MAE_small.RDS", package = "LegATo") |> readRDS()
out <- get_summary_table(in_dat, c("Group", "Subject"))
head(out)
#>   Group Subject mean_reads  sd_reads min_reads max_reads num_total
#> 1     A      S1     7695.6  5583.400      1492     16804         5
#> 2     A      S3    51285.0 68211.168       590    153641         5
#> 3     A      S5    28239.8 50681.578      2829    118800         5
#> 4     A      S7    24921.8 49282.734      1345    113053         5
#> 5     A      S9    25595.8 23398.934      3428     64845         5
#> 6     B     S10     3406.2  2668.049       911      7543         5