volcano_plot: volcano_plot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/volcano_plot.R

Description

This function was written since the volcanoplot is an easy way to globally assess the distribution of the p values relative to the effect sizes. This specific function has been tailored to my need of working with methylation data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
volcano_plot(
  effect_sizes,
  pvals,
  significance,
  identifiers,
  int_effect_threshold = NULL,
  effect_limit = NULL,
  p_limit = NULL,
  top_names = NULL,
  title = NULL,
  x_lab = NULL,
  y_lab = NULL,
  legend = T
)

Arguments

effect_sizes

A numeric vector of effect sizes.

pvals

A numeric vector of p values.

significance

A boolean vector indicating the significant hits (T = significant, F = non-significant).

identifiers

A character vector of identifiers.

int_effect_threshold

A vertical dashed line to indicate results above an effect size. Defaults to NULL.

effect_limit

Upper limit of the effect sizes of the plot. Defaults to finding the limits automatically.

p_limit

Upper limit of the p-values of the plot. Defaults to finding the limits automatically.

top_names

An integer representing the names of the top (based on significance) X hits. Defaults to NULL.

title

Title of the plot.

x_lab

X-axis label.

y_lab

Y-axis label.

Value

A volcano plot with the effect size on the X axis and the -log10 p-value on the Y axis. Adjusted p-values are indicated with a different color.

Author(s)

Andrew Y.F. Li Yim

See Also

minfi

minfiData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#Load data
require(minfiData)
baseDir <- system.file("extdata", package = "minfiData")
targets <- read.metharray.sheet(base = baseDir)
RGset <- read.metharray.exp(targets = targets, recursive = T)
Mset <- preprocessIllumina(rgSet = RGset, bg.correct = T, normalize = "controls", reference = 2)
Rset <- ratioConvert(Mset)
GMset <- mapToGenome(Rset)

Beta <- getBeta(GMset)
design <- model.matrix(~targets$Sample_Group)

#Linear regression
lfit <- lmFit(Beta, design)
lfit <- eBayes(lfit)
top_genes <- toptable(fit = lfit, coef = 2, number = Inf)

#Plot the volcano_plot
volcano_plot(top_genes$logFC, top_genes$pval, top_genes$padj < 0.05)

ND91/ndlib documentation built on Aug. 10, 2020, 11:59 a.m.