Reduce ranges retaining mcols
reduceMC(x, ignore.strand = FALSE, simplify = TRUE, ...)
A GenomicRanges object
If set to TRUE, then the strand of x and y is set to "*" prior to any computation.
logical(1). Attempt to simplify returned columns where possible
Passed to reduce
A GRanges object
This function extends reduce so that all mcols
are returned in the output.
Where the reduced ranges map to multiple ranges in the original range,
mcols
will be returned as CompressedList
columns.
If simplify = TRUE
columns will be returned as vectors where possible.
x <- GRanges(c("chr1:1-10:+", "chr1:6-12:-"))
x$id <- c("range1", "range2")
reduceMC(x)
#> GRanges object with 2 ranges and 1 metadata column:
#> seqnames ranges strand | id
#> <Rle> <IRanges> <Rle> | <character>
#> [1] chr1 1-10 + | range1
#> [2] chr1 6-12 - | range2
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
reduceMC(x, ignore.strand = TRUE)
#> GRanges object with 1 range and 1 metadata column:
#> seqnames ranges strand | id
#> <Rle> <IRanges> <Rle> | <CharacterList>
#> [1] chr1 1-12 * | range1,range2
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths