iobr_deg: Differential Expression Analysis

View source: R/iobr_deg.R

iobr_degR Documentation

Differential Expression Analysis

Description

Performs differential expression analysis on gene expression data using either DESeq2 or limma. Includes pre-processing steps like filtering low count data, and calculates fold changes and adjusted p-values. Optionally generates volcano plots and heatmaps.

Usage

iobr_deg(
  eset,
  annotation = NULL,
  id_anno = NULL,
  pdata,
  group_id = "group",
  pdata_id = "ID",
  array = FALSE,
  method = c("DESeq2", "limma"),
  contrast = c("High", "Low"),
  path = NULL,
  padj_cutoff = 0.01,
  logfc_cutoff = 0.5,
  volcano_plot = FALSE,
  col_volcano = 1,
  heatmap = TRUE,
  col_heatmap = 1,
  parallel = FALSE
)

Arguments

eset

A matrix of gene expression data where rows represent genes and columns represent samples.

annotation

Optional data frame for mapping gene IDs to gene names. Default is 'NULL'.

id_anno

Character string specifying the identifier column in annotation. Default is 'NULL'.

pdata

A data frame containing sample information and grouping labels.

group_id

Character string specifying the column name in 'pdata' containing grouping labels. Default is '"group"'.

pdata_id

Character string specifying the column name in 'pdata' for sample IDs. Default is '"ID"'.

array

Logical indicating whether to perform quantile normalization. Default is 'FALSE'.

method

Character string specifying the method: '"DESeq2"' or '"limma"'. Default is '"DESeq2"'.

contrast

Character vector of length 2 specifying contrast groups. Default is 'c("High", "Low")'.

path

Character string for output directory. Default is 'NULL'.

padj_cutoff

Numeric cutoff for adjusted p-values. Default is '0.01'.

logfc_cutoff

Numeric log2 fold change cutoff. Default is '0.5'.

volcano_plot

Logical indicating whether to generate a volcano plot. Default is 'FALSE'.

col_volcano

Integer specifying color index for volcano plot. Default is '1'.

heatmap

Logical indicating whether to generate a heatmap. Default is 'TRUE'.

col_heatmap

Integer specifying color index for heatmap. Default is '1'.

parallel

Logical indicating whether to run in parallel. Default is 'FALSE'.

Value

Data frame containing differentially expressed genes with statistics including log2 fold changes and adjusted p-values.

Author(s)

Dongqiang Zeng

Examples

# Simulate data
set.seed(123)
sim_eset <- matrix(abs(rnorm(100 * 20)), 100, 20)
rownames(sim_eset) <- paste0("Gene", 1:100)
colnames(sim_eset) <- paste0("Sample", 1:20)

sim_pdata <- data.frame(
  ID = paste0("Sample", 1:20),
  group = rep(c("High", "Low"), each = 10)
)

# Run DEG analysis
deg <- iobr_deg(
  eset = sim_eset, pdata = sim_pdata,
  group_id = "group", pdata_id = "ID",
  method = "limma", contrast = c("High", "Low"),
  heatmap = FALSE
)
if (!is.null(deg)) head(deg)

IOBR documentation built on May 30, 2026, 5:07 p.m.