plot.varTestBioCond: Plot a 'varTestBioCond' Object

View source: R/diffTest.R

plot.varTestBioCondR Documentation

Plot a varTestBioCond Object

Description

Given a varTestBioCond object, which records the results of calling hypervariable and invariant genomic intervals across ChIP-seq samples of a bioCond object, this method creates a scatter plot of observed (mean, log10(variance)) pairs from all genomic intervals, marking specifically the ones that have a significantly large or small variance. Besides, the mean-variance curve associated with the bioCond is also added to the plot, serving as a baseline to which each observed variance could be compared.

Usage

## S3 method for class 'varTestBioCond'
plot(
  x,
  padj = NULL,
  pval = NULL,
  col = alpha(c("black", "red"), 0.04),
  pch = 20,
  xlab = "Mean",
  ylab = "log10(Var)",
  args.legend = list(x = "bottomleft"),
  args.lines = list(col = "green3", lwd = 2),
  ...
)

Arguments

x

An object of class "varTestBioCond", typically a returned value from varTestBioCond.

padj, pval

Cutoff of adjusted/raw p-value for selecting significant intervals. Only one of the two arguments is effectively used; pval is ignored if padj is specified. The default is equivalent to setting padj to 0.1.

col, pch

Optional length-2 vectors specifying the colors and point characters of non-significant and significant intervals, respectively. Elements are recycled if necessary.

xlab, ylab

Labels for the X and Y axes.

args.legend

Further arguments to be passed to legend.

args.lines

Further arguments to be passed to lines.

...

Further arguments to be passed to plot.

Details

Those genomic intervals considered to be significant are actually the ones that significantly deviate from the mean-variance curve in the plot. See varTestBioCond for technical details of the associated hypothesis testing.

Value

The function returns NULL.

See Also

bioCond for creating a bioCond object from a set of ChIP-seq samples; fitMeanVarCurve for fitting a mean-variance curve; varTestBioCond for calling hypervariable and invariant intervals across ChIP-seq samples contained in a bioCond object.

Examples

data(H3K27Ac, package = "MAnorm2")
attr(H3K27Ac, "metaInfo")

## Call hypervariable and invariant genomic intervals across biological
## replicates of the GM12891 cell line.

# Perform MA normalization and construct a bioCond to represent GM12891.
norm <- normalize(H3K27Ac, 5:6, 10:11)
GM12891 <- bioCond(norm[5:6], norm[10:11], name = "GM12891")

# Fit a mean-variance curve for GM12891 using the parametric method.
GM12891 <- fitMeanVarCurve(list(GM12891), method = "parametric",
                           occupy.only = TRUE)[[1]]
summary(GM12891)
plotMeanVarCurve(list(GM12891), subset = "occupied")

# Assess the observed variances of ChIP-seq signal intensities in GM12891.
res <- varTestBioCond(GM12891)
head(res)

# Inspect only the test results of occupied genomic intervals.
res <- res[GM12891$occupancy, ]
res$padj <- p.adjust(res$pval, method = "BH")
plot(res, col = scales::alpha(c("black", "red"), c(0.04, 0.5)))


MAnorm2 documentation built on Oct. 29, 2022, 1:12 a.m.