Methylation variance as a function of sequencing depth
Source:R/coverage_analysis.R
varianceByDepth.RdFor each coverage level (or coverage bin), computes the variance of methylation beta values across sites at that depth. This is useful for diagnosing whether low-coverage sites have inflated methylation variance and for setting appropriate coverage thresholds.
Arguments
- object
A
commaDataobject.- coverage_bins
Integer vector specifying the coverage levels to include. If
NULL(default), all unique coverage levels observed across all samples are used. Useful to pass5:30to focus on a specific depth range.- mod_type
Character string or
NULL. If provided, only sites of the specified modification type are included. Default:NULL(all types).
Value
A data.frame with one row per (coverage level, sample),
containing:
coverageSequencing depth (integer).
sample_nameSample identifier.
varianceVariance of beta values at sites with exactly this coverage level.
NAif fewer than 2 sites are at this level.n_sitesNumber of sites at this coverage level.