Skip to contents

An R6 class for creating and managing volcano plots for differential expression analysis. This class provides methods for data preparation, plotting, and customisation of volcano plots.

Details

The Volcano class uses differential expression data to create volcano plots, highlighting significantly up- and down-regulated features based on log2 fold change and a chosen statistical measure (e.g., FDR or p-value).

Public fields

data

A data.table containing the differential expression data.

statistic

Character. The statistic used for significance (default: "fdr").

statistic_cutoff

Numeric. The cutoff value for the chosen statistic (default: 0.25).

log2_cutoff

Numeric. The log2 fold change cutoff for significance (default: log2(1.5)).

head_labels

Integer. The number of top features to label in the plot (default: 10).

Methods


Method new()

Create a new Volcano object.

Usage

Volcano$new(
  data = data.table(),
  statistic = "fdr",
  statistic_cutoff = 0.25,
  log2_cutoff = log2(1.5),
  head_labels = 10
)

Arguments

data

A data.table containing differential expression data.

statistic

Character. The statistic used for significance (default: "fdr").

statistic_cutoff

Numeric. The cutoff value for the chosen statistic (default: 0.25).

log2_cutoff

Numeric. The log2 fold change cutoff for significance (default: log2(1.5)).

head_labels

Integer. The number of top features to label in the plot (default: 10).


Method process()

Process the input data for plotting.

Usage

Volcano$process()


Method plot_volcano()

Create the volcano plot.

Usage

Volcano$plot_volcano(
  plot_title = "Volcano Plot",
  plot_subtitle = "",
  plot_caption = "",
  plot_y_lab = stringr::str_interp("-log10(${self$statistic})"),
  plot_x_lab = "log2(fold change)",
  legend_position = "bottom",
  plot_theme = "dark",
  label = TRUE
)

Arguments

plot_title

Character. Title of the plot.

plot_subtitle

Character. Subtitle of the plot.

plot_caption

Character. Caption for the plot.

plot_y_lab

Character. Label for y-axis.

plot_x_lab

Character. Label for x-axis.

legend_position

Character. Position of the legend (default: "bottom").

plot_theme

Character. Theme for the plot (default: "dark").

label

Logical. Whether to add labels to points (default: TRUE).

Returns

A ggplot object representing the volcano plot.


Method clone()

The objects of this class are cloneable with this method.

Usage

Volcano$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.