Apply a set of qsea normalisation steps to a qseaSet, including:

  • setting library factors to 1 (disabling TMM),

  • adding offsets based on an enrichment pattern, and

  • configuring enrichment parameters across a CpG-density window range.

addNormalisation(
  qseaSet,
  enrichmentMethod = "blind1-15",
  maxPatternDensity = 0.05
)

Arguments

qseaSet

qseaSet Input object containing methylation-enriched sequencing data.

enrichmentMethod

character(1) Method used to calculate enrichment. Options are described in Details. Recorded in qseaSet@parameters$enrichmentMethod. Default: "blind1-15".

maxPatternDensity

numeric(1) Maximum pattern density in a window to consider it for the background calculation, passed to qsea::addOffset(). Default: 0.05.

Value

A qseaSet with updates to:

  • Library factors — set to 1 via qsea::addLibraryFactors().

  • Offsets — added via qsea::addOffset() using getPattern() and maxPatternDensity.

  • Enrichment parameters — configured over windows with CpG density in [1, 15] using a linear signal schedule and bins = seq(0.5, 40.5, 0.5).

  • Parameters slot — enrichmentMethod recorded in qseaSet@parameters$enrichmentMethod.

Details

This function encapsulates a recommended default pipeline for qsea normalisation. It ensures consistency across runs and simplifies code by bundling commonly applied steps.

#' Methods available for enrichmentMethod:

  • "blind1-15": the blind calibration method detailed in the qsea paper, fitting a straight line of decreasing expected average methylation levels from ~76% at CpG density = 1 to ~25% at CpG density = 15.

  • "none": no enrichment normalisation is performed.

Examples

# addNormalisation requires windows spanning a range of CpG densities for
# background estimation; the pre-filtered example datasets lack these, so
# a synthetic qseaSet is used here.

# Run normalisation on a toy qseaSet with ~100k reads
qsea::getExampleQseaSet(expSamplingDepth = 100000) %>%
    addNormalisation(maxPatternDensity = 0.5)
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment 
#> and are used for background reads estimation
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment 
#> and are used for background reads estimation
#> qseaSet
#> =======================================
#> 4 Samples: 
#> Sim1T, Sim2T, Sim1N, Sim2N
#> 10000 Regions in 1 chromosomes of example_genome

# Run with no enrichment normalisation
qsea::getExampleQseaSet(expSamplingDepth = 1e5) %>%
    addNormalisation(enrichmentMethod = "none", maxPatternDensity = 0.5)
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment 
#> and are used for background reads estimation
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment 
#> and are used for background reads estimation
#> qseaSet
#> =======================================
#> 4 Samples: 
#> Sim1T, Sim2T, Sim1N, Sim2N
#> 10000 Regions in 1 chromosomes of example_genome

# Access the recorded enrichment method
qsea::getExampleQseaSet(expSamplingDepth = 1e5) %>%
    addNormalisation(maxPatternDensity = 0.5) %>%
    getParameters() %>%
    purrr::pluck("enrichmentMethod")
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment 
#> and are used for background reads estimation
#> selecting windows with low CpG density for background read estimation
#> 1.48% of the windows have enrichment pattern density of at most 0.5 per fragment 
#> and are used for background reads estimation
#> [1] "blind1-15"