getRegionMeth()
extracts methylation values at specified regions for
all samples and then saves it as a .rds file.
Usage
getRegionMeth(
regions,
bs,
type = c("raw", "smooth"),
save = TRUE,
file = "Region_Methylation.rds",
verbose = TRUE
)
Arguments
- regions
A
data.frame
of regions, typically after filtering withfilterRegions()
. Must have the columnschr
,start
, andend
.- bs
A BSseq object, typically after filtering with
filterCpGs()
.- type
A
character(1)
specifying the type of methylation values to extract. Accepted values areraw
andsmooth
- save
A
logical(1)
indicating whether to save thematrix
.- file
A
character(1)
giving the file name (.rds) for the savedmatrix
.- verbose
A
logical(1)
indicating whether messages should be printed.
Details
Methylation is summarized at the region level, and is estimated as the methylated reads divided by the total reads. Methylation values are obtained from a BSseq object and can be either raw or smoothed methylation.
See also
getPCs()
andadjustRegionMeth()
to adjust methylation for the top principal components.getDendro()
andplotDendro()
to generate and visualize dendrograms.
Examples
if (FALSE) {
# Get Methylation Data
meth <- getRegionMeth(regions, bs = bs, file = "Region_Methylation.rds")
# Adjust Methylation Data for Top PCs
mod <- model.matrix(~1, data = pData(bs))
PCs <- getPCs(meth, mod = mod, file = "Top_Principal_Components.rds")
methAdj <- adjustRegionMeth(meth, PCs = PCs,
file = "Adjusted_Region_Methylation.rds")
# Assess Sample Similarity
getDendro(methAdj, distance = "euclidean") %>%
plotDendro(file = "Sample_Dendrogram.pdf", expandY = c(0.25,0.08))
}