PomaLimma: Differential Expression Analysis Using 'limma'

View source: R/PomaLimma.R

PomaLimmaR Documentation

Differential Expression Analysis Using limma

Description

PomaLimma uses the classical limma package to compute differential expression analysis.

Usage

PomaLimma(
  data,
  contrast = NULL,
  outcome = NULL,
  covs = NULL,
  adjust = "fdr",
  block = NULL,
  weights = FALSE
)

Arguments

data

A SummarizedExperiment object.

contrast

Character. Indicates the comparison. For example, "Group1-Group2" or "control-intervention".

outcome

Character. Indicates the name of the colData column to be used as the outcome factor. Default is NULL (first factor variable in colData).

covs

Character vector. Indicates the names of colData columns to be included as covariates. Default is NULL (no covariates). If not NULL, a limma model will be fitted using the specified covariates. Note: The order of the covariates is important and should be listed in increasing order of importance in the experimental design.

adjust

Character. Indicates the multiple comparisons correction method. Options are: "fdr", "holm", "hochberg", "hommel", "bonferroni", "BH" and "BY".

block

Character. Specifies the name of the colData factor column that includes the random effect variable to be considered (e.g., replicate). The default is NULL, indicating no random effect.

weights

Logical. Indicates whether the limma model should estimate the relative quality weights for each group. See ?limma::arrayWeights().

Value

A tibble with the results.

Author(s)

Pol Castellano-Escuder

References

Matthew E. Ritchie, Belinda Phipson, Di Wu, Yifang Hu, Charity W. Law, Wei Shi, Gordon K. Smyth, limma powers differential expression analyses for RNA-sequencing and microarray studies, Nucleic Acids Research, Volume 43, Issue 7, 20 April 2015, Page e47, https://doi.org/10.1093/nar/gkv007

Examples

data <- POMA::st000284 %>% # Example SummarizedExperiment object included in POMA
  PomaNorm()

# Basic limma
limma_results <- data %>% 
  PomaLimma(contrast = "Healthy-CRC", 
            covs = NULL,
            adjust = "fdr",
            block = NULL)

limma_results %>% 
  dplyr::slice(1:10)

## Volcano plot
limma_results %>% 
  dplyr::select(feature, log2FC, pvalue) %>% 
  PomaVolcano(labels = TRUE)

## Boxplot of top features
data %>% 
  PomaBoxplots(x = "features", 
               outcome = "gender", # factorial variable to group by (e.g., treatment, sex, etc)
               feature_name = limma_results$feature[1:10])

## Heatmap of top features
data[rownames(data) %in% limma_results$feature[1:10]] %>% 
  PomaHeatmap(covs = c("gender", "smoking_condition", "alcohol_consumption"), # covariates to plot (e.g., treatment, sex, etc)
              feature_names = TRUE)

# Basic limma on alternative outcome
SummarizedExperiment::colData(data)$gender <- factor(ifelse(SummarizedExperiment::colData(data)$gender == 0, "male", "female"))
data %>% 
  PomaLimma(contrast = "male-female", 
            outcome = "gender",
            covs = NULL,
            adjust = "fdr",
            block = NULL)

limma_results %>% 
  dplyr::slice(1:10)

## Volcano plot
limma_results %>% 
  dplyr::select(feature, log2FC, pvalue) %>% 
  PomaVolcano(labels = TRUE)

## Boxplot of top features
data %>% 
  PomaBoxplots(x = "features", 
               outcome = "gender", # factorial variable to group by (e.g., treatment, sex, etc)
               feature_name = limma_results$feature[1:10])

## Heatmap of top features
data[rownames(data) %in% limma_results$feature[1:10]] %>% 
  PomaHeatmap(covs = c("gender", "smoking_condition", "alcohol_consumption"), # covariates to plot (e.g., treatment, sex, etc)
              feature_names = TRUE)

# limma with one covariate
data %>% 
  PomaLimma(contrast = "Healthy-CRC", 
            covs = "gender",
            adjust = "fdr",
            block = NULL)

limma_results %>% 
  dplyr::slice(1:10)

## Volcano plot
limma_results %>% 
  dplyr::select(feature, log2FC, pvalue) %>% 
  PomaVolcano(labels = TRUE)

## Boxplot of top features
data %>% 
  PomaBoxplots(x = "features", 
               outcome = "gender", # factorial variable to group by (e.g., treatment, sex, etc)
               feature_name = limma_results$feature[1:10])

## Heatmap of top features
data[rownames(data) %in% limma_results$feature[1:10]] %>% 
  PomaHeatmap(covs = c("gender", "smoking_condition", "alcohol_consumption"), # covariates to plot (e.g., treatment, sex, etc)
              feature_names = TRUE)

# limma with two covariates
data %>% 
  PomaLimma(contrast = "Healthy-CRC", 
            covs = c("gender", "age_at_consent"),
            adjust = "fdr",
            block = NULL)

limma_results %>% 
  dplyr::slice(1:10)

## Volcano plot
limma_results %>% 
  dplyr::select(feature, log2FC, pvalue) %>% 
  PomaVolcano(labels = TRUE)

## Boxplot of top features
data %>% 
  PomaBoxplots(x = "features", 
               outcome = "gender", # factorial variable to group by (e.g., treatment, sex, etc)
               feature_name = limma_results$feature[1:10])

## Heatmap of top features
data[rownames(data) %in% limma_results$feature[1:10]] %>% 
  PomaHeatmap(covs = c("gender", "smoking_condition", "alcohol_consumption"), # covariates to plot (e.g., treatment, sex, etc)
              feature_names = TRUE)

# limma with replicates
# data %>% 
#   PomaLimma(contrast = "Healthy-CRC", 
#             covs = NULL,
#             adjust = "fdr",
#             block = "replicate")

pcastellanoescuder/POMA_package documentation built on Nov. 23, 2024, 4:02 p.m.