1 Introduction

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 (Blighe 2018) 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. Other functionality allows the user to identify up to 3 different types of attributes in the same plot space via colour, shape, and shade parameter configurations.

2 Installation

2.2 2. Load the package into R session

3 Quick start

For this example, we will follow the tutorial (from Section 3.1) of RNA-seq workflow: gene-level exploratory analysis and differential expression. Specifically, we will load the ‘airway’ data, where different airway smooth muscle cells were treated with dexamethasone.

Conduct differential expression using DESeq2 in order to create 2 sets of results:

3.1 Plot the most basic volcano plot

For the most basic volcano plot, only a single data-frame or -matrix of test results is required, containing transcript names, log2FC, and adjusted or unadjusted P values. The default cut-off for log2FC is >|2|; the default cut-off for P value is 0.05.

Plot the most basic volcano plot.

Plot the most basic volcano plot.

4 Advanced features

Virtually all aspects of an EnhancedVolcano plot can be configured for the purposes of accommodating all types of statistical distributions and labelling preferences. By default, 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.

4.1 Modify cut-offs for log2FC and P value; specify title; adjust point and label size

The default P value cut-off of 10e-6 may be too relaxed for most studies, which may therefore necessitate increasing this threshold by a few orders of magnitude. Equally, the log2FC cut-offs may be too stringent, given that moderated ‘shrunk’ estimates of log2FC differences in differential expression analysis can now be calculated.

In this example, we also modify the point and label size, which can help to improve clarity where many transcripts went into the differential expression analysis.

Modify cut-offs for log2FC and P value; specify title; adjust point and label size.

Modify cut-offs for log2FC and P value; specify title; adjust point and label size.

4.2 Adjust colour and alpha for point shading

The default colour scheme may not be to everyone’s taste. Here we make it such that only the transcripts passing both the log2FC and P value thresholds are coloured red, with everything else black. We also adjust the value for ‘alpha’, which controls the transparency of the plotted points: 1 = 100% opaque; 0 = 100% transparent.

Adjust colour and alpha for point shading.

Adjust colour and alpha for point shading.

4.3 Adjust shape of plotted points

It can help, visually, to also plot different points as different shapes. The default shape is a circle. The user can specify their own shape encoding via the ‘shape’ parameter, which accepts either a single or four possible values: if four values, these then map to the standard designation that is also assigned by the colours; if a single value, all points are shaped with this value.

For more information on shape encoding search online at ggplot2 Quick Reference: shape

Adjust shape of plotted points.

Adjust shape of plotted points.

Adjust shape of plotted points.

Adjust shape of plotted points.

4.4 Adjust cut-off lines and add extra threshold lines

The lines that are drawn to indicate cut-off points are also modifiable. The parameter ‘cutoffLineType’ accepts the following values: “blank”, “solid”, “dashed”, “dotted”, “dotdash”, “longdash”, and “twodash”. The colour and thickness of these can also be modified with ‘cutoffLineCol’ and ‘cutoffLineWidth’. To disable the lines, set either cutoffLineType=“blank” or cutoffLineWidth=0.

Extra lines can also be added via ‘hline’ and ‘vline’ to display other cut-offs.

To make these more visible, we will also remove the default gridlines.

Adjust cut-off lines and add extra threshold lines.

Adjust cut-off lines and add extra threshold lines.

4.5 Adjust legend position, size, and text

The position of the legend can also be changed to “left” or “right” (and stacked vertically), or ‘top’ or “bottom” (stacked horizontally). The legend text, label size, and icon size can also be modified.

Adjust legend position, size, and text.

Adjust legend position, size, and text.

Note: to make the legend completely invisible, specify:

4.6 Plot adjusted p-values

Volcano plots do not have to be produced with nominal (unadjusted P values), even if this is the common practice. Simply provide a column name relating to adjusted P values and you can also generate a volcano with these. In this case, the cutoff for the P value then relates to the adjusted P value. Here, we also modify the axis titles by supplying an expression via the bquote function.

Plot adjusted p-values.

Plot adjusted p-values.

4.7 Fit more labels by adding connectors

In order to maximise free space in the plot window, one can fit more transcript labels by adding connectors from labels to points, where appropriate. The width and colour of these connectors can also be modified with ‘widthConnectors’ and ‘colConnectors’, respectively. Further configuration is achievable via ‘typeConnectors’ (“open”, “closed”), ‘endsConnectors’ (“last”, “first”, “both”), and lengthConnectors (default = unit(0.01, ‘npc’)).

