Volcano {statVisual} | R Documentation |
Volcano Plot
Description
Volcano plot with the option to label the significant results.
Usage
Volcano(
resFrame,
stats,
p.value,
group = NULL,
xlab = "logFC",
ylab = "-log10(p value)",
title = NULL,
vline.col = "orange",
hline.col = "dodgerblue",
vline = list(xintercept = c(-1, 1), label = c(-1, 1)),
hline = list(
yintercept = c(-log10(0.05),
-log10(0.05/nrow(resFrame)),
-log10(max(resFrame[p.adjust(resFrame[, p.value],
method = "fdr") <= 0.05, p.value]))),
label = c("p value: 0.05", "Bonferroni: 0.05", "FDR: 0.05")),
rowname.var = NULL,
point.size = 3,
theme_classic = TRUE,
addThemeFlag = TRUE,
...)
Arguments
resFrame |
A data frame stored information about the results, including gene id, statistic (e.g., log fold change, odds ratio), p-value, and significance of a gene. |
stats |
character. The column name of |
p.value |
character. The column name of |
group |
character. The column name of |
xlab |
x axis label |
ylab |
y axis label |
title |
title of the plot |
vline.col |
color of the vertical lines (default: “orange”) |
hline.col |
color of the horizontal lines (default: “dodgerblue”) |
vline |
A list with two elements: “xintercept” and “label”, where the former element is a numeric vector indicating the x-axis location to draw vertical color lines and the latter element is list of labels for the elements in “xintercept”. |
hline |
A list with two elements: “yintercept” and “label”, where the former element is a numeric vector indicating the y-axis location to draw horizontal color lines and the latter element is list of labels for the elements in “xintercept”. |
rowname.var |
character. The column name of |
point.size |
size of data points in the plot. |
theme_classic |
logical. Use classic background without grids (default: TRUE). |
addThemeFlag |
logical. Indicates if light blue background and white grid should be added to the figure. |
... |
other input parameters for facet & theme |
Value
A list with 9 elements.
data
, layers
, scales
, mapping
,
theme
, coordinates
,
facet
plot_env
, and labels
.
Author(s)
Wenfei Zhang <Wenfei.Zhang@sanofi.com>, Weiliang Qiu <Weiliang.Qiu@sanofi.com>, Xuan Lin <Xuan.Lin@sanofi.com>, Donghui Zhang <Donghui.Zhang@sanofi.com>
Examples
library(ggrepel)
library(limma)
# load the simulated dataset
data(esSim)
print(esSim)
# expression levels
y = exprs(esSim)
print(dim(y))
print(y[1:2,])
# phenotype data
pDat = pData(esSim)
print(dim(pDat))
print(pDat)
# design matrix
design = model.matrix(~grp, data = pDat)
print(design)
options(digits = 3)
# Ordinary fit
fit <- lmFit(y, design)
fit2 <- eBayes(fit)
# get result data frame
resFrame = topTable(fit2,coef = 2, number = nrow(esSim))
print(dim(resFrame))
print(resFrame[1:2,])
resFrame$sigFlag = resFrame$adj.P.Val < 0.05
resFrame$probe = rownames(resFrame)
# make sure set NA to genes non-differentially expressed
resFrame$probe[which(resFrame$sigFlag == FALSE)] = NA
print(resFrame[1:2,])
print(table(resFrame$sigFlag, useNA = "ifany"))
statVisual(type = 'Volcano',
resFrame = resFrame,
stats = 'logFC',
p.value = 'P.Value',
group = 'sigFlag',
rowname.var = 'probe',
point.size = 1)
Volcano(
resFrame = resFrame,
stats = 'logFC',
p.value = 'P.Value',
group = 'sigFlag',
rowname.var = 'probe',
point.size = 1)