Assign each methylation site to the GC bin of the genomic window it falls in, and compute the average methylation per GC bin.
Arguments
- msites
A
GRangesobject with one range per CpG (width 1) and the metadata columnsscore(numeric methylation fraction between 0 and 1) andcoverage(read count). Usually produced byreadMethylome.- gcdist
A
GRangesobject of 30-bp genomic windows with an integer metadata columnGC_bin(1 to 5). Get it withgetGenomeGC()from the annotation package.- ignoreStrand
Logical. If
TRUE(default), strand is ignored when overlapping methylation sites with annotations.
Value
A matrix with one row per GC bin and the columns
gcbin and avg_mscore. Pass it as binMsites to
computeDeviation.
Details
The result describes how methylation depends on local GC
content in this sample. computeDeviation combines it with
the per-motif GC profile in gcfreqs to obtain the methylation
expected at the binding sites from sequence composition alone.
Examples
load(system.file("extdata", "gcdist_subset.rda", package = "methylTFR"))
load(system.file("extdata", "example_data.rda", package = "methylTFR"))
bin_meth <- addGCBinToMethylome(msites, gcdist)
#> Loading required namespace: GenomeInfoDb
bin_meth
#> gcbin avg_mscore
#> [1,] 1 0.5562500
#> [2,] 2 0.7409375
#> [3,] 3 0.8235556
#> [4,] 4 0.7962617
#> [5,] 5 0.7528302
