findOverlaps-methods: find overlaps in bioconductor / IRanges: basic integer range manipulation in bioconductor (2023)

findOverlaps methodR 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, ifhimlubricantcontractsis an IntegerRangs object,consultationlubricantXcan be an integer vector to convert to ranges of length one.

Andconsultation(LubX) is therefore an IntegerRangesList objecthim(Lubcontracts) must also be an IntegerRangesList object.

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.

Andhimis omittedconsultationhe wonders against himself. In this case and only in this casedrop. myselfIredundantArguments are allowed. By default, the score will include hits for each rank against itself, and if there is a hit from A to B, there is a hit from B to A. Ifdrop. myselfEsTRUE, all custom matches are rejected. YeahredundantEsTRUE, only one of A->B and B->A is returned.

maximum rest

Single integer >= -1.

Andtypeis set to"all",maximum restis interpreted as maximumlucawhich is allowed between 2 ranges for the ranges to be considered overlapping. Helucabetween 2 ranges is the number of elements that divide them. Helucabetween two adjacent ranges is 0. By convention, when one range has its beginning or end strictly within the other (i.e., inseparable ranges),luca-1 is considered.

Andtypeis set to anything elsemaximum resthas a special meaning that depends on the specifictype. Vertypebelow for more information.

small overlap

A single nonnegative integer.

Only ranges with a minimumsmall overlapoverlapping positions are considered overlapping.

WhentypeEs"all"at least one ofmaximum restIsmall overlapshould be set to the default value.

type

Any overlap is accepted by default. definingtypeThe parameter can be selected for certain types of overlay. The types correspond to operations in Allen interval algebra (see references). YeahtypeEsbeginninglubricantfin, the intervals must have matching beginnings or endings. Determinationequalbecause the type returns an intersectionbeginningIfinmatches. YeahtypeEsw, the query range must be completely contained within the subject range. Please note that all parties must additionally comply with the conditionssmall overlaplimitation described above.

Hemaximum restthe parameter has special meaning for special overlay types. Forbeginning,fin, Iequal, specifies the maximum difference in starts, ends, or both, respectively. Forw, this is the maximum amount by which the topic can be broader than the query. Yeahmaximum restset to -1 (default), internally replaced by 0.

choose

Andconsultationderives from IntegerRanges:WhenchooseEs"All"(default), results are returned as a Hits object. Otherwise, the return value is an integer vectorparallelDoconsultation(i.e., of the same length) that contains the first, last, or any overlapping interval inhim, zAindicating intervals that did not overlap with any interval inhim.

Andconsultationse deriva de IntegerRangesList:WhenchooseEs"All"(default), the results are returned as a HitsList object. Otherwise, the return value depends ondropargument. Whenselect != "all" && !drop, a list of integers is returned, where each element of the result corresponds to a space inconsultation.Whenselect != "all" && drop, an array of integers is returned containing the indices that are shifted to align with the unenumeratedconsultation.

counter

AndTRUE, keep ranges onlyXdo itNOoverlapcontracts.

hits

The Hits or HitsList object returned byfindoverlapLubZERO. AndZEROSohitsis calculated per callfindOverlaps(query, subject, ...)internally (additional arguments passed tothe ranges overlapare forwarded tofindoverlap).

...

Other arguments to be passed to or from other methods:

  • drop: Supported only whenconsultationis a derivative of the IntegerRangesList type.FALSEHOODdefault. Seechooseabove argument for more details.

  • drop. myself,redundant: Whenhimis omitted, that isdrop. myselfIredundantarguments (bothFALSEHOODdefault) are allowed. LookconsultationIhimabove arguments for details.

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 callfindoverlapfunction on IntegerRanges or some other object with range information (also known as a "range-based object").

(Video) ATACseq in Bioconductor (Part 2)

Valor

Forfindoverlap: verchooseprevious argument.

Fornumber overlays: number of overlapping matches for each rangeconsultationusing the givenfindoverlapparameters For IntegerRangesList objects, returns an IntegerListobject object.

applies to anyfind ranges inconsultationthat 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%.

(Video) Summarizing Scores In Bioconductor

subsetByOverlaysreturns a subsetXwhich has an overlapping punch with a range of wcontractsusing the givenfindoverlapparameters

Whenhitsis a Hits (or HitsList) object,overlapRanges(query, subject, hits)returns an aIntegerRanges (or IntegerRangesList) objectsame shapeAshitsmaintenance of intersection areas between overlapping ranges in objectsconsultationIhimwhich should be the same query and subject used in the call tofindoverlapgeneratedhits.same shapemeans the same length whenhitsis a Hits object, has the same length and the same NROWS element whenhitsis a HitsList object.

halvescompareconsultationIhimin 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 fusioncalculates the query and topic overlap according to the arguments in.... It then extracts the relevant hits from each object and returns adata framecontaining a column for the query and another for the subject, and anymcolsthat were present in both elements. The query and subject columns are named by quoting and parsing the appropriate arguments.

(Video) Introduction to Bioconductor (Part 1)

find overlapping pairsit is likeoverlap fusion, except that it returns formalcouplesan 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);

Videos

1. GenomicRanges GRanges Usage v1
(Kasper Hansen)
2. Genomic Scores In Bioconductor
(BRC RU)
3. Genomic Intervals In Bioconductor
(BRC RU)
4. Introduction to Bioconductor (Part 2)
(BRC RU)
5. Usecase AnnotationHub GRanges Part2 v1
(Kasper Hansen)
6. R-Ladies Tunis : Integrating gene expression and DNA-binding data using R/Bioconductor
(R-Ladies Tunis)

References

Top Articles
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated: 16/09/2023

Views: 5869

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.