enrichment_plot: A plot function

Description Usage Arguments Examples

Description

This function generates two plots in one page - 1) a barplot of a series of expected and observed values with a star above significant ones, and 2) a line plot of log2(observed/expected), again with a star above significane ones. Multiple data sets can be plotted as well, optionally with a '+' above significant ones according to the combined p-value.

Usage

1
2
3
4
enrichment_plot(mat.list, exp.col = "exp", obs.col = "obs",
  pval.col = "pval", combined.pval = NULL, pval.thres = 0.05, ylab = "",
  scale.expansion = 1.1, bar.color = c("indianred1", "violetred"),
  ratio.color = c("dodgerblue", "red", "gold", "green3"), class.space = 0.5)

Arguments

mat.list

a list of matrices or data frames. Each matrix/data.frame must contain at three columns, each representing observed value, expected value and p-value. All the matrices/data frames must have the same number of rows.

exp.col

the name or index of the column representing expected value. Defaults to 'exp'.

obs.col

the name or index of the column representing observed value. Defaults to 'obs'.

pval.col

the name or index of the column representing expected value. Defaults to 'pval'.

combined.pval

a vector of p-values. If provided, significant ones will be marked with '+'.

pval.thres

p-value threshold for calling significant. Defaults to 0.05.

ylab

y-axis label. Defaults to ”.

scale.expansion

a graphical parameter that extends y-axis so that '*' and '+' can be displayed. Defaults to 1.1.

bar.color

a vector of two elements, each representing the color of expected and observed. Defaults to c("indianred1","violetred").

ratio.color

a vector of k elements, where k must be at least the length of mat.list (number of groups). Defaults to c("dodgerblue","red","gold","green3")

class.space

spacing between groups for the ratio plot when multiple groups are plotted. Defaults to 0.5.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# example 1 (multiple groups, with combined p-values)
mat1=data.frame(exp=c(2,3,4,1),obs=c(1.9,3,4.1,1.2),pval=c(0.1,0.2,0.02,0.002))
mat2=data.frame(exp=c(2,2.5,5,2.2),obs=c(1.9,2.6,5.2,2),pval=c(0.3,0.1,0.02,0.3))
mat3=data.frame(exp=c(3,2,1.2,2),obs=c(2.8,2,1.3,2),pval=c(0.5,0.2,0.01,0.6))
mat.list=list(early=mat1,mid=mat2,late=mat3)
combined.pval=c(0.2,0.5,0.01,0.6)
enrichment_plot(mat.list, combined.pval=combined.pval, ylab="number of mutations")

# example 2 (one group, without combined p-values)
mat1=data.frame(exp=c(2,3,4,1),obs=c(1.9,3,4.1,1.2),pval=c(0.1,0.2,0.02,0.002))
mat.list0= list(early=mat1)
enrichment_plot(mat.list0)

SooLee/plotosaurus documentation built on May 9, 2019, 1:52 p.m.