filterCpGs() subsets a BSseq object to include
only those CpGs meeting cov and perSample cutoffs and then saves
it as a .rds file.
Usage
filterCpGs(
bs,
cov = 2,
perSample = 0.75,
save = TRUE,
file = "Filtered_BSseq.rds",
verbose = TRUE
)Arguments
- bs
A BSseq object.
- cov
A
numeric(1)specifying the minimum number of reads overlapping a CpG for it to be included in the total.- perSample
A
numeric(1)specifying the minimum percent of samples withcovreads at a CpG for it to be included in the total.- save
A
logical(1)indicating whether to save the BSseq object.- file
A
character(1)giving the file name (.rds) for the saved BSseq object.- verbose
A
logical(1)indicating whether messages should be printed.
Value
A BSseq object.
Details
filterCpGs() is designed to be used after cov and
perSample arguments have been optimized by getCpGtotals() and
plotCpGtotals().
See also
getCpGs()to generate the BSseq object from individual Bismark CpG reports.getCpGtotals()andplotCpGtotals()for help with deciding coverage cutoffs.getRegions()to generate a set of regions based on the CpGs.
Examples
if (FALSE) {
# Read Bismark CpG Reports
colData <- read.xlsx("sample_info.xlsx", rowNames = TRUE)
bs <- getCpGs(colData, file = "Unfiltered_BSseq.rds")
# Examine CpG Totals at Different Cutoffs
CpGtotals <- getCpGtotals(bs, file = "CpG_Totals.txt")
plotCpGtotals(CpGtotals, file = "CpG_Totals.pdf")
# Filter BSseq Object
bs <- filterCpGs(bs, cov = 2, perSample = 0.75, file = "Filtered_BSseq.rds")
}