Learn R Programming

SummarizedExperiment (version 1.2.3)

findOverlaps-methods: 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

"findOverlaps"(query, subject, maxgap=0L, minoverlap=1L, type=c("any", "start", "end", "within", "equal"), select=c("all", "first", "last", "arbitrary"), ignore.strand=FALSE) "findOverlaps"(query, subject, maxgap=0L, minoverlap=1L, 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.

Value

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.

See Also

Examples

Run this code
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)))

Run the code above in your browser using DataLab