findOverlaps method | R documentation |
Find overlapping ranges
Description
The different methods for finding/counting ranges overlap between two "range-based" objects: the query and the subject.
NOTE: This page of the manual describes methods that operate on IntegerRanges and IntegerRangesList derivatives. Ver?`findOverlaps,GenomicRanges,GenomicRanges-metoda`
wgenomic rangespackage for methods that operate on GenomicRanges or GRangesListobjects.
To use
findOverlaps(query, subject, maxgap=-1L, minoverlap=0L, type=c("any", "start", "end", "within", "equal"), select=c("all", "first ", "last", "arbitrary"), ...) countOverlaps (query, subject, maxgap=-1L, minoverlap=0L, type=c("any", "start", "end", "inside", "equals"), ...)overlapsAny(query, subject, maxgap=-1L, minoverlap=0L, type=c("any", "beginning", "end", "within", "equals"), . ..) query %over% itemquery %inside%query%outside%subsetByOverlaps(x, ranges, maxgap=-1L, minoverlap=0L, type=c("any", "begin", "end", "inside", "equal"), invert=FALSE, ...)overlaps(query, subject, hits=NULL, ...)poverlaps(query, subject, maxgap = 0L, minoverlap = 1L, type = c("any", " start", "end", "within", "equals"), ...) mergeByOverlaps(query, subject, ...) findOverlapPairs(query, subject, ...)
arguments
query, subject, x, ranks | Each of these can be derived from IntegerRanges (for example, IRanges, Views) or IntegerRangesList (for example, IRangesList, ViewsList). Furthermore, if And If both arguments are named as list objects, each list item in the second argument is matched with the list item in the first star item with the matching name, if any. Otherwise, the list items are matched by position. The overlap between the pairs is then calculated as described below. And |
maximum rest | Single integer >= -1. And And |
small overlap | A single nonnegative integer. Only ranges with a minimum When |
type | Any overlap is accepted by default. defining He |
choose | And And |
counter | And |
hits | The Hits or HitsList object returned by |
... | Other arguments to be passed to or from other methods:
|
Details
A common type of query that arises when working with containers is determining which containers in one set overlap with containers in another.
The simplest approach is to callfindoverlap
function on IntegerRanges or some other object with range information (also known as a "range-based object").
Valor
Forfindoverlap
: verchoose
previous argument.
Fornumber overlays
: number of overlapping matches for each rangeconsultation
using the givenfindoverlap
parameters For IntegerRangesList objects, returns an IntegerListobject object.
applies to any
find ranges inconsultation
that match any range inhim
. For derivatives, IntegerRanges returns a logical vector with length equal to the number of ranges inconsultation
. For derivatives, IntegerRangesList returns a LogicalList object where each element of the result corresponds to a space inconsultation
.
%they%
I%w%
they are convenient packages for the 2 most common use cases. currently defined as`%over%` <- function(query, subject) overlaps Any(query, subject)
I`%w%` <- function(query, subject) overlaps Any(query, subject, type="inside")
.%apart from%
it's the opposite%they%
.
subsetByOverlays
returns a subsetX
which has an overlapping punch with a range of wcontracts
using the givenfindoverlap
parameters
Whenhits
is a Hits (or HitsList) object,overlapRanges(query, subject, hits)
returns an aIntegerRanges (or IntegerRangesList) objectsame shapeAshits
maintenance of intersection areas between overlapping ranges in objectsconsultation
Ihim
which should be the same query and subject used in the call tofindoverlap
generatedhits
.same shapemeans the same length whenhits
is a Hits object, has the same length and the same NROWS element whenhits
is a HitsList object.
halves
compareconsultation
Ihim
in parallel (ex.min
) and returns a boolean value indicating whether each pair of ranges matches. Integer vectors are treated as ranges of width one.
overlap fusion
calculates the query and topic overlap according to the arguments in...
. It then extracts the relevant hits from each object and returns adata frame
containing a column for the query and another for the subject, and anymcols
that were present in both elements. The query and subject columns are named by quoting and parsing the appropriate arguments.
find overlapping pairs
it is likeoverlap fusion
, except that it returns formalcouples
an object that provides other useful functions, such as finding the intersection of overlapping z-rangestransversal
.
from the author)
The Hervé page by Michaela Lawrence
Bibliography
Allen's interval algebra: James F. Allen: Maintaining knowledge of time intervals. In: ACM Announcements. November 26, 1983. ACM Press. S.832-843, ISSN 0001-0782
See also
-
Hits and HitsList of objects inS4Wectorybundle to represent a set of hits between 2 vector or list-type objects.
(Video) Aligned Data In Bioconductor -
findOverlaps, GenomicRanges, GenomicRanges-metodagenomic rangespackage for methods that operate on GRanges or GRangesListobjects.
The NCList class and constructor.
Klasy IntegerRanges, Views, IntegerRangesList y ViewsList.
Klasy IntegerList y LogicalList.
(Video) Bioconductor Workshop 1: R/Bioconductor Workshop for Genomic Data Analysis
examples
## ---------------------------------------------------------------- ---------------------## findOverlays()## ------- --------------- ---------------------------------query < - IRanges(c(1, 4, 9), c(5). , 7, 10))issue <- IRanges(c(2, 2, 10), c(2, 3, 12))findOverlaps(query, issue) # # as at most one match per queryfindOverlaps(query, issue, select= "first")findOverlaps(query, issue, select="last")findOverlaps(query, issue, select="arbitraly")## include adjacent ranges in the result of findOverlaps (query, issue, maximum space=0L)query < - IRanges (c(1, 4, 9), c(5, 7, 10))subject <- IRanges(c(2, 2), c(5, 4) ) )## an IRanges object with itselffindOverlaps(query )# # individual points as query object special type query <- IRanges(c(1, 5, 3, 4), width=c(2, 2, 4, 6))subject <- IRanges(c(1, 4), 4). 3, 5, 6), width=c (4, 4, 5, 4))findOverlaps(query, issue, type="start")findOverlaps(query, issue, type="start", maxgap =1L)findOverlaps(; query, issue, type="end", select="first")ov <- findOverlaps(query, subject, type="within", maxgap=1L)ov## Using pairs to find the intersection of overlapping ranges <- findOverlaps(query, subject)p <- Pairs ( query, issue, hits=hit)pintersect(p)## Shortcut <- findOverlapPairs(query, issue)pintersect(p)## ------- --- -- --------- ------- ----- -------## overlaps Any()## ----------- --- --------- ------------- ------------------overlapsAny(query, issue, type ="start")overlapsAny(query, issue, type ="end") query %on% issue # same as overlapAny(query, issue) query %within% issue # same as overlapAny(query, issue, # type= "within ")## ------ -- ----------- ------------- -------------# # overlapping ranges( )## --------------- - ---------------------------- --- --------## Extract areas of intersection between overlapping ranges: overlapsRanges(query, subject, ov)## -------------- ----- -- -- --------------## Using IntegerRangeList## ------------ -------------- - ---------------------------------- - ------query <- IRanges(c(1). , 4, 9), c(5, 7, 10))qpartition <-factor(c("a","a","b")) qlist <- split(query, qpartition)subject <-IRRanges(c ( 2, 2, 10), c(2, 3, 12)) split <-factor(c("a","a","b" ) )slist <- split(issue, partition)## max one hit on queryfindOverlap(qlist, slist, select="first")findOverlap(qlist, slist, select="last")findOverlap(qlist, slist, select="arbitrary") query <- IRanges(c(1, 5, 3). , 4), width=c(2, 2, 4, 6))qpartition <-factor(c("a","a","b" ,,b"))qlist <- division(query, qpartition) entity <- IRanges(c(1, 3, 5, 6), width=c(4, 4, 5, 4)) division <- factor(c("a","a","b","b " ))list <- split(issue, partition)overlapAny(qlist, list, type="start")overlapAny(qlist, list, type="end" )qlist subsetByOverlap(qlist, list)countOverlap(qlist, list);