filterCpGs: Filter BSseq Objects by Coverage

filterCpGsR Documentation

Filter BSseq Objects by Coverage

Description

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 with cov reads 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.

Details

filterCpGs() is designed to be used after cov and perSample arguments have been optimized by getCpGtotals() and plotCpGtotals().

Value

A BSseq object.

See Also

  • getCpGs() to generate the BSseq object from individual Bismark CpG reports.

  • getCpGtotals() and plotCpGtotals() for help with deciding coverage cutoffs.

  • getRegions() to generate a set of regions based on the CpGs.

Examples

## Not run: 

# 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")

## End(Not run)


cemordaunt/comethyl documentation built on Oct. 20, 2023, 5:47 p.m.