volcanoPlot: Volcano plot

Description Usage Arguments Value Examples

View source: R/plot.R

Description

Volcano plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
volcanoPlot(
  data,
  log2FoldChange = "log2FoldChange",
  padj = "padj",
  colour = "red",
  saveplot = NULL,
  size = 1,
  padjLimit = 10,
  width = 13.5,
  height = 15,
  ...
)

Arguments

data

A dataframe.

log2FoldChange

Specify the columns containing log2 fold change. Default "log2FoldChange" (suitable for DESeq2 result)

padj

Specify the columns containing adjusted p-value. Default "padj" (suitable for DESeq2 result)

colour

Specify colour variable. Normally the columns containing labels to indicate if the genes are up-regulated or down-regulated or no significant difference.

saveplot

Save plot to given file "a.pdf", "b.png".

size

A number of one column name to specify point size.

padjLimit

Max allowed negative log10 transformed padj. Default 10.

width

Picture width in "cm".

height

Picture height in "cm".

...

Additional parameters given to ggsave.

Value

A ggplot2 object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
### Generate test data
res_output <- data.frame(log2FoldChange=rnorm(3000), row.names=paste0("YSX",1:3000))
res_output$padj <- 20 ^ (-1*(res_output$log2FoldChange^2))
padj = 0.05
log2FC = 1
res_output$level <- ifelse(res_output$padj<=padj,
                           ifelse(res_output$log2FoldChange>=log2FC,
                                  paste("groupA","UP"),
                                  ifelse(res_output$log2FoldChange<=(-1)*(log2FC),
                                         paste("groupB","UP"), "NoDiff")) , "NoDiff")
head(res_output)

volcanoPlot(res_output, colour="level")

Tong-Chen/YSX documentation built on Jan. 25, 2021, 2:49 a.m.