Skip to contents

This 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.

Usage

reduceBSseqAroundSeeds(bsseq_obj, seeds, expansion_window)

Arguments

bsseq_obj

BSseq object containing the methylation data

seeds

Data frame with genomic locations containing 'chr' and 'start' columns.

expansion_window

Integer. DMR maximum stage 2 bi-directional size expansion window (default: 10000).

Value

BSseq object containing the reduced methylation data

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)