---
title: "Publication-ready volcano plots with enhanced colouring and labeling"
author: "Kevin Blighe"
date: "`r Sys.Date()`"
package: "`r packageVersion('EnhancedVolcano')`"
output:
html_document:
highlight: pygments
toc: true
toc_depth: 2
toc_float: true
fig_width: 6
bibliography: library.bib
vignette: >
%\VignetteIndexEntry{Publication-ready volcano plots with enhanced colouring and labeling}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
%\usepackage[utf8]{inputenc}
---
Volcano plots represent a useful way to visualise the results of differential expression analyses. Here, we present a highly-configurable function that produces publication-ready volcano plots [@EnhancedVolcano]. EnhancedVolcano will attempt to fit as many transcript names in the plot window as possible, thus avoiding 'clogging' up the plot with labels that could not otherwise have been read.
library(knitr)
opts_chunk$set(tidy = TRUE, message = FALSE, warning = FALSE)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("EnhancedVolcano")
Note: to install development version:
devtools::install_github("kevinblighe/EnhancedVolcano")
library(EnhancedVolcano)
Following data generated by tutorial of RNA-seq workflow: gene-level exploratory analysis and differential expression:
Load airway data:
source("https://bioconductor.org/biocLite.R")
biocLite("airway")
library(airway)
library(magrittr)
data("airway")
airway$dex %<>% relevel("untrt")
Conduct differential expression using DESeq2:
library("DESeq2")
dds <- DESeqDataSet(airway, design = ~ cell + dex)
dds <- DESeq(dds, betaPrior=FALSE)
res1 <- results(dds,
contrast = c("dex","trt","untrt"))
res1 <- lfcShrink(dds,
contrast = c("dex","trt","untrt"), res=res1)
res2 <- results(dds,
contrast = c("cell", "N061011", "N61311"))
res2 <- lfcShrink(dds,
contrast = c("cell", "N061011", "N61311"), res=res2)
EnhancedVolcano(res1,
lab = rownames(res1),
x = "log2FoldChange",
y = "pvalue")
Virtually all aspects of an EnhancedVolcano plot can be configured for the purposes of accomodating all types of statistical distributions and labelling preferences. EnhancedVolcano will only attempt to label genes that pass the thresholds that you set for statistical significance, i.e., 'pCutoff' and 'FCcutoff'. In addition, it will only label as many of these that can reasonably fit in the plot space. The user can optionally supply a vector of transcript names (as 'selectLab') that s/he wishes to label in the plot.
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-12,
FCcutoff = 1.5,
transcriptPointSize = 1.5,
transcriptLabSize = 3.0,
title = "N061011 versus N61311")
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-12,
FCcutoff = 1.5,
transcriptPointSize = 1.5,
transcriptLabSize = 3.0,
title = "N061011 versus N61311",
col=c("black", "black", "black", "red3"),
colAlpha = 1)
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-12,
FCcutoff = 1.5,
transcriptPointSize = 1.5,
transcriptLabSize = 3.0,
title = "N061011 versus N61311",
colAlpha = 1,
xlim = c(-8, 8),
ylim = c(0, -log10(10e-32)))
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-12,
FCcutoff = 1.5,
transcriptPointSize = 1.5,
transcriptLabSize = 3.0,
title = "N061011 versus N61311",
colAlpha = 1,
xlim = c(-8, 8),
ylim = c(0, -log10(10e-32)),
cutoffLineType = "twodash",
cutoffLineCol = "red3",
cutoffLineWidth = 1.5)
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-12,
FCcutoff = 1.5,
transcriptPointSize = 1.5,
transcriptLabSize = 3.0,
colAlpha = 1,
cutoffLineType = "twodash",
cutoffLineCol = "red4",
cutoffLineWidth = 1.0,
legend=c("NS","Log (base 2) fold-change","P value",
"P value & Log (base 2) fold-change"),
legendPosition = "right",
legendLabSize = 14,
legendIconSize = 5.0)
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "padj",
xlab = bquote(~Log[2]~ "fold change"),
ylab = bquote(~-Log[10]~adjusted~italic(P)),
pCutoff = 0.0001,
FCcutoff = 1.0,
xlim=c(-6,6),
transcriptLabSize = 3.0,
colAlpha = 1,
legend=c("NS","Log2 FC","Adjusted p-value",
"Adjusted p-value & Log2 FC"),
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0)
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "padj",
xlab = bquote(~Log[2]~ "fold change"),
ylab = bquote(~-Log[10]~adjusted~italic(P)),
pCutoff = 0.0001,
FCcutoff = 2.0,
xlim = c(-6,6),
transcriptLabSize = 3.0,
colAlpha = 1,
legend=c("NS","Log2 FC","Adjusted p-value",
"Adjusted p-value & Log2 FC"),
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0,
DrawConnectors = TRUE,
widthConnectors = 0.5,
colConnectors = "black")
EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "padj",
selectLab = c("ENSG00000106565","ENSG00000187758"),
xlab = bquote(~Log[2]~ "fold change"),
ylab = bquote(~-Log[10]~adjusted~italic(P)),
pCutoff = 0.0001,
FCcutoff = 2.0,
xlim = c(-6,6),
transcriptLabSize = 5.0,
colAlpha = 1,
legend=c("NS","Log2 FC","Adjusted p-value",
"Adjusted p-value & Log2 FC"),
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0)
p1 <- EnhancedVolcano(res1,
lab = rownames(res1),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-24,
FCcutoff = 2.0,
transcriptLabSize = 2.0,
colAlpha = 1,
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0)
p2 <- EnhancedVolcano(res2,
lab = rownames(res2),
x = "log2FoldChange",
y = "padj",
selectLab = c("ENSG00000106565","ENSG00000187758"),
xlab = bquote(~Log[2]~ "fold change"),
ylab = bquote(~-Log[10]~adjusted~italic(P)),
pCutoff = 0.0001,
FCcutoff = 2.0,
xlim = c(-6,6),
transcriptLabSize = 5.0,
colAlpha = 1,
legend=c("NS","Log2 FC","Adjusted p-value",
"Adjusted p-value & Log2 FC"),
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0)
library(gridExtra)
library(grid)
grid.arrange(p1, p2, ncol=2, top="EnhancedVolcano")
grid.rect(gp=gpar(fill=NA))
The development of EnhancedVolcano has benefited from contributions and suggestions from:
Sharmila Rana, Myles Lewis
sessionInfo()
@EnhancedVolcano