EnhancedVolcano -- 火山圖全攻略

小郭叨叨叨
本文檔主要介紹EnhancedVolcano包及參數(shù)說明。
作者 Kevin Blighe颂砸,R包信息參見Publication-ready volcano plots with enhanced colouring and labeling

本文檔僅為 EnhancedVolcano 包介紹內容的搬運工捡硅,究其原因:

  1. 忠實原意寡喝,享受原汁原味便瑟;
  2. 懶震捣,翻譯的腦子我都懶得動枯饿。

對于喜歡中文介紹的讀者酝锅,這里為大家推薦一篇:增強火山圖,要不要試一下奢方?

本文檔搬運時間:2019-07-07.

Install

if (!requireNamespace('BiocManager', quietly = TRUE))
  install.packages('BiocManager')
BiocManager::install('EnhancedVolcano')

devtools::install_github('kevinblighe/EnhancedVolcano')  #install development version

建議安裝 development version搔扁,部分功能只有此版本有,詳情請在文中查找

Quick start

library(EnhancedVolcano)
library(airway)
library(magrittr)

Follow the tutorial (from Section 3.1) of RNA-seq workflow: gene-level exploratory analysis and differential expression. load airway data where different airway smooth muscle cells were treated with dexamethasone.

data('airway')
airway$dex %<>% relevel('untrt')
  # %<>%復合賦值操作符蟋字, 除與 %>% 功能基本一樣外稿蹲,還將結果寫到左側對象。
  # 對airway$dex列進行relevel鹊奖,再把revel后的結果賦值到airway$dex场绿。
  # relevel: reorder levels of factor

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

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)

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 10e-6.

EnhancedVolcano(res1,
                lab = rownames(res1),
                x = 'log2FoldChange',
                y = 'pvalue',
                xlim = c(-5, 8))
圖例:NS-非顯著基因;Log2 FC-倍數(shù)大于閾值的基因;P-統(tǒng)計顯著的基因焰盗;P & Log2 FC-差異基因.

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.

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

Maybe:
P value cut-off of 10e-6 : too relaxed
log2FC cut-off of >|2| : too stringent

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.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-8, 8),
    title = 'N061011 versus N61311',
    pCutoff = 10e-16,
    FCcutoff = 1.5,
    transcriptPointSize = 1.5,
    transcriptLabSize = 3.0)
參數(shù) 說明 默認值
pCutoff Cut-off for statistical significance. A horizontal line will be drawn at -log10(pCutoff). DEFAULT = 0.05. OPTIONAL.
FCcutoff Cut-off for absolute log2 fold-change. Vertical lines will be drawn at the negative and positive values of FCCutoff. DEFAULT = 2.0. OPTIONAL.
transcriptPointSize Size of plotted points for each transcript. DEFAULT = 0.8. OPTIONAL.
transcriptLabSize Size of labels for each transcript. DEFAULT = 3.0. OPTIONAL.

Adjust colour and alpha for point shading

adjust the value for 'alpha', which controls the transparency of the plotted points: 1 = 100% opaque; 0 = 100% transparent.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-8, 8),
    title = 'N061011 versus N61311',
    pCutoff = 10e-16,
    FCcutoff = 1.5,
    transcriptPointSize = 1.5,
    transcriptLabSize = 3.0,
    col=c('black', 'black', 'black', 'red3'),
    colAlpha = 1)
參數(shù) 說明 默認值
col Colour shading for plotted points, corresponding to < abs(FCcutoff) && > pCutoff, > abs(FCcutoff), < pCutoff, > abs(FCcutoff) && < pCutoff. DEFAULT = c("grey30", "forestgreen", "royalblue", "red2"). OPTIONAL.
colAlpha Alpha for purposes of controlling colour transparency of transcript points. DEFAULT = 0.5. OPTIONAL.

Adjust shape of plotted points

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

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-8, 8),
    title = 'N061011 versus N61311',
    pCutoff = 10e-16,
    FCcutoff = 1.5,
    transcriptPointSize = 3.0,
    transcriptLabSize = 3.0,
    shape = 8,
    colAlpha = 1)

