findDMRs {BiSeq} | R Documentation

## Aggregates CpG sites to DMRs

### Description

This function aggregates CpG sites to DMRs on the basis of their P values.

### Usage

    findDMRs(test.out, alpha, max.dist, diff.dir)

### Arguments

`test.out` | An object returned by `betaRegression`.
`alpha` | OPTIONAL. A DMR contains CpG sites with P values smaller or equal than `alpha`.
`max.dist` | Numeric. The maximum distance between two P values smaller than `alpha` in a DMR. Should be the same as `grid.dist` in `predictMeth`.
`diff.dir` | Logical. Should DMRs be seperated if the direction of methylation differences changes? If `TRUE` (default), than resulting DMRs will consist of sites which are all hypomethylated, or hypermethylated respectively.

### Value

A `GRanges` object storing the start and end positions of the DMRs with information in metadata columns:

`median.p` | median of P values
`median.meth.group1` | median of modeled methylation level of group1.
`median.meth.group1` | median of modeled methylation level of group2.
`median.meth.diff` | median of difference of modeled methylation levels of group1 and group2.

### Author(s)

Katja Hebestreit

### See Also

`predictMeth`, `betaRegression`

### Examples

    ## Variogram under Null hypothesis (for resampled data):
    data(vario)

    plot(vario$variogram$v)
    vario.sm <- smoothVariogram(vario, sill=0.9)

    # auxiliary object to get the pValsList for the test
    # results of interest:
    data(betaResults)
    vario.aux <- makeVariogram(betaResults, make.variogram=FALSE)

    # Replace the pValsList slot:
    vario.sm$pValsList <- vario.aux$pValsList

    ## vario.sm contains the smoothed variogram under the Null hypothesis as
    ## well as the p Values that the group has an effect on DNA methylation.

    locCor <- estLocCor(vario.sm)

    clusters.rej <- testClusters(locCor, FDR.cluster = 0.1)

    clusters.trimmed <- trimClusters(clusters.rej, FDR.loc = 0.05)

    DMRs <- findDMRs(clusters.trimmed, max.dist=100, diff.dir=TRUE)

[Package BiSeq version 1.22.0 Index]