
Volcano Plot of Differential Expression Results
PlotVolcano.RdProduces a publication-ready volcano plot from a DEG data frame (presto,
FindMarkers, or any table with logFC and adjusted p-value columns).
Automatically detects column names for common output formats. Points are
colored by direction × significance; top genes per direction are labeled
with ggrepel.
Usage
PlotVolcano(
deg_df,
gene.column = NULL,
fc.column = NULL,
padj.column = NULL,
group.by = NULL,
ncol = NULL,
fc.cutoff = 0.25,
padj.cutoff = 0.05,
top.n.labels = 10,
highlight.genes = NULL,
colors = c(up = "#B40426", down = "#3B4CC0", ns = "gray70"),
point.size = 1,
point.alpha = 0.6,
max.overlaps = 20,
output_dir = NULL,
object_name = "",
subset_name = "",
file_name = NULL,
width = NULL,
height = NULL,
timestamp = FALSE
)Arguments
- deg_df
Data frame with differential expression results. Compatible with presto (
"feature"/"logFC"/"padj") and Seurat ("gene"/"avg_log2FC"/"p_val_adj").- gene.column
Column with gene names. Auto-detected if
NULL.- fc.column
Column with log fold-change. Auto-detected if
NULL.- padj.column
Column with adjusted p-value. Auto-detected if
NULL.- group.by
Optional column to facet by (one panel per group level).
NULL= no faceting.- ncol
Integer or
NULL. Number of columns in the facet layout whengroup.byis set.NULLletsggplot2choose.- fc.cutoff
Absolute log fold-change threshold (vertical dashed lines). Default
0.25.- padj.cutoff
Adjusted p-value significance cutoff (horizontal dashed line). Default
0.05.- top.n.labels
Number of top genes to label per direction (up and down separately). Genes ranked by \(-\log_{10}(padj) \times |logFC|\). Default
10.- highlight.genes
Character vector of specific genes to always label regardless of their ranking.
- colors
Named character vector with elements
"up","down", and"ns"(not significant). Defaults to red/blue/gray.- point.size
Point size. Default
1.- point.alpha
Point transparency. Default
0.6.- max.overlaps
Maximum label overlaps passed to
ggrepel. Default20.- output_dir
Directory to save a PDF.
NULL= plot only, no save.- object_name
Label prefix for the output file name.
- subset_name
Optional subset label appended to the file name.
- file_name
Character or
NULL. Base name (no extension) for the saved PDF.NULL(default) auto-deduces fromobject_name,subset_name, andgroup.by.- width, height
Numeric or
NULL. Override the auto-calculated PDF dimensions in inches.NULL(default) auto-sizes to the facet grid.- timestamp
Logical. When
TRUE, append a_YYYYMMDD-HHMMSSstamp to the saved file name so repeated runs are versioned instead of overwriting the previous PDF. DefaultFALSE.