binnedCoverage: binnedCoverage

Description Usage Arguments Value Examples

View source: R/peakCallFunctions.R

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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"))

DEScan2 documentation built on Nov. 8, 2020, 5:01 p.m.