volcano_plot: Volcano Plot

Description Usage Arguments Value Examples

View source: R/volcano_plot.R

Description

A convenience function for creating volcano plot.

Usage

1
2
3
4
5
6
7
8
9
volcano_plot(
  logFC,
  significance,
  feature_names = NULL,
  threshold = NULL,
  top_n_names = 5,
  scale_xy = 1,
  ...
)

Arguments

logFC

a numeric vector of log2 of fold change for each feature

significance

a numeric vector of significance values (p-value, q-value or adjusted p-value)

feature_names

a character vector with the names of the features to diplay or NULL (default)

threshold

a numeric value where to draw a significance threshold or NULL (default)

top_n_names

number of top significant features to show the names (default 5)

scale_xy

numeric controls the spread on x vs y axis. Default 1.

...

additional arguments passed to FFieldPtRep

Value

plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library("vp.misc")
data("cptac_oca")
library("limma")
ee <- oca.set
ee <- ee[rowSums(!is.na(exprs(ee))) >= 30,]
model.string <- "~ PLATINUM.STATUS + AGE" # model with covariates
coef.string <- "PLATINUM.STATUS" # note, only two levels allowed here

res <- limma_a_b(oca.set, 
                 model.str = "~ PLATINUM.STATUS + AGE", 
                 coef.str = "PLATINUM.STATUS")
head(res)

#library(qvalue)
library(ggplot2)
# res <- subset(res, !is.na(res$P.Value))
#res$q.value <- qvalue(res$P.Value)$qvalue
volcano_plot(res$logFC, 
             res$P.Value, 
             feature_names = rownames(res), 
             threshold = 0.05, 
             top_n_names = sum(res$P.Value < 0.001, na.rm=TRUE), 
             rep.fact=10000, adj.lmt=1000, adj.max=1000) + 
   theme(text=element_text(size = 20)) +
   ylab("p-value") +
   xlab("log2 fold change")

vladpetyuk/vp.misc documentation built on June 25, 2021, 6:35 a.m.