Description Usage Arguments Details Value Author(s) Examples
Compute a minimum bounding box for groups of pairwise genomic interactions.
1 2 | ## S4 method for signature 'GenomicInteractions'
boundingBox(x, f, reflect = TRUE)
|
x |
A GenomicInteractions object. |
f |
A factor or vector of length equal to that of |
reflect |
A logical scalar indicating whether intra-chromosomal interactions can be flipped around the diagonal to achieve a smaller bounding box. |
For any group of pairwise interactions, the minimum bounding box is the smallest rectangle in the interaction space that contains all interactions in the group. Each side of the box has coordinates spanning the most extreme anchor regions on the corresponding chromosome. This is often useful for summarizing clusters of interactions.
Grouping of interactions is specified using f
, where interactions in x
with the same level of f
are considered to be in the same group.
If f
is not specified, all interactions in x
are assumed to be in a single group (named as “1”).
An error will be raised if a group spans multiple chromosomes for either the first or second anchor regions.
The function returns a GenomicInteractions object containing the coordinates of the bounding boxes for all groups.
Each interaction represents a bounding box for a group, where the anchor regions represent the sides of the box.
Entries are named according to the levels of f
, in order to specify which bounding box corresponds to which group.
reflect=TRUE
will ensure that all interactions lie on one side of the diagonal of the interaction space.
(Specifically, the first anchor will always start before the second anchor, see swapAnchors
for details.)
This has a number of implications:
For intra-chromosomal groups, this generally yields a smaller bounding box, i.e., with a smaller maximum dimension.
For inter-chromosomal groups, setting reflect=TRUE
means that the function will work properly if the chromosomes are swapped between the first and second anchors for different interactions.
Otherwise, an error will be raised.
If reflect=TRUE
, the output GenomicInteractions object will have the same universe of regions for both anchors, equivalent to common=TRUE
in the GenomicInteractions
constructor.
Otherwise, it will have two separate GenomicRanges for the first and second anchor regions.
A GenomicInteractions object containing the coordinates of each bounding box.
Aaron Lun
1 2 3 4 5 6 7 8 9 10 11 12 | anchor1 <- GRanges(c("chr1", "chr1", "chr1", "chr1"),
IRanges(c(10, 20, 30, 20), width=5))
anchor2 <- GRanges(c("chr1", "chr1", "chr1", "chr2"),
IRanges(c(100, 200, 300, 50), width=5))
gi <- GenomicInteractions(anchor1, anchor2)
# Making up a sensible grouping, e.g., chromosome pairs.
f <- c(1,1,1,2)
boundingBox(gi, f)
# Fails for multiple chromosomes
try(out <- boundingBox(gi))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.