Skip to contents

getCpGs() reads individual sample Bismark CpG reports into a single BSseq object and then saves it as a .rds file.

Usage

getCpGs(
  colData,
  path = getwd(),
  pattern = "*CpG_report.txt.gz",
  sameLoci = TRUE,
  chroms = c(paste("chr", 1:22, sep = ""), "chrX", "chrY", "chrM"),
  BPPARAM = BiocParallel::MulticoreParam(10),
  save = TRUE,
  file = "Unfiltered_BSseq.rds",
  verbose = TRUE
)

Arguments

colData

A data.frame whose row names specify CpG reports to load into the BSseq object and whose columns are sample traits with numeric values.

path

A character giving the path(s) to the CpG reports.

pattern

A regular expression used to filter for CpG reports.

sameLoci

A logical(1) indicating whether CpG reports contain the same set of methylation loci. This is the case if the files are genome wide cytosine reports aligned to the same reference genome. The default sameLoci = TRUE speeds up getCpGs() by only having to parse each CpG report once.

chroms

A character giving the chromosomes to include in the BSseq object.

BPPARAM

A BiocParallel::BiocParallelParam instance providing the parallel back-end to use during evaluation.

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

This BSseq object still needs to be filtered for coverage at individual CpGs. More information on these arguments is given in the documentation for bsseq::read.bismark().

See also

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