bsseq (version 1.8.2)

getCoverage: Obtain coverage for BSseq objects.

Description

Obtain coverage for BSseq objects.

Usage

getCoverage(BSseq, regions = NULL, type = c("Cov", "M"), what = c("perBase", "perRegionAverage", "perRegionTotal"))

Arguments

BSseq
An object of class BSseq.
regions
An optional data.frame or GenomicRanges object specifying a number of genomic regions.
type
This returns either coverage or the total evidence for methylation at the loci.
what
The type of return object, see details.

Value

If regions are not specified (regions = NULL) a matrix (what = "perBase") or a vector (otherwise) is returned. This will either contain the per-base coverage or the genome total or average coverage.If what = "perBase" and regions are specified, a list is returned. Each element of the list is a matrix corresponding to the genomic loci inside the region. It is conceptually the same as splitting the coverage by region.If what = "perRegionAverage" or what = "perRegionTotal" and regions are specified the return value is a matrix. Each row of the matrix corresponds to a region and contains either the total coverage of the average coverage in the region.

See Also

BSseq for the BSseq class.

Examples

Run this code
data(BS.chr22)
head(getCoverage(BS.chr22, type = "M"))
reg <- GRanges(seqnames = c("chr22", "chr22"),
  ranges = IRanges(start = c(1, 2*10^7), end = c(2*10^7 +1, 4*10^7)))
getCoverage(BS.chr22, regions = reg, what = "perRegionAverage")
  cList <- getCoverage(BS.chr22, regions = reg)
length(cList)
head(cList[[1]])

Run the code above in your browser using DataLab