R/volcano_plots.R
volcano_plot.Rd
Create a “volcano” plot to visualize the
results of a differential count analysis using a topic model. Here,
the volcano plot is a scatterplot in which the posterior mean
log-fold change (LFC), estimated by running the methods implemented
in de_analysis
, is plotted against the estimated
z-score. Variations on this volcano plot may also be created, for
example by showing f0 (the null-model estimates) instead of the
z-scores. Use volcano_plotly
to create an interactive
volcano plot.
volcano_plot(
de,
k,
labels,
y = c("z", "f0"),
do.label = volcano_plot_do_label_default,
ymin = 1e-06,
ymax = Inf,
max.overlaps = Inf,
plot.title = paste("topic", k),
ggplot_call = volcano_plot_ggplot_call
)
# S3 method for topic_model_de_analysis
plot(x, ...)
volcano_plotly(
de,
k,
file,
labels,
y = c("z", "f0"),
ymin = 1e-06,
ymax = Inf,
width = 500,
height = 500,
plot.title = paste("topic", k),
plot_ly_call = volcano_plot_ly_call
)
volcano_plot_do_label_default(lfc, y)
volcano_plot_ggplot_call(dat, y, plot.title, max.overlaps = Inf, font.size = 9)
volcano_plot_ly_call(dat, y, plot.title, width, height)
An object of class “topic_model_de_analysis”,
usually an output from de_analysis
. It is better to
run de_analysis
with shrink.method = "ash"
so that
the points in the volcano plot can be coloured by their local false
sign rate (lfsr).
The topic, selected by number or name.
Character vector specifying how the points in the
volcano plot are labeled. This should be a character vector with
one entry per LFC estimate (row of de$postmean
). When not
specified, the row names of de$postmean
are used. When
available. labels are added to the plot using
geom_text_repel
.
A vector of the same length as lfc
.
The function used to deetermine which LFC estimates
to label. Replace volcano_plot_do_label_default
with your
own function to customize the labeling of points in the volcano
plot.
Y-axis values less than ymin
are shown as
ymin
.
Y-axis values greater than ymax
are shown as
ymax
. When y = "z"
, setting ymax
to a finite
value can improve the volcano plot when some z-scores are much
larger (in magnitude) than others.
Argument passed to
geom_text_repel
.
The title of the plot.
The function used to create the plot. Replace
volcano_plot_ggplot_call
with your own function to customize
the appearance of the plot.
An object of class “topic_model_de_analysis”,
usually an output from de_analysis
.
Additional arguments passed to volcano_plot
.
Save the interactive volcano plot to this HTML
file using saveWidget
.
Width of the plot in pixels. Passed as argument
“width” to plot_ly
.
Height of the plot in pixels. Passed as argument
“height” to plot_ly
.
The function used to create the plot. Replace
volcano_plot_ly_call
with your own function to customize
the appearance of the interactive plot.
A vector of log-fold change estimates.
A data frame passed as input to
ggplot
, containing, at a minimum, columns
“f0”, “postmean”, “y”, “lfsr” and
“label”.
Font size used in plot.
A ggplot
object or a plotly
object.
Interactive volcano plots can be created using the ‘plotly’ package. The “hover text” shows the label and detailed LFC statistics.
# See help(de_analysis) for examples.