Generate a set of non-overlapping peaks from a set of intervals
Source:R/peak_calling.R
canonize_peaks.Rd
Given a set of intervals, usually generated from a threshold on the marginal ATAC signal, the function generates a set of non-overlapping peaks of a given size. The function can also take a marginal track and use it to generate peaks with the highest marginal signal.
The function is iterative, where in each step the intervals are centered on the highest marginal signal, expanded to the desired size, and then merged to remove overlaps. The process is repeated until no more overlaps are present.
Usage
canonize_peaks(
intervals,
size,
marginal_track = NULL,
iterator = NULL,
keep_marginal = TRUE
)
Arguments
- intervals
A data frame with columns
chrom
,start
, andend
.- size
The desired size of the peaks.
- marginal_track
A marginal track to use for generating peaks (or any other misha track expression).
- iterator
An iterator to use for extracting the marginal track.
- keep_marginal
Whether to keep the marginal track in the output. If TRUE, a column named
marginal
will be added to the output.
Examples
if (FALSE) {
intervals <- gscreen("atac_marginal >= 300")
peaks <- canonize_peaks(intervals, 300, marginal_track = "atac_marginal")
head(peaks)
}