# 注意Bioconductor版本該處shape功能并不能用璧尸,需要安裝github的開發(fā)版
EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-8, 8),
    title = 'N061011 versus N61311',
    pCutoff = 10e-16,
    FCcutoff = 1.5,
    transcriptPointSize = 2.0,
    transcriptLabSize = 3.0,
    shape = c(1, 4, 23, 25),
    colAlpha = 1)

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.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-6, 6),
    title = 'N061011 versus N61311',
    pCutoff = 10e-12,
    FCcutoff = 1.5,
    transcriptPointSize = 1.5,
    transcriptLabSize = 3.0,
    colAlpha = 1,
    cutoffLineType = 'blank',
    cutoffLineCol = 'black',
    cutoffLineWidth = 0.8,
    hline = c(10e-12, 10e-36, 10e-60, 10e-84),
    hlineCol = c('grey0', 'grey25','grey50','grey75'),
    hlineType = 'longdash',
    hlineWidth = 0.8,
    gridlines.major = FALSE,
    gridlines.minor = FALSE)
參數(shù) 說明 默認值
cutoffLineType Line type for FCcutoff and pCutoff ("blank", "solid", "dashed", "dotted", "dotdash", "longdash", "twodash"). DEFAULT = "longdash". OPTIONAL.
cutoffLineCol Line colour for FCcutoff and pCutoff. DEFAULT = "black". OPTIONAL.
cutoffLineWidth Line width for FCcutoff and pCutoff. DEFAULT = 0.4. OPTIONAL.
hline Draw one or more horizontal lines passing through this/these values on y-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). DEFAULT = NULL. OPTIONAL.
hlineType Line type for hline ('blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash'). DEFAULT = 'longdash'. OPTIONAL.
hlineCol Colour of hline. DEFAULT = 'black'. OPTIONAL.
hlineWidth Width of hline. DEFAULT = 0.4. OPTIONAL.
vline Draw one or more vertical lines passing through this/these values on x-axis. For single values, only a single numerical value is necessary. For multiple lines, pass these as a vector, e.g., c(60,90). DEFAULT = NULL. OPTIONAL.
vlineType Line type for vline ('blank', 'solid', 'dashed', 'dotted', 'dotdash', 'longdash', 'twodash'). DEFAULT = 'longdash'. OPTIONAL.
vlineCol Colour of vline. DEFAULT = 'black'. OPTIONAL.
vlineWidth Width of vline. DEFAULT = 0.4. OPTIONAL.
gridlines.major Logical, indicating whether or not to draw major gridlines. DEFAULT = TRUE. OPTIONAL
gridlines.minor Logical, indicating whether or not to draw minor gridlines. DEFAULT = TRUE. OPTIONAL

Adjust legend position, size, and text

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

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-6, 6),
    pCutoff = 10e-12,
    FCcutoff = 1.5,
    cutoffLineType = 'twodash',
    cutoffLineWidth = 0.8,
    transcriptPointSize = 3.0,
    transcriptLabSize = 4.0,
    colAlpha = 1,
    legend=c('NS','Log (base 2) fold-change','P value',
      'P value & Log (base 2) fold-change'),
    legendPosition = 'right',
    legendLabSize = 16,
    legendIconSize = 5.0)
參數(shù) 說明 默認值
legend Plot legend text. DEFAULT = c("NS", "Log2 FC", "P", "P & Log2 FC"). OPTIONAL.
legendPosition Position of legend ("top", "bottom", "left", "right"). DEFAULT = "top". OPTIONAL.
legendLabSize Size of plot legend text. DEFAULT = 14. OPTIONAL.
legendIconSize Size of plot legend icons / symbols. DEFAULT = 4.0. OPTIONAL.
legendVisible Logical, indicating whether or not to show the legend. DEFAULT = TRUE. OPTIONAL.

Note: to make the legend completely invisible, specify: legendVisible = FALSE

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.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'padj',
    xlim=c(-6,6),
    xlab = bquote(~Log[2]~ 'fold change'),
    ylab = bquote(~-Log[10]~adjusted~italic(P)),
    pCutoff = 0.0001,
    FCcutoff = 1.0,
    transcriptLabSize = 4.0,
    colAlpha = 1,
    legend=c('NS','Log2 FC','Adjusted p-value',
      'Adjusted p-value & Log2 FC'),
    legendPosition = 'bottom',
    legendLabSize = 10,
    legendIconSize = 3.0)
參數(shù) 說明 默認值
xlab Label for x-axis. DEFAULT = bquote(Log[2] "fold change"). OPTIONAL.
ylab Label for y-axis. DEFAULT = bquote(-Log[10]italic(P)). OPTIONAL.
axisLabSize Size of x- and y-axis labels. DEFAULT = 18. OPTIONAL.

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.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    xlim = c(-6,6),
    xlab = bquote(~Log[2]~ 'fold change'),
    pCutoff = 10e-14,
    FCcutoff = 2.0,
    transcriptPointSize = 3.0,
    transcriptLabSize = 4.0,
    colAlpha = 1,
    legend=c('NS','Log (base 2) fold-change','P value',
      'P value & Log (base 2) fold-change'),
    legendPosition = 'right',
    legendLabSize = 12,
    legendIconSize = 4.0,
    drawConnectors = TRUE,
    widthConnectors = 0.2,
    colConnectors = 'grey30')
