plotRegion {bsseq} | R Documentation

## Plotting BSmooth methylation estimates

### Description

Functions for plotting BSmooth methylation estimates. Typically used to display differentially methylated regions.

### Usage

    plotRegion(BSseq, region = NULL, extend = 0, main = "",
      addRegions = NULL, annoTrack = NULL, cex.anno = 1,
      geneTrack = NULL, cex.gene = 1.5, col = NULL, lty = NULL,
      lwd = NULL, BSseqStat = NULL, stat = "tstat.corrected",
      stat.col = "black", stat.lwd = 1, stat.lty = 1, stat.ylim = c(-8, 8),
      mainWithWidth = TRUE, regionCol = alpha("red", 0.1), addTicks = TRUE,
      addPoints = FALSE, pointsMinCov = 5, highlightMain = FALSE)

    plotManyRegions(BSseq, regions = NULL, extend = 0, main = "",
      addRegions = NULL, annoTrack = NULL, cex.anno = 1,
      geneTrack = NULL, cex.gene = 1.5, col = NULL, lty = NULL,
      lwd = NULL, BSseqStat = NULL, stat = "tstat.corrected",
      stat.col = "black", stat.lwd = 1, stat.lty = 1, stat.ylim = c(-8, 8),
      mainWithWidth = TRUE, regionCol = alpha("red", 0.1), addTicks = TRUE,
      addPoints = FALSE, pointsMinCov = 5, highlightMain = FALSE,
      verbose = TRUE)

### Arguments

`BSseq` | An object of class `BSseq`.
`region` | A `data.frame` (with start, end and chr columns) with 1 row or `GRanges` of length 1. If `region` is `NULL` the entire `BSseq` argument is plotted.
`regions` | A `data.frame` (with start, end and chr columns) or `GRanges`.
`extend` | Describes how much the plotting region should be extended in either direction. The total width of the plot is equal to the width of the region plus twice `extend`.
`main` | The plot title. The default is to construct a title with information about which genomic region is being plotted.
`addRegions` | A set of additional regions to be highlighted on the plots. As the `regions` argument.
`annoTrack` | A named list of `GRanges` objects. Each component is a track and the names of the list are the track names. Each track will be plotted as solid bars, and we routinely display information such as CpG islands, exons, etc.
`cex.anno` | `cex` argument when plotting `annoTrack`.
`geneTrack` | EXPERIMENTAL: A `data.frame` with columns: `chr`, `start`, `end`, `gene_ID`, `exon_number`, `strand`, `gene_name`, `isoforms`. This interface is under active development and subject to change.
`cex.gene` | `cex` argument when plotting `geneTrack`.
`col` | The color of the methylation estimates, see details.
`lty` | The line type of the methylation estimates, see details.
`lwd` | The line width of the methylation estimates, see details.
`BSseqStat` | An object of class `BSseqStat`. If present, a new panel will be shown with the t-statistics.
`stat` | Which statistics will be plotted (only used is `BSseqStat` is not `NULL`.)
`stat.col` | color for the statistics plot.
`stat.lwd` | line width for the statistics plot.
`stat.lty` | line type for the statistics plot.
`stat.ylim` | y-limits for the statistics plot.
`mainWithWidth` | Should the default title include information about width of the plot region.
`regionCol` | The color used for highlighting the region.
`addTicks` | Should tick marks showing the location of methylation loci, be added?
`addPoints` | Should the individual unsmoothed methylation estimates be plotted. This usually leads to a very confusing plot, but may be useful for diagnostic purposes.
`pointsMinCov` | The minimum coverage a methylation loci need in order for the raw methylation estimates to be plotted. Useful for filtering out low coverage loci. Only used if `addPoints = TRUE`.
`highlightMain` | Should the plot region be highlighted?
`verbose` | Should the function be verbose?

### Details

The correct choice of aspect ratio depends on the width of the plotting region. We tend to use `width = 10, height = 5`.

`plotManyRegions` is used to plot many regions (hundreds or thousands), and is substantially quicker than repeated calls to `plotRegion`.

This function has grown to be rather complicated over time. For custom plotting, it is sometimes useful to use the function definition as a skeleton and directly modify the code.

### Value

This function is invoked for its side effect: producing a plot.

### Author(s)

Kasper Daniel Hansen khansen@jhsph.edu

### See Also

The package vignette has an extended example.

[Package bsseq version 1.26.0 Index]