getMeth | R Documentation |
Obtain methylation estimates for BSseq objects, both smoothed and raw.
getMeth(BSseq, regions = NULL, type = c("smooth", "raw"),
what = c("perBase", "perRegion"), confint = FALSE, alpha = 0.95,
withDimnames = TRUE)
BSseq |
An object of class |
regions |
An optional |
type |
This returns either smoothed or raw estimates of the methylation level. |
what |
The type of return object, see details. |
confint |
Should a confidence interval be return for the
methylation estimates (see below). This is only supported if
|
alpha |
alpha value for the confidence interval. |
withDimnames |
A |
NOTE: The return type of getMeth
varies depending on its
arguments.
If region = NULL
the what
argument is ignored. This is
also the only situation in which confint = TRUE
is supported.
The return value is either a DelayedMatrix
(confint = FALSE
or a list with three DelayedMatrix
components confint = TRUE
(meth
, upper
and
lower
), giving the methylation estimates and (optionally) confidence
intervals.
Confidence intervals for type = "smooth"
is based on standard
errors from the smoothing algorithm (if present). Otherwise it is
based on pointwise confidence intervals for binomial distributions
described in Agresti (see below), specifically the score confidence
interval.
If regions
are specified, what = "perBase"
will make the
function return a list, each element of the list being a
DelayedMatrix corresponding to a genomic region (and each row
of the DelayedMatrix being a loci inside the region). If
what = "perRegion"
the function returns a DelayedMatrix,
with each row corresponding to a region and containing the average
methylation level in that region.
A BSseq
object needs to be smoothed by the function
BSmooth
in order to support type = "smooth"
.
Kasper Daniel Hansen khansen@jhsph.edu.
A Agresti and B Coull. Approximate Is Better than "Exact" for Interval Estimation of Binomial Proportions. The American Statistician (1998) 52:119-126.
BSseq
for the BSseq
class and
BSmooth
for smoothing such an object.
data(BS.chr22)
head(getMeth(BS.chr22, type = "raw"))
reg <- GRanges(seqnames = c("chr22", "chr22"),
ranges = IRanges(start = c(1, 2*10^7), end = c(2*10^7 +1, 4*10^7)))
head(getMeth(BS.chr22, regions = reg, type = "raw", what = "perBase"))
#-------------------------------------------------------------------------------
# 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(getMeth(hdf5_BS.chr22, type = "raw"))
head(getMeth(hdf5_BS.chr22, regions = reg, type = "raw", what = "perBase"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.