volcanoPlot: Volcano plot function

View source: R/volcanoPlot.R

volcanoPlotR Documentation

Volcano plot function

Description

Volcano plot function

Usage

volcanoPlot(
  log2fc,
  pValue,
  data,
  FDR_threshold = 0.05,
  LFC_threshold = log2(1.5),
  color = c("red", "black"),
  geneNames = NULL,
  nb_geneTags = 20,
  logTransformPVal = TRUE
)

Arguments

log2fc

a variable of the magnitude of change (fold-change) in base log 2 corresponding to the x-axis.

pValue

a variable of statistical significance (p-value) corresponding to the y-axis.

data

a data.frame of differentially expressed results from which the variable log2fc, pValue and geneNames (if it is used) should be taken.

FDR_threshold

a threshold of false discovery rate.

LFC_threshold

a threshold of log fold change.

color

a vector of two colors for significant or not significant points.

geneNames

a vector of gene names if you want to put gene tags on the volcano plot. Default is NULL.

nb_geneTags

number of tags for the significant genes if geneNames is not NULL. Default is 20 to obtain the tags of the 20 first significant genes.

logTransformPVal

If TRUE, the p-values will have a negative logarithm transformation (base 10). Default is TRUE.

Value

a ggplot2 object

Examples

genes <- paste0("G", 1:500)
pval <- runif(500, max = 0.5)
log2FC <- runif(500, min = -4, max = 4)

data <- cbind.data.frame(genes, pval, log2FC)

rm(genes, pval, log2FC)
volcanoPlot(log2FC, pval, data, geneNames = genes)

sistm/sistmr documentation built on March 8, 2024, 3:05 a.m.