Convenience function to create volcano plots from results generated within
this package. This is mostly used by {sparrow.shiny}
.
volcanoPlot(
x,
stats = "dge",
xaxis = "logFC",
yaxis = "pval",
idx,
xtfrm = base::identity,
ytfrm = function(vals) -log10(vals),
xlab = xaxis,
ylab = sprintf("-log10(%s)", yaxis),
highlight = NULL,
horiz_line = c(padj = 0.1),
xhex = NULL,
yhex = NULL,
width = NULL,
height = NULL,
shiny_source = "mgvolcano",
ggtheme = ggplot2::theme_bw(),
...
)
A SparrowResult
object, or a data.frame
One of "dge"
or resultNames(x)
the column of the the provided (or extracted)
data.frame
to use for the xaxis and yaxis of the volcano
The column of the data.frame
to use as the identifier
for the element in the row. You probably don't want to mess with this
A function that transforms the xaxis
column to an
appropriate scale for the x-axis. This is the identity
function
by default, because most often the logFC is plotted as is.
A function that transforms the yaxis
column to an
appropriate scale for the y-axis. This is the -log10(yval)
function
by default, because this is how we most often plot the y-axis.
x and y axis labels
A vector of featureIds to highlight, or a GeneSetDb that we can extract the featureIds from for this purpose.
A (optionally named) number vecor (length 1) that indicates
where a line should be drawn across the volcano plot. This is usually done
to signify statistical significance. When the number is "named", this
indicates that you want to find an approximation of the values plotted
on y based on some transformation of the values that is the named column
of x (like "padj"). The default value c(padj = 0.10)
indicates you
want to draw a line at approximately where the adjust pvalue of 0.10 is
on the y-axis, which is the nominal pvalues.
The raw .xv
(not xtfrm(.xv)
) value that acts
as a threshold such that values less than this will be hexbinned.
the .yvt
value threshold. Vaues less than this will
be hexbinned.
the width and height of the output plotly plot
the name of this element that is used in shiny callbacks.
Defaults to "mggenes"
.
a ggplot theme, like the thing returned from
ggplot2::theme_bw()
, for instance.
pass through arguments (not used)
a ploty plot object
mg <- exampleSparrowResult()
volcanoPlot(mg)
volcanoPlot(mg, xhex=1, yhex=0.05)