參數(shù) 說明 默認值
drawConnectors Logical, indicating whether or not to connect plot labels to their corresponding points by line connectors. DEFAULT = FALSE. OPTIONAL.
widthConnectors Line width of connectors. DEFAULT = 0.5. OPTIONAL.
typeConnectors Have the arrow head open or filled ('closed')? ('open', 'closed'). DEFAULT = 'closed'. OPTIONAL.
endsConnectors Which end of connectors to draw arrow head? ('last', 'first', 'both'). DEFAULT = 'first'. OPTIONAL.
lengthConnectors Length of the connectors. DEFAULT = unit(0.01, 'npc'). OPTIONAL
colConnectors Line colour of connectors. DEFAULT = 'grey10'. OPTIONAL.

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.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = c('ENSG00000106565','ENSG00000187758'),
    xlim = c(-6,7),
    xlab = bquote(~Log[2]~ 'fold change'),
    pCutoff = 10e-14,
    FCcutoff = 2.0,
    transcriptPointSize = 3.0,
    transcriptLabSize = 5.0,
    shape = c(4, 35, 17, 18),
    colAlpha = 1,
    legend=c('NS','Log (base 2) fold-change','P value',
      'P value & Log (base 2) fold-change'),
    legendPosition = 'right',
    legendLabSize = 14,
    legendIconSize = 5.0)
參數(shù) 說明 默認值
selectLab A vector containing a subset of lab. DEFAULT = NULL. OPTIONAL.

Draw labels in boxes

To improve label clarity, we can draw simple boxes around the plots labels. This works much better when drawConnectors is also TRUE.

EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = c('ENSG00000106565','ENSG00000187758',
      'ENSG00000230795', 'ENSG00000164530',
      'ENSG00000143153'),
    xlim = c(-5.5,8),
    xlab = bquote(~Log[2]~ 'fold change'),
    pCutoff = 10e-14,
    FCcutoff = 2.0,
    transcriptPointSize = 3.0,
    transcriptLabSize = 5.0,
    transcriptLabCol = 'black',
    transcriptLabFace = 'bold',
    boxedlabels = TRUE,
    colAlpha = 4/5,
    legend=c('NS','Log (base 2) fold-change','P value',
      'P value & Log (base 2) fold-change'),
    legendPosition = 'right',
    legendLabSize = 14,
    legendIconSize = 4.0,
    drawConnectors = TRUE,
    widthConnectors = 1.0,
    colConnectors = 'black')
參數(shù) 說明 默認值
boxedlabels Logical, indicating whether or not to draw labels in boxes. DEFAULT = FALSE. OPTIONAL.

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'.

# create custom key-value pairs for 'high', 'low', 'mid' expression by fold-change
    # set the base colour as 'black'
    keyvals <- rep('black', nrow(res2))

    # set the base name/label as 'Mid'
    names(keyvals) <- rep('Mid', nrow(res2))

    # modify keyvals for transcripts with fold change > 2.5
    keyvals[which(res2$log2FoldChange > 2.5)] <- 'gold'
    names(keyvals)[which(res2$log2FoldChange > 2.5)] <- 'high'

    # modify keyvals for transcripts with fold change < -2.5
    keyvals[which(res2$log2FoldChange < -2.5)] <- 'royalblue'
    names(keyvals)[which(res2$log2FoldChange < -2.5)] <- 'low'

    unique(names(keyvals))

[1] "Mid" "low" "high"

unique(keyvals)

[1] "black" "royalblue" "gold"

 keyvals[1:20]

Mid Mid Mid Mid Mid Mid Mid Mid Mid Mid Mid Mid
"black" "black" "black" "black" "black" "black" "black" "black" "black" "black" "black" "black"
Mid Mid Mid Mid Mid Mid Mid Mid
"black" "black" "black" "black" "black" "black" "black" "black"

