plotEmpiricalDistribution {dmrseq} | R Documentation

## Plot the empirical distribution of the methylation beta vals or coverage

### Description

Uses ggplot2 to plot smoothed density histograms of methylation proportions (beta values), or coverage. The number of curves plotted will be equal to the number of different values of `testCovariate`, unless `bySample` is TRUE. This can take quite some time to execute for a large object, so it is recommended to first take a random sample of loci (say one million) before plotting.

### Usage

    plotEmpiricalDistribution(bs, testCovariate = NULL, bySample = FALSE,
      type = "M", adj = 2.5)

### Arguments

`bs` | a BSseq object
`testCovariate` | character specifying the column name of the `pData` slot of the BSseq object to include in the plot legend.
`bySample` | logical whether to plot a separate line for each sample. Default value is FALSE (so samples with the same value of `testCovariate` will be collapsed into the same line).
`type` | a character indicating which type of density to plot - the methylation (beta) values ("M") or the coverage ("Cov"). Default is "M".
`adj` | a numeric value for the `adjust` parameter to pass to the `geom_line` function. Specifies how smooth the make the function.

### Value

a ggplot object

### Examples

    data(BS.chr21)

    # plot beta values by sample group
    plotEmpiricalDistribution(BS.chr21, testCovariate="CellType")

[Package dmrseq version 1.0.14 Index]