Skip to main content

Static volcano plot of differential-abundance results

Description

One panel per contrast: the fold change against \(-\log_{10}\) of the significance score. Features passing both thresholds (score below fdr_threshold, absolute effect above fc_threshold, the rule of filter_significant()) are coloured by direction and the most significant of them labelled; all other features are drawn small and grey. The plot is a plain ggplot, so it renders as a static image however many features the table holds; interactive exploration is left to exploreDE.

Usage

volcano_static(
  data,
  effect = "diff",
  significance = "FDR",
  contrast = "contrast",
  label = NULL,
  fc_threshold = 1,
  fdr_threshold = 0.1,
  directional = FALSE,
  n_labels = 5,
  base_size = 12
)

Arguments

data contrast table, one row per feature and contrast
effect column with the log2 fold change
significance column with the score plotted on the y-axis (e.g. FDR)
contrast column with the contrast name, one panel each
label column naming the features to label, or NULL for no labels
fc_threshold fold-change threshold, drawn as vertical lines
fdr_threshold significance threshold, drawn as a horizontal line
directional if TRUE, only an effect above fc_threshold counts as significant (as for SAINT), mirroring the backend’s significance_directional
n_labels number of labelled features per contrast and direction
base_size base font size

Value

a ggplot object

Examples

library("prolfquapp")

set.seed(1)
contrasts <- data.frame(
  feature = paste0("P", 1:2000),
  contrast = rep(c("B_vs_A", "C_vs_A"), each = 1000),
  diff = rnorm(2000, sd = 1.2)
)
contrasts$FDR <- p.adjust(2 * pnorm(-abs(contrasts$diff), sd = 0.5), "BH")
volcano_static(contrasts, label = "feature")