p1 <- EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = rownames(res2)[which(names(keyvals) %in% c('high', 'low'))],
    xlim = c(-6.5,6.5),
    xlab = bquote(~Log[2]~ 'fold change'),
    title = 'Custom colour over-ride',
    pCutoff = 10e-14,
    FCcutoff = 1.0,
    transcriptPointSize = 3.5,
    transcriptLabSize = 4.5,
    shape = c(6, 4, 2, 11),
    colCustom = keyvals,
    colAlpha = 1,
    legendPosition = 'top',
    legendLabSize = 15,
    legendIconSize = 5.0,
    drawConnectors = TRUE,
    widthConnectors = 0.5,
    colConnectors = 'grey50',
    gridlines.major = TRUE,
    gridlines.minor = FALSE,
    border = 'partial',
    borderWidth = 1.5,
    borderColour = 'black')

  p2 <- EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = rownames(res2)[which(names(keyvals) %in% c('high', 'low'))],
    xlim = c(-6.5,6.5),
    xlab = bquote(~Log[2]~ 'fold change'),
    title = 'No custom colour over-ride',
    pCutoff = 10e-14,
    FCcutoff = 1.0,
    transcriptPointSize = 3.5,
    transcriptLabSize = 4.5,
    colCustom = NULL,
    colAlpha = 1,
    legendPosition = 'top',
    legendLabSize = 15,
    legendIconSize = 5.0,
    drawConnectors = FALSE,
    widthConnectors = 0.5,
    colConnectors = 'grey50',
    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))
參數(shù) 說明 默認值
colCustom Named vector / key-value pairs that will over-ride the default colour scheme. The order must match that of toptable. Names / keys relate to groups / categories; values relate to colour. DEFAULT = NULL. OPTIONAL.

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.

# define different cell-types that will be shaded
  celltype1 <- c('ENSG00000106565', 'ENSG00000002933',
    'ENSG00000165246', 'ENSG00000224114')
  celltype2 <- c('ENSG00000230795', 'ENSG00000164530',
    'ENSG00000143153', 'ENSG00000169851',
    'ENSG00000231924', 'ENSG00000145681')

  # create custom key-value pairs for different cell-types
    # set the base shape as '3'
    keyvals.shape <- rep(3, nrow(res2))

    # set the base name/label as 'PBC'
    names(keyvals.shape) <- rep('PBC', nrow(res2))

    # modify the keyvals for cell-type 1
    keyvals.shape[which(rownames(res2) %in% celltype1)] <- 17
    names(keyvals.shape)[which(rownames(res2) %in% celltype1)] <- 'Cell-type 1'

    # modify the keyvals for cell-type 2
    keyvals.shape[which(rownames(res2) %in% celltype2)] <- 64
    names(keyvals.shape)[which(rownames(res2) %in% celltype2)] <- 'Cell-type 2'

    unique(names(keyvals.shape))

[1] "PBC" "Cell-type 1" "Cell-type 2"

unique(keyvals.shape)

[1] 3 17 64

keyvals.shape[1:20]

PBC PBC 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 3 3

 p1 <- EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = rownames(res2)[which(names(keyvals) %in% c('high', 'low'))],
    xlim = c(-6.5,6.5),
    xlab = bquote(~Log[2]~ 'fold change'),
    title = 'Custom shape over-ride',
    pCutoff = 10e-14,
    FCcutoff = 1.0,
    transcriptPointSize = 3.5,
    transcriptLabSize = 4.5,
    shapeCustom = keyvals.shape,
    colCustom = NULL,
    colAlpha = 1,
    legendLabSize = 15,
    legendPosition = 'left',
    legendIconSize = 5.0,
    drawConnectors = TRUE,
    widthConnectors = 0.5,
    colConnectors = 'grey50',
    gridlines.major = TRUE,
    gridlines.minor = FALSE,
    border = 'partial',
    borderWidth = 1.5,
    borderColour = 'black')

  # create custom key-value pairs for 'high', 'low', 'mid' expression by fold-change
    # set the base colour as 'black'
    keyvals.colour <- rep('black', nrow(res2))

    # set the base name/label as 'Mid'
    names(keyvals.colour) <- rep('Mid', nrow(res2))

    # modify keyvals for transcripts with fold change > 2.5
    keyvals.colour[which(res2$log2FoldChange > 2.5)] <- 'gold'
    names(keyvals.colour)[which(res2$log2FoldChange > 2.5)] <- 'high'

    # modify keyvals for transcripts with fold change < -2.5
    keyvals.colour[which(res2$log2FoldChange < -2.5)] <- 'royalblue'
    names(keyvals.colour)[which(res2$log2FoldChange < -2.5)] <- 'low'

    unique(names(keyvals.colour))

[1] "Mid" "low" "high"

unique(keyvals.colour)

