一般我们用ggplot2 绘火山图 ,但是ggplot2对于R初学者来说配置是很复杂的。EnhancedVolcano是一个使用极其简单的火山图绘制包。
# 安装EnhancedVolcano
if (!requireNamespace('BiocManager', quietly = TRUE))
install.packages('BiocManager')
BiocManager::install('EnhancedVolcano')
# 或者
devtools::install_github('kevinblighe/EnhancedVolcano')
下面通过一个示例来演示:
library(airway)
library(magrittr)
library("DESeq2")
# 加载演示数据
data("airway")
airway$dex %<>% relevel("untrt")
# 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(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,
pointSize = 4.0,
labSize = 5.0,
boxedLabels = T,
shape = c(4, 35, 17, 18),
colAlpha = 1,
legendPosition = 'right',
legendLabSize = 9,
legendIconSize = 5.0)
参考资料:
1.http://www.bioconductor.org/packages/release/bioc/vignettes/EnhancedVolcano/inst/doc/EnhancedVolcano.html