Skip to contents

Removes seeds inside dense runs where neighboring seeds are closer than a minimum distance on the same chromosome.

Usage

sparsifySeeds(seeds, min_distance)

Arguments

seeds

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

min_distance

Non-negative numeric scalar. Seeds with a distance below this value to both neighboring seeds on the same chromosome are removed.

Value

A subset of seeds with original columns and row names preserved.

Details

Seeds are compared per chromosome after sorting by start. A seed is removed only when both the previous and next seed on that chromosome are closer than min_distance. Endpoints of close runs are retained. Seeds at exactly min_distance are retained.

Examples

seeds <- data.frame(
    chr = c("chr1", "chr1", "chr1"),
    start = c(100, 105, 120)
)
sparsifySeeds(seeds, min_distance = 10)