The result may not always be desirable as it can make the plot look overcrowded.

Fit more labels by adding connectors.

Fit more labels by adding connectors.

4.8 Only label key transcripts

In many situations, people may only wish to label their key transcripts / transcripts of interest. One can therefore supply a vector of these transcripts via the ‘selectLab’ parameter, the contents of which have to also be present in the vector passed to ‘lab’. In addition, only those transcripts that pass both the cutoff for log2FC and P value will be labelled.

Only label key transcripts.

Only label key transcripts.

4.10 Over-ride colouring scheme with custom key-value pairs

In certain situations, one may wish to over-ride the default colour scheme with their own colour-scheme, such as colouring transcripts by pathway, cell-type or group. This can be achieved by supplying a named vector as ‘colCustom’.

In this example, we just wish to colour all transcripts with log2FC > 2.5 as ‘high’ and those with log2FC < -2.5 as ‘low’.

## [1] "Mid"  "low"  "high"
## [1] "black"     "royalblue" "gold"
##     Mid     Mid     Mid     Mid     Mid     Mid     Mid     Mid     Mid 
## "black" "black" "black" "black" "black" "black" "black" "black" "black" 
##     Mid     Mid     Mid     Mid     Mid     Mid     Mid     Mid     Mid 
## "black" "black" "black" "black" "black" "black" "black" "black" "black" 
##     Mid     Mid 
## "black" "black"
Over-ride colouring scheme with custom key-value pairs.

Over-ride colouring scheme with custom key-value pairs.

4.11 Over-ride colour and/or shape scheme with custom key-value pairs

In this example, we first over-ride the existing shape scheme and then both the colour and shape scheme at the same time.

## [1] "PBC"         "Cell-type 1" "Cell-type 2"
## [1]  3 17 64
## PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC PBC 
##   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3 
## PBC PBC 
##   3   3
## [1] "Mid"  "low"  "high"
## [1] "black"     "royalblue" "gold"
Over-ride colour and/or shape scheme with custom key-value pairs.

Over-ride colour and/or shape scheme with custom key-value pairs.

4.12 Shade certain transcripts

In this example we add an extra level of highlighting key transcripts by shading.

This feature works best for shading just 1 or 2 key transcripts. It is expected that the user can use the ‘shapeCustom’ parameter for more in depth identification of different types of transcripts.

  p1 <- EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = celltype1,
    xlim = c(-6.5,6.5),
    xlab = bquote(~Log[2]~ 'fold change'),
    title = 'Shading cell-type 1',
    pCutoff = 10e-14,
    FCcutoff = 1.0,
    transcriptPointSize = 8.0,
    transcriptLabSize = 5.0,
    transcriptLabCol = 'purple',
    transcriptLabFace = 'bold',
    boxedlabels = TRUE,
    shape = 42,
    colCustom = keyvals,
    colAlpha = 1,
    legendPosition = 'top',
    legendLabSize = 15,
    legendIconSize = 5.0,
    shade = celltype1,
    shadeLabel = 'Cell-type I',
    shadeAlpha = 1/2,
    shadeFill = 'purple',
    shadeSize = 1,
    shadeBins = 5,
    drawConnectors = TRUE,
    widthConnectors = 1.0,
    colConnectors = 'grey30',
    gridlines.major = TRUE,
    gridlines.minor = FALSE,
    border = 'partial',
    borderWidth = 1.5,
    borderColour = 'black')

  p2 <- EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = celltype2,
    xlim = c(-6.5,6.5),
    xlab = bquote(~Log[2]~ 'fold change'),
    title = 'Shading cell-type 2',
    pCutoff = 10e-14,
    FCcutoff = 1.0,
    transcriptLabSize = 5.0,
    transcriptLabCol = 'forestgreen',
    transcriptLabFace = 'bold',
    shapeCustom = keyvals.shape,
    colCustom = keyvals.colour,
    colAlpha = 1,
    legendPosition = 'top',
    transcriptPointSize = 4.0,
    legendLabSize = 15,
    legendIconSize = 5.0,
    shade = celltype2,
    shadeLabel = 'Cell-type II',
    shadeAlpha = 1/2,
    shadeFill = 'forestgreen',
    shadeSize = 1,
    shadeBins = 5,
    drawConnectors = TRUE,
    widthConnectors = 1.0,
    colConnectors = 'grey30',
    gridlines.major = TRUE,
    gridlines.minor = FALSE,
    border = 'full',
    borderWidth = 1.0,
    borderColour = 'black')

  library(gridExtra)
  library(grid)
  grid.arrange(p1, p2,
    ncol=2,
    top = textGrob('EnhancedVolcano',
      just = c('center'),
      gp = gpar(fontsize = 32)))
  grid.rect(gp=gpar(fill=NA))
