MetaboliteANOVA: MetaboliteANOVA.

View source: R/MetaboliteANOVA.R

MetaboliteANOVAR Documentation

MetaboliteANOVA.

Description

MetaboliteANOVA will perform an ANOVA on columns of a data matrix according to a specified model.

Usage

MetaboliteANOVA(
  dat = NULL,
  sam = NULL,
  model = NULL,
  method = "none",
  silent = FALSE
)

Arguments

dat

Data matrix (e.g. of metabolite).

sam

Sample table (same number of row as 'dat' and containing all columns specified in 'model'.

model

ANOVA model. May include +, * and : together with column names of sam (cf. Examples).

method

The method to be used in column wise multiple testing adjustment, see p.adjust.

silent

Logical. Shall the function print warnings to the console?

Details

The function is a wrapper for lm including some sanity checks. It will accept a data matrix (traits in columns), sample information (data.frame) and a potential model as input, compute an ANOVA per column and return the respective P-values in a named matrix for further plotting or export.

Value

A named matrix of P-values (rows=metabolites/traits; cols=ANOVA factors).

Examples

# load raw data and sample description
raw <- MetabolomicsBasics::raw
sam <- MetabolomicsBasics::sam
# compute P-values according to specified ANOVA model (simple and complex)
head(m1 <- MetaboliteANOVA(dat = raw, sam = sam, model = "GT"))
head(m2 <- MetaboliteANOVA(dat = raw, sam = sam, model = "GT+Batch+Order+MP"))
# compare P-values for one factor determined in both models
hist(log10(m2[, "GT"]) - log10(m1[, "GT"]), main = "")

MetabolomicsBasics documentation built on Nov. 2, 2023, 5:07 p.m.