plotMVC: Plot a Mean-Variance Curve on a Single 'bioCond' Object

View source: R/show.R

plotMVCR Documentation

Plot a Mean-Variance Curve on a Single bioCond Object

Description

Given an individual bioCond object associated with a mean-variance curve, plotMVC draws a scatter plot of observed (mean, log10(variance)) pairs from the genomic intervals contained in the bioCond. It also adds the mean-variance curve to the plot. Notably, unlike plotMeanVarCurve, here the observed variances used for plotting are not adjusted but the mean-variance curve is scaled based on the associated variance ratio factor (see fitMeanVarCurve and estimatePriorDf for a description of variance ratio factor).

Usage

plotMVC(
  cond,
  subset = c("all", "occupied", "non-occupied"),
  col = alpha("blue", 0.02),
  pch = 20,
  add = FALSE,
  xlab = "Mean",
  ylab = "log10(Var)",
  args.lines = list(col = "red", lwd = 2),
  only.add.line = FALSE,
  ...
)

Arguments

cond

An individual bioCond object with which a mean-variance curve has been associated.

subset

A character string indicating the subset of genomic intervals used for the scatter plot. Must be one of "all" (default), "occupied", or "non-occupied". Can be abbreviated.

col, pch

Optional vectors specifying the colors and point characters of the genomic intervals in cond, respectively. Elements are recycled to match the total number of intervals and are then subject to the subsetting operation specified by subset.

add

Whether to add points to existing graphics (by calling points) or to create new graphics (by calling plot)?

xlab, ylab

Labels for the X and Y axes.

args.lines

Further arguments to be passed to lines.

only.add.line

A logical value. If set to TRUE, only the mean-variance curve is added to existing graphics.

...

Further arguments to be passed to plot or points, depending on the setting of add.

Value

The function returns NULL.

References

Tu, S., et al., MAnorm2 for quantitatively comparing groups of ChIP-seq samples. Genome Res, 2021. 31(1): p. 131-145.

See Also

bioCond for creating a bioCond object; fitMeanVarCurve for fitting a mean-variance curve on a list of bioCond objects; varRatio for a formal description of variance ratio factor; plotMeanVarCurve for plotting a mean-variance curve on a list of bioCond objects; alpha for adjusting color transparency.

Examples

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

## Fit and plot a mean-variance curve for the GM12892 cell line (i.e.,
## individual).

# Perform the MA normalization and construct a bioCond to represent GM12892.
norm <- normalize(H3K27Ac, 7:8, 12:13)
GM12892 <- bioCond(norm[7:8], norm[12:13], name = "GM12892")

# Fit a mean-variance curve by using the parametric method.
GM12892 <- fitMeanVarCurve(list(GM12892), method = "parametric",
                           occupy.only = TRUE, init.coef = c(0.1, 10))[[1]]

# Draw a mean-variance scatter plot with adjusting observed variances.
plotMeanVarCurve(list(GM12892), subset = "occupied")

# Draw a mean-variance scatter plot with scaling the mean-variance curve.
plotMVC(GM12892, subset = "occupied")


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