estimateErrorRate: Estimate CpG-specific error rate from BSseq object.

View source: R/Likelihood_functions.R

estimateErrorRateR Documentation

Estimate CpG-specific error rate from BSseq object.

Description

This function estimates the CpG-specific error rate from a single sample BSseq object generated using read.bedMethyl.

Usage

estimateErrorRate(BSseq, minCov = 10, maxCov = 100, minRatio = 0.8, plotErrorProfile = FALSE)

Arguments

BSseq

A single sample object of class BSseq.

minCov

A non-negative integer specifying the minimum coverage required for CpG loci to be considered.

maxCov

A non-negative integer specifying the maximum coverage allowed for CpG loci to be considered.

minRatio

A numeric value between 0 and 1 specifying the minimum ratio of CpG sites to non-CpG sites for a loci to be considered.

plotErrorProfile

A logical value indicating whether to plot the CpG to non-CpG ratio distribution for the filtered sites.

Value

A numeric value representing the estimated CpG-specific error rate the BSseq object.

Author(s)

Søren Blikdal Hansen (soren.blikdal.hansen@sund.ku.dk)

See Also

BSseq for the BSseq class, read.bedMethyl for details on reading data into a BSseq object.

Examples

# Example input files
infiles <- c(system.file("extdata/HG002_nanopore_test.bedMethyl.gz",
                         package = "bsseq"),
             system.file("extdata/HG002_pacbio_test.bedMethyl.gz",
                         package = "bsseq"))

# Run the function to import data
bsseq <- read.bedMethyl(files = infiles,
                        colData = DataFrame(row.names = c("test_nanopore", 
                                                          "test_pacbio")),
                        strandCollapse = TRUE,
                        verbose = TRUE)

# Estimate error rate
estimateErrorRate(bsseq[, 1], plotErrorProfile = FALSE)

hansenlab/bsseq documentation built on June 12, 2025, 7:42 p.m.