Skip to contents

Volcano Plot

Usage

draw_volcano(
  x,
  pvals,
  xnames = NULL,
  group = NULL,
  x_thresh = 0,
  p_thresh = 0.05,
  p_transform = function(x) -log10(x),
  p_adjust_method = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr",
    "none"),
  legend = NULL,
  legend_lo = NULL,
  legend_hi = NULL,
  label_lo = "Low",
  label_hi = "High",
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  margin = list(b = 65, l = 65, t = 50, r = 10, pad = 0),
  xlim = NULL,
  ylim = NULL,
  alpha = NULL,
  hline = NULL,
  hline_col = NULL,
  hline_width = 1,
  hline_dash = "solid",
  hline_annotate = NULL,
  hline_annotation_x = 1,
  annotate = TRUE,
  annotate_col = theme[["labs_col"]],
  theme = rtemis_theme,
  font_size = 16,
  palette = NULL,
  legend_x_lo = NULL,
  legend_x_hi = NULL,
  legend_y = 0.97,
  annotate_n = 7,
  ax_lo = NULL,
  ay_lo = NULL,
  ax_hi = NULL,
  ay_hi = NULL,
  annotate_alpha = 0.7,
  hovertext = NULL,
  displayModeBar = FALSE,
  filename = NULL,
  file_width = 500,
  file_height = 500,
  file_scale = 1,
  verbosity = 1L,
  ...
)

Arguments

x

Numeric vector: Input values, e.g. log2 fold change, coefficients, etc.

pvals

Numeric vector: p-values.

xnames

Character vector: x names.

group

Factor: Used to color code points. If NULL, significant points below x_thresh, non-significant points, and significant points above x_thresh will be plotted with the first, second and third color of palette.

x_thresh

Numeric x-axis threshold separating low from high.

p_thresh

Numeric: p-value threshold of significance.

p_transform

function.

p_adjust_method

Character: p-value adjustment method. "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". Default = "holm". Use "none" for raw p-values.

legend

Logical: If TRUE, show legend. Will default to FALSE, if group = NULL, otherwise to TRUE.

legend_lo

Character: Legend to annotate significant points below the x_thresh.

legend_hi

Character: Legend to annotate significant points above the x_thresh.

label_lo

Character: label for low values.

label_hi

Character: label for high values.

main

Character: Main title.

xlab

Character: x-axis label.

ylab

Character: y-axis label.

margin

Named list of plot margins. Default = list(b = 65, l = 65, t = 50, r = 10, pad = 0).

xlim

Numeric vector, length 2: x-axis limits.

ylim

Numeric vector, length 2: y-axis limits.

alpha

Numeric: point transparency.

hline

Numeric: If defined, draw a horizontal line at this y value.

hline_col

Color for hline.

hline_width

Numeric: Width for hline.

hline_dash

Character: Type of line to draw: "solid", "dot", "dash", "longdash", "dashdot", or "longdashdot".

hline_annotate

Character: Text of horizontal line annotation if hline is set.

hline_annotation_x

Numeric: x position to place annotation with paper as reference. 0: to the left of the plot area; 1: to the right of the plot area.

annotate

Logical: If TRUE, annotate significant points.

annotate_col

Color for annotations.

theme

Output of an rtemis theme function (list of parameters) or theme name. Use themes() to print available themes.

font_size

Integer: Font size.

palette

Character: Name of rtemis palette to use.

legend_x_lo

Numeric: x position of legend_lo.

legend_x_hi

Numeric: x position of legend_hi.

legend_y

Numeric: y position for legend_lo and legend_hi.

annotate_n

Integer: Number of significant points to annotate.

ax_lo

Numeric: Sets the x component of the arrow tail about the arrow head for significant points below x_thresh.

ay_lo

Numeric: Sets the y component of the arrow tail about the arrow head for significant points below x_thresh.

ax_hi

Numeric: Sets the x component of the arrow tail about the arrow head for significant points above x_thresh.

ay_hi

Numeric: Sets the y component of the arrow tail about the arrow head for significant points above x_thresh.

annotate_alpha

Numeric: Transparency for annotations.

hovertext

Character vector: Text to display on hover.

displayModeBar

Logical: If TRUE, display plotly mode bar.

filename

Character: Path to save the plot image.

file_width

Numeric: Width of the saved plot image.

file_height

Numeric: Height of the saved plot image.

file_scale

Numeric: Scale of the saved plot image.

verbosity

Integer: Verbosity level.

...

Additional parameters passed to draw_scatter.

Value

A plotly object.

Author

EDG

Examples

if (FALSE) { # \dontrun{
set.seed(2019)
x <- rnormmat(500, 500)
y <- x[, 3] + x[, 5] - x[, 9] + x[, 15] + rnorm(500)
mod <- massGLM(y, x)
draw_volcano(mod$summary$`Coefficient y`, mod$summary$`p_value y`)
} # }