volcano: Volcano plot generator for RNA-seq data.

View source: R/volcano.R

volcanoR Documentation

Volcano plot generator for RNA-seq data.

Description

Generates a volcano plot in order to visualize the differentially expressed genes. The plot is highly customizable.

Usage

volcano(
  log2FC_data,
  padj_data,
  FC_t = 1.5,
  p_t = 0.05,
  FC_unresponsive_rigth = 1.1,
  FC_unresponsive_left = 1/FC_unresponsive_rigth,
  x_ends = NULL,
  y_min = 0,
  y_max = NULL,
  left_label = "UP",
  right_label = "DOWN",
  unresponsive_label = "NoResp",
  null_label = "NULL",
  names = as.character(c(1:length(log2FC_data))),
  left_names = FALSE,
  right_names = FALSE,
  padding = FALSE,
  names_size = 10,
  print_plot = F,
  left_color = "#00BA38",
  right_color = "#F8766D",
  unresponsive_color = "#00A5CF",
  null_color = "gray30",
  point_size = 0.5,
  legend = TRUE,
  legend_title = "Expression status",
  x_label = bquote("log"["2"] * "(Fold Change expression)"),
  y_label = bquote("-log"["10"] * "(p-value"["adjusted"] * ")"),
  title = "Volcano plot",
  sub_title = NULL,
  add_threshold_lines = T,
  threshold_line_color = "gray70",
  threshold_line_type = "dotted",
  font_family = "Helvetica",
  font_size = 12
)

Arguments

log2FC_data

Numeric vector containing the log2(FoldChange) values of each gene.

padj_data

Numeric vector of p-values. Use of adjusted p-values is recommended.

FC_t

Value of the threshold to use for the fold change expression to define differentially expressed genes, expressed as linear value. By default 1.5 and by consequence 1/1.5.

p_t

Value of the threshold to use for the p-values to define differentially expressed genes, expressed as linear value. By default 0.05.

FC_unresponsive_rigth

Value of the threshold to use for the fold change expression to define unresponsive genes when FC > 1, expressed as linear value. By default 1.1. If NULL it will be calculated symmetrically from FC_NoResp_left as 1/FC_NoResp_left.

FC_unresponsive_left

Value of the threshold to use for the fold change expression to define unresponsive genes when FC < 1, expressed as linear value. By default 1/FC_unresponsive_rigth. If NULL it will be calculated symmetrically from FC_NoResp_rigth as 1/FC_NoResp_rigth.

x_ends

Numeric positive value to define manually the range of the X-axis: it will be calculated as c(-x_ends, x_ends), for this reason the plot will be symmetrical. By default NULL, the range is assigned automatically and the plot can be asymmetrical.

y_min

Numeric value for the minimum value of the Y-axis. By default 0. Set it to NULL for automatic computation.

y_max

Numeric value for the maximum value of the Y-axis. By default NULL.

left_label

String to indicate the label to use for the set of genes in the left side of the graph (those with FoldChange < 1/FC_t and p.value < p_t. By default "UP".

right_label

String to indicate the label to use for the set of genes in the right side of the graph (those with FoldChange > FC_t and p.value < p_t. By default "DOWN".

unresponsive_label

String to indicate the label to use for the set of unresponsive genes (those with FC_unresponsive_left < FoldChange < FC_unresponsive_rigth and p.value > p_t. By default "NoResp".

null_label

String to indicate the label to use for the set of null genes (those with 1/FC_t < FoldChange < FC_t and p.value < p_t. By default "NULL".

names

String vector with the names to be plotted if required, eg. gene names. By default as.character(c(1:length(log2FC_data))).

left_names

Logic value to indicate if to print the set of differentially expressed genes in the left side of the graph (those with FoldChange < 1/FC_t and p.value < p_t. By default FALSE.

right_names

Logic value to indicate if to print the set of differentially expressed genes in the right side of the graph (those with FoldChange > FC_t and p.value < p_t. By default FALSE.

padding

Logic value to indicate if to plot the padding around the names of genes. By default FALSE.

names_size

Numeric value to define de size of the point names size. By default 10.

print_plot

Logic value to define whether to print the volcano plot once created. By default FALSE.

left_color

String to indicate the color to use for the set of genes in the left side of the graph (those with FoldChange < 1/FC_t and p.value < p_t. By default "#00BA38", a green.

right_color

String to indicate the color to use for the set of genes in the right side of the graph (those with FoldChange > FC_t and p.value < p_t. By default "#F8766D", a pink/red.

unresponsive_color

String to indicate the color to use for the set of unresponsive genes (those with FC_unresponsive_left < FoldChange < FC_unresponsive_rigth and p.value > p_t. By default "#00A5CF", a light blue.

null_color

String to indicate the color to use for the set of null genes (those with 1/FC_t < FoldChange < FC_t and p.value < p_t. By default "gray30", a dark gray.

point_size

Numeric value to define de size of the points. By default 0.5.

legend

Logic value to define if to print the legend. By default TRUE.

legend_title

A string to indicate the label of the legend title. By default "Expression status".

x_label

A string to indicate the X-axis label. By default "log2(fold change expression)".

y_label

A string to indicate the Y-axis label. By default "-log10(p-value adjusted)".

title

A string to indicate the title of the plot. By default "Volcano plot".

sub_title

A string to indicate the subtitle of the plot. By default NULL, no subtitle is written.

add_threshold_lines

Logic value to define if lines for the thresholds, both FC and p.value, should be plotted. By default TRUE.

threshold_line_color

String to define the color of the threshold lines. By default "gray70"

threshold_line_type

String or numeric value to define the threshold lines type. Both numeric and string standard R codes are accepted. By default "dotted", equivalent to 2.

font_family

String to define the font family to use in the plot writings. By default "Helvetica".

font_size

Numeric value to define the font size. By default 12.

Value

A plot in ggplot2 format.


sebastian-gregoricchio/Rseb documentation built on Sept. 4, 2024, 1:59 p.m.