volcano_plot | R Documentation |
Draw a volcano plot using reasonable default arguments.
volcano_plot(
x,
n = NULL,
lfc_colname = c("logfc", "log2fold", "log2fc", "lfc", "l2fc", "logratio", "log2ratio"),
fold_colname = c("fold", "fc", "ratio"),
fold_cutoff = 1.5,
fold_max_range = 16,
fold_min_range = 4,
sig_colname = c("adj.P.Val", "padj", "adj.pval", "adjp", "P.Value"),
sig_cutoff = 0.05,
sig_max_range = 1e-10,
sig_min_range = 1e-04,
expr_colname = c("mgm", "groupmean", "mean", "AveExpr", "fkpm", "rpkm", "tpm", "cpm"),
expr_cutoff = NULL,
label_colname = c("gene", "symbol", "protein", "probe", "assay"),
main = "Volcano Plot",
submain = NULL,
blockarrow = TRUE,
blockarrow_colors = c(hit = "#E67739FF", up = "#990000FF", down = "#000099FF"),
blockarrow_font = 1,
blockarrow_cex = c(1.2, 1.2),
blockarrow_label_cex = 1,
blockarrow_shadowtext = TRUE,
symmetric_axes = TRUE,
do_cutoff_caption = TRUE,
caption_cex = 0.8,
include_axis_prefix = FALSE,
n_x_labels = 12,
n_y_labels = 7,
xlim = NULL,
ylim = NULL,
pt_cex = 0.9,
pt_pch = 21,
hit_type = "hits",
color_set = c(base = "#77777777", up = "#99000088", down = "#00009988", hi =
"#FFDD55FF", hi_up = "#FFDD55FF", hi_down = "#FFDD55FF"),
border_set = NULL,
point_colors = NULL,
border_colors = NULL,
abline_color = "#000000AA",
smooth = TRUE,
smooth_func = jamba::plotSmoothScatter,
smooth_ramp = colorRampPalette(c("white", "lightblue", "lightskyblue3", "royalblue",
"darkblue", "orange", "darkorange1", "orangered2")),
tophist = FALSE,
tophist_cutoffs = c("pvalue", "foldchange"),
tophist_breaks = 100,
tophist_color = "#000099FF",
tophist_fraction = 1/3,
tophist_by = 0.2,
hi_points = NULL,
hi_colors = NULL,
hi_hits = FALSE,
hi_cex = 1,
do_both = FALSE,
label_hits = FALSE,
add_plot = FALSE,
xlab = NULL,
ylab = NULL,
cex.axis = 1.2,
mar_min = c(6, 5, 6, 5),
transFactor = 0.24,
transformation = function(x) {
x^transFactor
},
nbin = 256,
verbose = TRUE,
...
)
x |
|
n |
|
lfc_colname |
|
fold_colname |
|
fold_cutoff |
|
fold_max_range |
|
fold_min_range |
|
sig_colname |
|
sig_cutoff |
|
sig_max_range |
|
sig_min_range |
|
expr_colname |
|
expr_cutoff |
|
label_colname |
|
main |
|
submain |
|
blockarrow |
|
blockarrow_colors , blockarrow_font , blockarrow_label , blockarrow_shadowtext |
arguments used when |
symmetric_axes |
|
do_cutoff_caption |
|
caption_cex |
|
include_axis_prefix |
|
n_x_labels , n_y_labels |
|
xlim , ylim |
|
pt_cex , pt_pch |
|
hit_type |
|
color_set |
|
border_set |
|
point_colors , border_colors |
optional |
abline_color |
|
smooth |
|
smooth_func |
|
smooth_ramp |
|
tophist |
|
tophist_cutoffs , tophist_breaks , tophist_fraction , tophist_by |
arguments used when |
hi_points |
|
hi_hits |
|
hi_cex |
|
do_both |
|
label_hits |
|
add_plot |
|
xlab , ylab |
|
cex.axis |
|
transformation |
|
nbin |
|
verbose |
|
... |
additional arguments are ignored. |
`numeric` |
vector used to ensure that each margin size is
at least a minimum value, applied to |
Draw a volcano plot using a reasonably robust set of default arguments, and with a large number of customization options. The default plot uses smooth scatter plot for much improved display of point density.
This function produces a volcano plot, which consists of change on the x-axis, and significance on the y-axis.
In addition to displaying the volcano plot, this function also displays statistical thresholds, and marks entries as "hits" by up to three conceptual filters:
"change" - fold change fold_cutoff
"significant" - statistical P-value sig_cutoff
"detected" - signal expr_cutoff
If any cutoff is not defined, that filter is ignored.
Change is usually represented using log2 fold changes,
and in this case is labeled using normal scale fold change
values. The threshold is defined with fold_cutoff
using
normal space values. The log2 fold change values which
have greater magnitude than fold_cutoff
are marked
"changing".
Significance usually represents adjusted P-value, or raw
P-value if necessary. The threshold is defined with sig_cutoff
using a P-value below which entries are marked "significant".
Finally, since some statistical criteria also include a minimum
level of signal, a threshold expr_cutoff
requires an entry to
have signal at or above this value to be considered "detected".
The default behavior of volcano_plot()
is to render a
smooth scatter plot. A smooth scatter plot is much more
effective at representing the true point density along
the figure, which is one of the primary reasons to produce
the plot.
The argument hi_points
can be used to highlight a specific
subset of points on the figure, even when smooth=TRUE
.
Alternatively, hi_hits=TRUE
will render all statistical
hits as points, which will appear on top of the smooth
scatter plot when smooth=TRUE
.
Other jam plot functions:
ggjammaplot()
n <- 15000;
set.seed(12);
x_lfc <- (rnorm(n) * 1);
x_lfc <- x_lfc^2 * sign(x_lfc);
x_lfc <- x_lfc[order(-abs(x_lfc) + rnorm(n) / 2)];
x_pv <- sort(10^-(rnorm(n)*1.5)^2);
x <- data.frame(
Gene=paste("gene", seq_len(n)),
`log2fold Group-Control`=x_lfc,
`P.Value Group-Control`=x_pv[order(-abs(x_lfc))],
`mgm Group-Contol`=((rnorm(1500)+5)^2)/5,
check.names=FALSE);
volcano_plot(x);
volcano_plot(x, expr_cutoff=3);
# volcano_plot(x, mar_min=c(7, 6, 6, 5), blockarrow_cex=1);
# par("mfrow"=c(2, 1));
# volcano_plot(x);
# volcano_plot(x);
# par("mfrow"=c(1, 1));
x[["fold Group-Control"]] <- log2fold_to_fold(x[["log2fold Group-Control"]]);
x[["adj.P.Val Group-Control"]] <- x[["P.Value Group-Control"]];
volcano_plot(x, hi_hits=TRUE);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.