binnedCoverage {DEScan2} | R Documentation

## binnedCoverage

### Description

this function computes the coverage over a binned chromosome, starting from a per base computed coverage.

### Usage

    binnedCoverage(bins, numvar, mcolname, covMethod = c("max", "mean", "sum",
      "min"), roundingMethod = c("none", "floor", "ceiling", "round"))

### Arguments

`bins` | a GRanges object representing a chromosome binned.
`numvar` | an RleList representing the per base coverage over the chr.
`mcolname` | the name of column where the sum have to be stored.
`covMethod` | a method to apply for the computing of the coverate it can be one of "max", "mean", "sum", "min". ("max" is default)
`roundingMethod` | a method to apply to round the computations it can be one of "none", "floor", "ceiling", "round". It's useful only when using covMethod="mean". ("none" is default)

### Value

the bins GRanges with the mcolname attached

### Examples

    ## dividing one chromosome in bins of 50 bp each
    seqinfo <- GenomeInfoDb::Seqinfo(genome="mm9")
    bins <- GenomicRanges::tileGenome(
                seqlengths=GenomeInfoDb::seqlengths(seqinfo)[1],
                tilewidth=50,
                cut.last.tile.in.chrom=TRUE)
    gr <- GenomicRanges::GRanges(seqnames = S4Vectors::Rle("chr1", 100),
                ranges=IRanges::IRanges(start = seq(from=10, to=1000, by=10),
                end=seq(from=20, to=1010, by = 10)))
    cov <- GenomicRanges::coverage(x=gr)
    (binnedMaxCovGR <- binnedCoverage(bins, cov, "binned_cov"))
    (binnedMeanCovGR <- binnedCoverage(bins, cov, "binned_cov",
                                    covMethod="mean", roundingMethod="floor"))
    (binnedSumCovGR <- binnedCoverage(bins, cov, "binned_cov", covMethod="sum"))

[Package DEScan2 version 1.2.1 Index]