getCoverage {bsseq} | R Documentation |
Obtain coverage for BSseq objects.
getCoverage(BSseq, regions = NULL, type = c("Cov", "M"), what = c("perBase", "perRegionAverage", "perRegionTotal"), withDimnames = TRUE)
BSseq |
An object of class |
regions |
An optional |
type |
This returns either coverage or the total evidence for methylation at the loci. |
what |
The type of return object, see details. |
withDimnames |
A |
NOTE: The return type of getCoverage
varies depending on its
arguments.
If regions
are not specified (regions = NULL
) a
DelayedMatrix object (what = "perBase"
) is returned.
This will either contain the per-base coverage, the average coverage, or the
genome total coverage (depending on value of what
).
If what = "perBase"
and regions
are specified, a list is
returned. Each element of the list is a DelayedMatrix object
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
DelayedMatrix object. Each row of the
DelayedMatrix corresponds to a region and contains either the
average coverage or the total coverage in the region.
Kasper Daniel Hansen khansen@jhsph.edu.
BSseq
for the BSseq
class.
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]]) #------------------------------------------------------------------------------- # An example using a HDF5Array-backed BSseq object # library(HDF5Array) # See ?SummarizedExperiment::saveHDF5SummarizedExperiment for details hdf5_BS.chr22 <- saveHDF5SummarizedExperiment(x = BS.chr22, dir = tempfile()) head(getCoverage(hdf5_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(hdf5_BS.chr22, regions = reg, what = "perRegionAverage") hdf5_cList <- getCoverage(hdf5_BS.chr22, regions = reg) length(hdf5_cList) head(hdf5_cList[[1]])