
Reduce BSseq object around seed locations
Source:R/reduce_bsseq_around_seeds.R
reduceBSseqAroundSeeds.RdThis function reduces a BSseq object to only include methylation data around specified seed locations. It expands the seed locations by a given window size and merges overlapping windows to create a reduced BSseq object.
Details
The reduction is performed by expanding the seed locations by the specified window size to both sides, after division by 2, and merging overlapping windows.The resulting BSseq object contains only the methylation data within these merged windows.
Examples
library(bsseq)
# Example BSseq object
bsseq_obj <- BSseq(
chr = c("chr1", "chr1", "chr2"),
pos = c(100, 200, 300),
M = matrix(c(10, 20, 30), ncol = 1),
Cov = matrix(c(100, 200, 300), ncol = 1)
)
# Example seeds data frame
seeds <- data.frame(chr = c("chr1", "chr2"), start = c(80, 250))
reduced_bsseq_obj <- reduceBSseqAroundSeeds(bsseq_obj, seeds, expansion_window = 50)