Dear all,
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,
Gian
What's your ultimate goal and which packages have you looked at already?
My ultimate goal is to evaluate the median Beta inside specific regions and more generally perform smoothing on methylation data (in the form of a Beta table). To this moment, I managed to obtain a solution using GRanges package, which made sense but was actually a bit intricate!
Would you mind posting the solution as an answer (and then accepting your own answer)? May help others.