findOverlaps-methods {SummarizedExperiment} | R Documentation

## Finding overlapping ranges in RangedSummarizedExperiment objects

### Description

This man page documents the `findOverlaps` methods for RangedSummarizedExperiment objects.

RangedSummarizedExperiment objects also support `countOverlaps`, `overlapsAny`, and `subsetByOverlaps` thanks to the default methods defined in the IRanges package and to the `findOverlaps` methods defined in this package and documented below.

### Usage

    ## S4 method for signature 'RangedSummarizedExperiment,Vector'
    findOverlaps(query, subject,
        maxgap=-1L, minoverlap=0L,
        type=c("any", "start", "end", "within", "equal"),
        select=c("all", "first", "last", "arbitrary"),
        ignore.strand=FALSE)
    ## S4 method for signature 'Vector,RangedSummarizedExperiment'
    findOverlaps(query, subject,
        maxgap=-1L, minoverlap=0L,
        type=c("any", "start", "end", "within", "equal"),
        select=c("all", "first", "last", "arbitrary"),
        ignore.strand=FALSE)

### Arguments

`query, subject` | One of these two arguments must be a RangedSummarizedExperiment object.
`maxgap, minoverlap, type` | See `?findOverlaps` in the GenomicRanges package.
`select, ignore.strand` | See `?findOverlaps` in the GenomicRanges package.

### Details

These methods operate on the `rowRanges` component of the RangedSummarizedExperiment object, which can be a GenomicRanges or GRangesList object.

More precisely, if any of the above functions is passed a RangedSummarizedExperiment object thru the `query` and/or `subject` argument, then it behaves as if `rowRanges(query)` and/or `rowRanges(subject)` had been passed instead.

See `?findOverlaps` in the GenomicRanges package for the details of how `findOverlaps` and family operate on GenomicRanges and GRangesList objects.

### Value

See `?findOverlaps` in the GenomicRanges package.

### See Also

- RangedSummarizedExperiment objects.

- The findOverlaps man page in the GenomicRanges package where the `findOverlaps` family of methods for GenomicRanges and GRangesList objects is documented.

### Examples

    nrows <- 20; ncols <- 6
    counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
    rowRanges <- GRanges(rep(c("chr1", "chr2"), c(5, 15)),
                         IRanges(sample(1000L, 20), width=100),
                         strand=Rle(c("+", "-"), c(12, 8)))
    colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
                         row.names=LETTERS[1:6])
    rse0 <- SummarizedExperiment(assays=SimpleList(counts=counts),
                                 rowRanges=rowRanges, colData=colData)
    rse1 <- shift(rse0, 100)

    hits <- findOverlaps(rse0, rse1)
    hits
    stopifnot(identical(hits, findOverlaps(rowRanges(rse0), rowRanges(rse1))))
    stopifnot(identical(hits, findOverlaps(rse0, rowRanges(rse1))))
    stopifnot(identical(hits, findOverlaps(rowRanges(rse0), rse1)))

[Package SummarizedExperiment version 1.24.0 Index]