Hey, thanks for the comments.
There is a somewhat indirect way of doing this by modifying the transparency of the points via colAlpha
. Take a look:
library(airway)
library(magrittr)
data("airway")
airway$dex %<>% relevel("untrt")
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)
p1 <- EnhancedVolcano(res1,
lab = rownames(res1),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-24,
FCcutoff = 2.0,
title = "colAlpha = 1.0",
xlim = c(-6.5,6.5),
transcriptPointSize = 3.0,
transcriptLabSize = 2.0,
colAlpha = 1.0,
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0,
drawConnectors = TRUE,
widthConnectors = 0.26,
colConnectors = "grey")
p2 <- EnhancedVolcano(res1,
lab = rownames(res1),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-24,
FCcutoff = 2.0,
title = "colAlpha = 0.3",
xlim = c(-6.5,6.5),
transcriptPointSize = 3.0,
transcriptLabSize = 2.0,
colAlpha = 0.3,
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0,
drawConnectors = TRUE,
widthConnectors = 0.26,
colConnectors = "grey")
p3 <- EnhancedVolcano(res1,
lab = rownames(res1),
x = "log2FoldChange",
y = "pvalue",
pCutoff = 10e-24,
FCcutoff = 2.0,
title = "colAlpha = 0.0",
xlim = c(-6.5,6.5),
transcriptPointSize = 5.0,
transcriptLabSize = 0.0,
colAlpha = 0.1,
legendPosition = "bottom",
legendLabSize = 10,
legendIconSize = 3.0,
drawConnectors = FALSE)
library(gridExtra)
library(grid)
grid.arrange(p1, p2, p3, ncol=3, top="EnhancedVolcano, adjusting colAlpha")
grid.rect(gp=gpar(fill=NA))
This may not be exactly what you want(?). In certain situations, it is of course almost impossible to fit all points and labels into the plot space.
However, it is possible to 'prioritise' certain points / transcripts over others by changing the order of your results object. EnhancedVolcano utilises the ggplot2 engine. When ggplot2 plots the data, it starts from the top of your input data-frame and then moves down trough each row. If your most important transcript is at the top of the data-frame, then it will be plot first and may be overwritten by another point. So, priority transcripts / points should come toward the last few rows of the data-frame. Does that make sense?
If this is not a solution, then I can make a fix for the next release of EnhancedVolcano that will allow the user to plot squares, triangles, open circles, etc.
Kevin
Kevin thank you for your answer! It is great to know how to modify the colalpha value. Would love to see more choices for plotting in the future release! Another choice I would like to include (not sure whether this make sense) is to have a break in the Y axis. In case there is a really small adjust P value that change the scale too much. Thank you again!
Hey, yes, I will be implementing the changes, hopefully at the end of this week. They will only be available in the development version on GitHub. At the next official Bioconductor release, it will be available through the standard means. Regarding the y-axis issue, I will look into it.
Date stamp: 22nd January 2019
Hey wanhe.li, can you let me know if you managed to find a solution to this? EnhancedVolcano uses the ggplot2 'engine', so, ggplot2 functions can be added to EnhancedVolcano objects.
For example, re-using my code below: