Description Usage Arguments Details Value Author(s) See Also Examples
Find overlaps between a set of linear intervals in a GRanges object, and the set of regions representing the rows or columns of a ContactMatrix.
1 2 3 4 5 6 7 8 9 10 11 12 | ## S4 method for signature 'ContactMatrix,GRanges'
overlapsAny(query, subject, maxgap=0L, minoverlap=1L,
type=c("any", "start", "end", "within", "equal"),
ignore.strand=TRUE)
## S4 method for signature 'ContactMatrix,GRangesList'
overlapsAny(query, subject, maxgap=0L, minoverlap=1L,
type=c("any", "start", "end", "within", "equal"),
ignore.strand=TRUE, use.region="both")
# The same call is used for the methods taking GRangesList, GInteractions and
# InteractionSet objects as 'subject'. For brevity, these will not be listed.
|
query |
A ContactMatrix object. |
subject |
A GRanges, GRangesList, GInteractions or InteractionSet object. |
maxgap, minoverlap, type |
See |
ignore.strand |
See |
use.region |
A string specifying how the interacting regions are to be matched to row/column regions. |
When subject
is a GRanges, overlaps are identified between the row regions of query
and the regions in subject
.
This is repeated for the column regions of query
.
A list of two logical vectors is returned, specifying the rows and columns in query
that are overlapped by any region in subject
.
These vectors can be directly used to subset query
.
Alternatively, they can be used in outer
to generate a logical matrix for masking – see Examples.
For all other classes of subject
, two-dimensional overlaps are identified.
A logical matrix is returned indicating which entries in the ContactMatrix have overlaps with the specified interactions.
For any given entry, an overlap is only considered if the regions for the corresponding row and column both overlap anchor regions in the subject
.
See ?"findOverlaps,GInteractions,GInteractions-method"
for more details.
If use.region="both"
, overlaps between any row/column region and the first/second interacting region of subject
are considered.
If use.region="same"
, only overlaps between row regions and the first interacting regions, or between column regions and the second interacting regions are considered.
If use.region="reverse"
, only overlaps between row regions and the second interacting regions, or between row regions and the first interacting regions are considered.
For overlapsAny,ContactMatrix,GRanges-method
, a named list of two logical vectors is returned specifying the rows of columns of query
overlapped by subject
.
For the other overlapsAny
methods, a logical matrix is returned indicating which entries in query
are overlapped by subject
.
Aaron Lun
ContactMatrix-class
,
findOverlaps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | example(ContactMatrix, echo=FALSE)
of.interest <- resize(sample(regions(x), 2), width=1, fix="center")
olap <- overlapsAny(x, of.interest)
olap
x[olap$row,]
x[,olap$column]
x[olap$row,olap$column]
keep <- outer(olap$row, olap$column, "|") # OR mask
temp <- as.matrix(x)
temp[!keep] <- NA
keep <- outer(olap$row, olap$column, "&") # AND mask
temp <- as.matrix(x)
temp[!keep] <- NA
# Two dimensional overlaps.
pairing <- GRangesList(first=regions(x), second=regions(x))
olap <- overlapsAny(x, pairing)
olap
olap <- overlapsAny(sort(x), pairing) # A bit prettier
olap
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.