Learn R Programming

InteractionSet (version 1.0.4)

linkOverlaps: Link overlapping regions

Description

Identify interactions that link two sets of regions by having anchor regions overlapping one entry in each set.

Usage

"linkOverlaps"(query, subject1, subject2, ..., use.region="both") "linkOverlaps"(query, subject1, subject2, ..., use.region="both")
# The same methods apply for InteractionSet objects as 'query'.

Arguments

query
A GInteractions or InteractionSet object.
subject1, subject2
A GRanges object.
...
Additional arguments to be passed to findOverlaps.
use.region
A string specifying which query regions should be used to overlap which subject. Ignored if subject2 is missing.

Value

A dataframe of integer indices indicating which elements of query link which elements of subject1 and subject2.

Details

This function identifies all interactions in query where one anchor overlaps an entry in subject1 and the other anchor overlaps an entry in subject2. It is designed to be used to identify regions that are linked by interactions in query. For example, one might specify genes as subject1 and enhancers as subject2, to identify all gene-enhancer contacts present in query. This is useful when the exact pairings between subject1 and subject2 are undefined.

The function returns a dataframe specifying the index of the interaction in query; the index of the overlapped region in subject1; and the index of the overlapped region in subject2. If multiple regions in subject1 and/or subject2 are overlapping the anchor regions of a particular interaction, all combinations of two overlapping regions (one from each subject* set) are reported for that interaction.

By default, use.region="both" such that overlaps will be considered between any first/second interacting region in query and either subject1 or subject2. If use.region="same", overlaps will only be considered between the first interacting region in query and entries in subject1, and between the second interacting region and subject2. The opposite applies with use.region="reverse", where the first and second interacting regions are overlapped with subject2 and subject1 respectively.

If subject2 is not specified, links within subject1 are identified instead, i.e., subject2 is set to subject1. In such cases, the returned dataframe is such that the first subject index is always greater than the second subject index, to avoid redundant permutations.

See Also

findOverlaps,GInteractions,Vector-method

Examples

Run this code
example(GInteractions, echo=FALSE)

all.genes <- GRanges("chrA", IRanges(0:9*10, 1:10*10))
all.enhancers <- GRanges("chrB", IRanges(0:9*10, 1:10*10))

out <- linkOverlaps(gi, all.genes, all.enhancers)
head(out)

out <- linkOverlaps(gi, all.genes)
head(out)

# Same methods apply for InteractionSet objects.

example(InteractionSet, echo=FALSE)
out <- linkOverlaps(iset, all.genes, all.enhancers)
out <- linkOverlaps(iset, all.genes)

Run the code above in your browser using DataLab