Shade certain transcripts.

Shade certain transcripts.

5 Acknowledgments

The development of EnhancedVolcano has benefited from contributions and suggestions from:

Sharmila Rana,

Myles Lewis,

Luke Dow - Assistant Professor at Weill Cornell Medicine,

Tokhir Dadaev - Institute of Cancer Research,

Alina Frolova

6 Session info

## R version 3.6.0 (2019-04-26)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.9-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.9-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
##  [1] grid      parallel  stats4    stats     graphics  grDevices utils    
##  [8] datasets  methods   base     
## 
## other attached packages:
##  [1] gridExtra_2.3               DESeq2_1.24.0              
##  [3] magrittr_1.5                airway_1.3.0               
##  [5] SummarizedExperiment_1.14.0 DelayedArray_0.10.0        
##  [7] BiocParallel_1.18.0         matrixStats_0.54.0         
##  [9] Biobase_2.44.0              GenomicRanges_1.36.0       
## [11] GenomeInfoDb_1.20.0         IRanges_2.18.0             
## [13] S4Vectors_0.22.0            BiocGenerics_0.30.0        
## [15] EnhancedVolcano_1.2.0       ggrepel_0.8.0              
## [17] ggplot2_3.1.1               knitr_1.22                 
## 
## loaded via a namespace (and not attached):
##  [1] bit64_0.9-7            splines_3.6.0          Formula_1.2-3         
##  [4] assertthat_0.2.1       highr_0.8              latticeExtra_0.6-28   
##  [7] blob_1.1.1             GenomeInfoDbData_1.2.1 yaml_2.2.0            
## [10] RSQLite_2.1.1          pillar_1.3.1           backports_1.1.4       
## [13] lattice_0.20-38        glue_1.3.1             digest_0.6.18         
## [16] RColorBrewer_1.1-2     XVector_0.24.0         checkmate_1.9.1       
## [19] colorspace_1.4-1       htmltools_0.3.6        Matrix_1.2-17         
## [22] plyr_1.8.4             XML_3.98-1.19          pkgconfig_2.0.2       
## [25] genefilter_1.66.0      zlibbioc_1.30.0        purrr_0.3.2           
## [28] xtable_1.8-4           scales_1.0.0           tibble_2.1.1          
## [31] htmlTable_1.13.1       annotate_1.62.0        withr_2.1.2           
## [34] nnet_7.3-12            lazyeval_0.2.2         survival_2.44-1.1     
## [37] crayon_1.3.4           memoise_1.1.0          evaluate_0.13         
## [40] MASS_7.3-51.4          foreign_0.8-71         tools_3.6.0           
## [43] data.table_1.12.2      stringr_1.4.0          locfit_1.5-9.1        
## [46] munsell_0.5.0          cluster_2.0.9          AnnotationDbi_1.46.0  
## [49] compiler_3.6.0         rlang_0.3.4            RCurl_1.95-4.12       
## [52] rstudioapi_0.10        htmlwidgets_1.3        labeling_0.3          
## [55] bitops_1.0-6           base64enc_0.1-3        rmarkdown_1.12        
## [58] gtable_0.3.0           DBI_1.0.0              R6_2.4.0              
## [61] dplyr_0.8.0.1          bit_1.1-14             Hmisc_4.2-0           
## [64] stringi_1.4.3          Rcpp_1.0.1             geneplotter_1.62.0    
## [67] rpart_4.1-15           acepack_1.4.1          tidyselect_0.2.5      
## [70] xfun_0.6

6.1 References

Blighe (2018)

Blighe, Kevin. 2018. “EnhancedVolcano: Publication-ready volcano plots with enhanced colouring and labeling.” https://github.com/kevinblighe.