getSigRegion {MethCP} | R Documentation

## Obtain the significant DMRs.

### Description

`getSigRegion` returns the significant DMRs giving the segmented `MethCP` object.

### Usage

    getSigRegion(
        object, sig.level = 0.01, mean.coverage = 1,
        mean.diff = 0.1, nC.valid = 10)

### Arguments

`object` | a `MethCP` object that is segmented using function `segmentMethCP`.
`sig.level` | significance level to call a region DMR.
`mean.coverage` | The minimum average coverage required for the reported DMRs.
`mean.diff` | The minimum differences between groups required for the reported DMRs.
`nC.valid` | number of valid cytosines required for the reported DMRs.

### Value

a `data.frame` containing the DMRs.

### Examples

    library(bsseq)
    # Simulate a small dataset with 2000 cyotsine and 6 samples,
    # 3 in the treatment group and 3 in the control group. The
    # methylation ratio are generated using Binomial distribution
    # with probability 0.3.
    nC <- 2000
    sim_cov <- rnbinom(6*nC, 5, 0.5) + 5
    sim_M <- vapply(
        sim_cov, function(x) rbinom(1, x, 0.3), FUN.VALUE = numeric(1))
    sim_cov <- matrix(sim_cov, ncol = 6)
    sim_M <- matrix(sim_M, ncol = 6)
    # methylation ratios in the DMRs in the treatment group are
    # generated using Binomial(0.7)
    DMRs <- c(600:622, 1089:1103, 1698:1750)
    sim_M[DMRs, 1:3] <- vapply(
        sim_cov[DMRs, 1:3], function(x) rbinom(1, x, 0.7),
        FUN.VALUE = numeric(1))
    # sample names
    sample_names <- c(paste0("treatment", 1:3), paste0("control", 1:3))
    colnames(sim_cov) <- sample_names
    colnames(sim_M) <- sample_names

    # create a bs.object
    bs_object <- BSseq(gr = GRanges(
        seqnames = "Chr01",
        IRanges(start = (1:nC)*10, width = 1)),
        Cov = sim_cov, M = sim_M, sampleNames = sample_names)
    DMRs_pos <- DMRs*10
    methcp_obj1 <- calcLociStat(
        bs_object,
        group1 = paste0("treatment", 1:3),
        group2 = paste0("control", 1:3),
        test = "methylKit")
    methcp_obj1 <- segmentMethCP(
        methcp_obj1, bs_object,
        region.test = "fisher")
    methcp_res1 <- getSigRegion(methcp_obj1)

[Package MethCP version 1.4.0 Index]