Learn R Programming

henna (version 0.7.5)

volcanoPlot: Create a volcano plot

Description

This function creates a volcano plot for a data frame with a log column and a p-value column. The gene names must be provided as row names.

Usage

volcanoPlot(
  df,
  title = NULL,
  logCol = "avg_log2FC",
  pvalCol = "p_val_adj",
  xLab = expression(log[2] ~ fold ~ change),
  yLab = expression(-log[10] ~ `p-value`),
  legendTitle = "Significance",
  legendLabs = c("Not significant", expression(log[2] ~ FC), "p-value",
    expression(`p-value` ~ and ~ log[2] ~ FC)),
  legendPos = c("right", "top", "left", "bottom"),
  logFCThr = 1,
  pvalThr = 1e-05,
  labeledGenes = NULL,
  labelOutside = FALSE,
  labLogFCThr = 1.8,
  labPvalThr = 1e-12,
  labelType = c("boxed", "free"),
  labelSize = 2.2,
  labelColor = "black",
  labelRepulsion = 1,
  labelPull = 0,
  maxOverlaps = 100,
  boxPadding = 0.2,
  labelPadding = 0.1,
  labelSegWidth = 0.4,
  pointSize = 0.8,
  alpha = 0.6,
  palette = c("gray31", "goldenrod2", "orchid3", "red2"),
  legendTextSize = 10,
  legendTitleSize = 10,
  axisTextSize = 12,
  axisTitleSize = 12,
  theme = c("minimal", "bw", "classic", "linedraw"),
  ...
)

Value

An object of class gg.

Arguments

df

A data frame with rownames as genes, a log column and a p-value column.

title

Plot title.

logCol

Log column.

pvalCol

P-value column.

xLab

x axis label.

yLab

y axis label.

legendTitle

Legend title.

legendLabs

Legend labels.

legendPos

Legend position.

logFCThr

Threshold used to separate significant log values.

pvalThr

Threshold used to separate significant p-values.

labeledGenes

Gene labels to be displayed on the plot. Default is NULL, entailing that gene labels will be displayed on the basis of labLogFCThr and labPvalThr, if at least one of them is not NULL.

labelOutside

Display labels for points specified by labeledGenes even if they fall outside the boundaries imposed by labLogFCThr and labPvalThr. Ignored if labeledGenes is NULL or both labLogFCThr and labPvalThr are NULL.

labLogFCThr

Threshold used to plot gene labels based on log values. Ignored if labeledGenes is not NULL.

labPvalThr

Threshold used to plot gene labels based on p-values. Ignored if labeledGenes is not NULL.

labelType

Whether to draw a box around labels (option 'boxed') or not (option 'free'). Default is 'free'.

labelSize

Label size.

labelColor

Label color.

labelRepulsion

Repulsion strength between labels.

labelPull

Attraction strength between a text label and its data point.

maxOverlaps

Maximum number of allowed overlaps.

boxPadding

Amount of padding around box.

labelPadding

Amount of padding around label.

labelSegWidth

Thickness of segment connecting label to point.

pointSize

Point size.

alpha

Opaqueness level of point color.

palette

Color palette.

legendTextSize

Legend text size.

legendTitleSize

Legend title size.

axisTextSize

Axis text size.

axisTitleSize

Axis title size.

theme

Plot theme. Choose between 'bw', 'classic', 'linedraw' and 'minimal'. Default is 'minimal'.

...

Additional arguments passed to EnhancedVolcano::EnhancedVolcano.

Details

Users can input labeled genes in two ways:

1) By using p-value and log fold-change thresholds (the default option).

2) By inputting a list of labels.

Examples

Run this code
if (requireNamespace("EnhancedVolcano", quietly=TRUE)){
filePath <- system.file('extdata', 'volcanoPlot.qs2', package='henna')
df <- qs2::qs_read(filePath)
p <- volcanoPlot(df, title='Volcano plot - beta cells', pvalThr=1e-10,
logFCThr=1,
labPvalThr=1e-150,
labLogFCThr=5.3)
}

Run the code above in your browser using DataLab