reducePeaks {chromswitch} | R Documentation

## reducePeaks

### Description

Given a LocalPeaks object, merge peaks which are in the same sample and are separated by no more than `gap` base pairs. When two non-overlapping peaks are merged, a new peak is created which starts at the starting position of the first peak and ends at the ending position of the second peak, spanning the range of both peaks and the gap between them.

### Usage

    reducePeaks(localpeaks, gap)

### Arguments

`localpeaks` | LocalPeaks object
`gap` | Numeric value, specifying the threshold distance for merging. Peaks in the same sample which are within this many bp of each other will be merged.

### Value

The LocalPeaks object that was provided as input, with nearby peaks merged

### Examples

    samples <- c("E068", "E071", "E074", "E101", "E102", "E110")
    bedfiles <- system.file("extdata", paste0(samples, ".H3K4me3.bed"),
    package = "chromswitch")

    metadata <- data.frame(Sample = samples,
        H3K4me3 = bedfiles,
        stringsAsFactors = FALSE)

    lpk <- retrievePeaks(H3K4me3,
        metadata = metadata,
        region = GRanges(seqnames = "chr19",
        ranges = IRanges(start = 54924104, end = 54929104)))

    reducePeaks(lpk, gap = 300)

[Package chromswitch version 1.2.1 Index]