[1] "black" "royalblue" "gold"

p2 <- EnhancedVolcano(res2,
    lab = rownames(res2),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = rownames(res2)[which(names(keyvals) %in% c('High', 'Low'))],
    xlim = c(-6.5,6.5),
    xlab = bquote(~Log[2]~ 'fold change'),
    title = 'Custom shape & colour over-ride',
    pCutoff = 10e-14,
    FCcutoff = 1.0,
    transcriptPointSize = 5.5,
    transcriptLabSize = 0.0,
    shapeCustom = keyvals.shape,
    colCustom = keyvals.colour,
    colAlpha = 1,
    legendPosition = 'top',
    legendLabSize = 15,
    legendIconSize = 5.0,
    drawConnectors = TRUE,
    widthConnectors = 0.5,
    colConnectors = 'grey50',
    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

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.

# define different cell-types that will be shaded
  celltype1 <- c('ENSG00000106565', 'ENSG00000002933')
  celltype2 <- c('ENSG00000230795', 'ENSG00000164530')
  
  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))
參數(shù) 說明 默認值
shapeCustom Named vector / key-value pairs that will over-ride the default shape scheme. The order must match that of toptable. Names / keys relate to groups / categories; values relate to shape encodings. DEFAULT = NULL. OPTIONAL.

巨人的肩膀

Publication-ready volcano plots with enhanced colouring and labeling

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市熬拒,隨后出現(xiàn)的幾起案子爷光,更是在濱河造成了極大的恐慌,老刑警劉巖澎粟,帶你破解...
    沈念sama閱讀 222,681評論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件蛀序,死亡現(xiàn)場離奇詭異,居然都是意外死亡活烙,警方通過查閱死者的電腦和手機徐裸,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,205評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來啸盏,“玉大人重贺,你說我怎么就攤上這事』嘏常” “怎么了气笙?”我有些...
    開封第一講書人閱讀 169,421評論 0 362
  • 文/不壞的土叔 我叫張陵,是天一觀的道長怯晕。 經常有香客問我潜圃,道長,這世上最難降的妖魔是什么舟茶? 我笑而不...
    開封第一講書人閱讀 60,114評論 1 300
  • 正文 為了忘掉前任谭期,我火速辦了婚禮,結果婚禮上吧凉,老公的妹妹穿的比我還像新娘崇堵。我一直安慰自己,他們只是感情好客燕,可當我...
    茶點故事閱讀 69,116評論 6 398
  • 文/花漫 我一把揭開白布鸳劳。 她就那樣靜靜地躺著,像睡著了一般也搓。 火紅的嫁衣襯著肌膚如雪赏廓。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 52,713評論 1 312
  • 那天傍妒,我揣著相機與錄音幔摸,去河邊找鬼。 笑死颤练,一個胖子當著我的面吹牛既忆,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 41,170評論 3 422
  • 文/蒼蘭香墨 我猛地睜開眼患雇,長吁一口氣:“原來是場噩夢啊……” “哼跃脊!你這毒婦竟也來了?” 一聲冷哼從身側響起苛吱,我...
    開封第一講書人閱讀 40,116評論 0 277
  • 序言:老撾萬榮一對情侶失蹤酪术,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后翠储,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體碉哑,經...
    沈念sama閱讀 46,651評論 1 320
  • 正文 獨居荒郊野嶺守林人離奇死亡登颓,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 38,714評論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了兽泄。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片薪前。...
    茶點故事閱讀 40,865評論 1 353
  • 序言:一個原本活蹦亂跳的男人離奇死亡路召,死狀恐怖偷线,靈堂內的尸體忽然破棺而出露筒,到底是詐尸還是另有隱情,我是刑警寧澤废酷,帶...
    沈念sama閱讀 36,527評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站抹缕,受9級特大地震影響澈蟆,放射性物質發(fā)生泄漏。R本人自食惡果不足惜卓研,卻給世界環(huán)境...
    茶點故事閱讀 42,211評論 3 336
  • 文/蒙蒙 一趴俘、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧奏赘,春花似錦寥闪、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,699評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至梁只,卻和暖如春缚柳,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背搪锣。 一陣腳步聲響...
    開封第一講書人閱讀 33,814評論 1 274
  • 我被黑心中介騙來泰國打工秋忙, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人构舟。 一個月前我還...
    沈念sama閱讀 49,299評論 3 379
  • 正文 我出身青樓灰追,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子弹澎,可洞房花燭夜當晚...
    茶點故事閱讀 45,870評論 2 361

推薦閱讀更多精彩內容