I would like to perform smoothing on my RRBS methylation data using a sliding window approach. Moreover, I would like also to compute the median beta for a series of fixed regions.
I can easily create a bed file for both the regions I am interested in, and for the position of each CpG covered, as my data are in the form of a matrix with CpG coordinates in rows and samples in columns.
I suspect this can be achieved with two different
GRanges objects (one for sites and one for regions) and then the
findOverlaps() funtion, but I feel like there should be a more elegant solution, maybe using specific packages or a tool that I currently don't know.
Thank you for your help,