distinctMC: Keep distinct ranges and mcols

View source: R/distinctMC.R

distinctMCR Documentation

Keep distinct ranges and mcols

Description

Keep distinct ranges by including mcols

Usage

distinctMC(x, ..., .keep_all = FALSE)

Arguments

x

A GenomicRanges object

...

⁠<data-masking>⁠ Passed to distinct

.keep_all

If TRUE, keep all columns in x

Details

Wrapper to distinct for GRanges objects. Finds unique ranges and mcols in combination and retains only the distinct combinations, in keeping with the dplyr function.

Will default to unique(granges(x)) if no columns are provided

Value

A GRanges object

Examples

gr <- GRanges(rep(c("chr1:1-10"), 2))
gr$id <- paste0("range", seq_along(gr))
gr$gene <- "gene1"
gr
distinctMC(gr)
distinctMC(gr, gene)
distinctMC(gr, gene, .keep_all = TRUE)


steveped/chipExtra documentation built on Aug. 1, 2024, 12:33 a.m.