de_analysis: Differential analysis of lipids between sample groups

View source: R/de-analysis.R

de_analysisR Documentation

Differential analysis of lipids between sample groups

Description

de_analysis and de_design perform differential analysis of measured lipids that are associated with a sample group (annotation). de_analysis accepts a list of contrasts, while de_design allows users to define a design matrix, useful for complex experimental designs or for adjusting possible confounding variables.

Usage

de_analysis(data, ..., measure = "Area", group_col = NULL)

de_design(data, design, ..., coef = NULL, measure = "Area")

significant_molecules(de.results, p.cutoff = 0.05, logFC.cutoff = 1)

plot_results_volcano(de.results, show.labels = TRUE)

Arguments

data

LipidomicsExperiment object, should be normalized and log2 transformed.

...

Expressions, or character strings which can be parsed to expressions, specifying contrasts. These are passed to limma::makeContrasts.

measure

Which measure to use as intensity, usually Area (default).

group_col

Name of the column containing sample groups. If not provided, defaults to first sample annotation column.

design

Design matrix generated from model.matrix(), or a design formula.

coef

Column number or column name specifying which coefficient of the linear model is of interest.

de.results

Output of de_analysis().

p.cutoff

Significance threshold. Default is 0.05.

logFC.cutoff

Cutoff limit for log2 fold change. Default is 1. Ignored in multi-group (ANOVA-style) comparisons.

show.labels

Whether labels should be displayed for significant lipids. Default is TRUE.

Value

TopTable as returned by limma package

significant_molecules returns a character vector with names of significantly differentially changed lipids.

plot_results_volcano returns a ggplot object.

Functions

  • significant_molecules(): gets a list of significantly changed lipids for each contrast.

  • plot_results_volcano(): plots a volcano chart for differential analysis results.

Examples

# type ?normalize_pqn to see how to normalize and log2-transform your data
data(data_normalized)

# Specifying contrasts
de_results <- de_analysis(
  data_normalized,
  HighFat_water - NormalDiet_water,
  measure = "Area"
)
# Using formula
de_results_formula <- de_design(
  data = data_normalized,
  design = ~group,
  coef = "groupHighFat_water",
  measure = "Area"
)

# Using design matrix
design <- model.matrix(~group, data = colData(data_normalized))
de_results_design <- de_design(
  data = data_normalized,
  design = design,
  coef = "groupHighFat_water",
  measure = "Area"
)
significant_molecules(de_results)
plot_results_volcano(de_results, show.labels = FALSE)

ahmohamed/lipidr documentation built on July 7, 2023, 2:22 a.m.