This function creates a volcano plot for a data frame with a log column and a p-value column. The gene names must be provided as row names.
volcanoPlot(
df,
title = NULL,
logCol = "avg_log2FC",
pvalCol = "p_val_adj",
xLab = expression(log[2] ~ fold ~ change),
yLab = expression(-log[10] ~ `p-value`),
legendTitle = "Significance",
legendLabs = c("Not significant", expression(log[2] ~ FC), "p-value",
expression(`p-value` ~ and ~ log[2] ~ FC)),
legendPos = c("right", "top", "left", "bottom"),
logFCThr = 1,
pvalThr = 1e-05,
labeledGenes = NULL,
labelOutside = FALSE,
labLogFCThr = 1.8,
labPvalThr = 1e-12,
labelType = c("boxed", "free"),
labelSize = 2.2,
labelColor = "black",
labelRepulsion = 1,
labelPull = 0,
maxOverlaps = 100,
boxPadding = 0.2,
labelPadding = 0.1,
labelSegWidth = 0.4,
pointSize = 0.8,
alpha = 0.6,
palette = c("gray31", "goldenrod2", "orchid3", "red2"),
legendTextSize = 10,
legendTitleSize = 10,
axisTextSize = 12,
axisTitleSize = 12,
theme = c("minimal", "bw", "classic", "linedraw"),
...
)An object of class gg.
A data frame with rownames as genes, a log column and a p-value column.
Plot title.
Log column.
P-value column.
x axis label.
y axis label.
Legend title.
Legend labels.
Legend position.
Threshold used to separate significant log values.
Threshold used to separate significant p-values.
Gene labels to be displayed on the plot. Default is
NULL, entailing that gene labels will be displayed on the basis
of labLogFCThr and labPvalThr, if at least one of
them is not NULL.
Display labels for points specified by
labeledGenes even if they fall outside the boundaries imposed by
labLogFCThr and labPvalThr. Ignored if labeledGenes is
NULL or both labLogFCThr and labPvalThr are NULL.
Threshold used to plot gene labels based on log values.
Ignored if labeledGenes is not NULL.
Threshold used to plot gene labels based on p-values.
Ignored if labeledGenes is not NULL.
Whether to draw a box around labels (option 'boxed') or not (option 'free'). Default is 'free'.
Label size.
Label color.
Repulsion strength between labels.
Attraction strength between a text label and its data point.
Maximum number of allowed overlaps.
Amount of padding around box.
Amount of padding around label.
Thickness of segment connecting label to point.
Point size.
Opaqueness level of point color.
Color palette.
Legend text size.
Legend title size.
Axis text size.
Axis title size.
Plot theme. Choose between 'bw', 'classic', 'linedraw' and 'minimal'. Default is 'minimal'.
Additional arguments passed to
EnhancedVolcano::EnhancedVolcano.
Users can input labeled genes in two ways:
1) By using p-value and log fold-change thresholds (the default option).
2) By inputting a list of labels.
if (requireNamespace("EnhancedVolcano", quietly=TRUE)){
filePath <- system.file('extdata', 'volcanoPlot.qs2', package='henna')
df <- qs2::qs_read(filePath)
p <- volcanoPlot(df, title='Volcano plot - beta cells', pvalThr=1e-10,
logFCThr=1,
labPvalThr=1e-150,
labLogFCThr=5.3)
}
Run the code above in your browser using DataLab