Skip to contents

Generate a multi-panel differential expression dashboard for a single assay in a geneda object. The dashboard includes:

  1. P-value histogram

  2. MA plot

  3. Volcano plot

Usage

DEDashboard(object, assay, alpha = 0.05, l2fc = 1, num = NULL, den = NULL)

Arguments

object

A geneda object containing DEGs in the DEGs slot.

assay

Character. Name of the assay to visualize.

alpha

Numeric. Significance threshold for highlighting p-values and DEGs (default 0.05).

l2fc

Numeric. Log2 fold-change threshold for MA and volcano plots.

num

Character. Name of the numerator group for volcano plot labeling. If NULL (default), the legend uses "numerator".

den

Character. Name of the denominator group for volcano plot labeling. If NULL (default), the legend uses "denominator".

Value

A patchwork object combining plots.

Examples

data(Snail1KO)
counts <- as.matrix(Snail1KO$rawCounts)
counts <- counts[rowSums(counts >= 10) >= 3, ]
meta <- Snail1KO$metadata
rownames(meta) <- meta$Sample
meta$Genotype <- factor(meta$Genotype, levels = c("WT", "Snai1_KO"))
norm <- log2(t(t(counts) / colSums(counts)) * 1e6 + 1)
obj <- GenEDA(normalized = norm, metadata = meta, counts = counts)

# Differential expression with DESeq2 (Snai1_KO vs WT)
dds <- DESeq2::DESeqDataSetFromMatrix(counts, meta, design = ~Genotype)
dds <- DESeq2::DESeq(dds, quiet = TRUE)
res <- as.data.frame(DESeq2::results(dds))
obj <- SetDEGs(obj, res, assay = "KO_vs_WT")
db <- DEDashboard(obj,
    assay = "KO_vs_WT", alpha = 0.05, l2fc = 1,
    num = "Snai1_KO", den = "WT"
)
#> Scale for size is already present.
#> Adding another scale for size, which will replace the existing scale.
# The dashboard needs a large device, e.g.
# ggplot2::ggsave("dashboard.png", db, width = 14, height = 10)
class(db)
#> [1] "patchwork"       "plot_filler"     "ggplot2::ggplot" "ggplot"         
#> [5] "ggplot2::gg"     "S7_object"       "gg"