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(),
  ...
)

Arguments

x

A SparrowResult object, or a data.frame

stats

One of "dge" or resultNames(x)

xaxis, yaxis

the column of the the provided (or extracted) data.frame to use for the xaxis and yaxis of the volcano

idx

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

xtfrm

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.

ytfrm

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.

xlab, ylab

x and y axis labels

highlight

A vector of featureIds to highlight, or a GeneSetDb that we can extract the featureIds from for this purpose.

horiz_line

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.

xhex

The raw .xv (not xtfrm(.xv)) value that acts as a threshold such that values less than this will be hexbinned.

yhex

the .yvt value threshold. Vaues less than this will be hexbinned.

width, height

the width and height of the output plotly plot

shiny_source

the name of this element that is used in shiny callbacks. Defaults to "mggenes".

ggtheme

a ggplot theme, like the thing returned from ggplot2::theme_bw(), for instance.

...

pass through arguments (not used)

Value

a ploty plot object

Examples

mg <- exampleSparrowResult()
volcanoPlot(mg)
volcanoPlot(mg, xhex=1, yhex=0.05)