Compute genome-wide CpG metrics for a given BSgenome:

  • relH: relative CpG frequency (% of dinucleotides that are "CG").

  • GoGe: enrichment statistic \((nCG * genome_length) / (nC * nG)\).

calculateGenomicCGDistribution(BSgenome)

Arguments

BSgenome

character(1) The name of a BSgenome package, e.g. "BSgenome.Hsapiens.NCBI.GRCh38". The package must be installed and loadable in the current session.

Value

A data.frame with two numeric columns:

  • genome.relH — percent of "CG" dinucleotides genome-wide.

  • genome.GoGe — GoGe enrichment statistic.

Details

These values are used as denominators to normalise sample-level CpG enrichment.

  • Chromosomes with names containing "rand" or "chrUn" are excluded.

  • The BSgenome indicated by BSgenome is loaded dynamically.

  • Uses Biostrings and BSgenome utilities to count CpG, C, and G occurrences across the genome.

Examples

# Example: compute genome-wide CpG metrics for a S. cerevisae genome.
# It could be done for GRCh38 genome instead, but it will take more time to
# run (package must be installed)
if (requireNamespace("BSgenome.Scerevisiae.UCSC.sacCer3", quietly = TRUE)) {
    calculateGenomicCGDistribution("BSgenome.Scerevisiae.UCSC.sacCer3")
}
#>   genome.relH genome.GoGe
#> 1    2.922563   0.8033108