Il volcano plot è una rappresentazione grafica molto utile nell’analisi dell’espressione differenziale, in quanto permette di visualizzare in modo immediato i geni più significativi e con i maggiori cambiamenti di espressione.

Come funziona:

Interpretazione:

Vantaggi:

Esempio in R:

Mostra il codice R
# Crea un volcano plot con ggplot2
FC <- .5
pv <- 0.0001

out_res <- tibble(
  gene = res@rownames,
  baseMean = res@listData$baseMean,
  log2FoldChange = res@listData$log2FoldChange,
  lfcSE = res@listData$lfcSE,
  # stat = res@listData$stat,
  pvalue = res@listData$pvalue,
  padj = res@listData$padj
) |>
  mutate(colore = case_when(
    log2FoldChange > FC & padj < pv ~ "#F5A15B",
    log2FoldChange < -FC & padj < pv ~ "#106973",
    TRUE ~ "#D2D4D4"
  ))


ggplot(out_res, aes(x = log2FoldChange, y = -log10(padj), color = colore)) +
  geom_point() +
  geom_hline(yintercept = -log10(pv), linetype = "dashed", color = "red") +
  geom_vline(xintercept = c(-FC, FC), linetype = "dashed", color = "blue") +
  labs(x = "log2 Fold Change", y = "-log10(Adjusted p-value)") +
  ggtitle("Volcano Plot") +
  scale_color_identity(labels = c("Red", "Blue", "Green")) +
  theme_bw()
#> Warning: Removed 10104 rows containing missing values or values outside the scale
#> range (`geom_point()`).

In questo esempio:

Mostra il codice R
pp <- ggplot(out_res, aes(x = log2FoldChange, y = -log10(padj), text = paste0("Gene: ", gene))) +
  geom_point(aes(color = colore)) +
  geom_hline(yintercept = -log10(pv), linetype = "dashed", color = "red") +
  geom_vline(xintercept = c(-FC, FC), linetype = "dashed", color = "blue") +
  labs(x = "log2 Fold Change", y = "-log10(Adjusted p-value)") +
  ggtitle("Volcano Plot") +
  scale_color_identity(guide = "none") +
  theme_bw() +
  theme(legend.position = "none")
plotly::ggplotly(pp)