pairdist: Get the linear distance for each interaction

Description Usage Arguments Details Value Author(s) Examples

Description

Compute the distance between interacting regions on the linear genome, for each pairwise interaction contained in a GenomicInteractions object.

Usage

1
2
3
4
## S4 method for signature 'GenomicInteractions'
pairdist(x, type = "mid")

intrachr(x)

Arguments

x

A GenomicInteractions object.

type

String pecifying the type of distance to compute. Can take values of "mid", "gap", "span", "diag" or "intra".

Details

For each interaction in x, the pairdist method computes the distance between the two interacting regions. An integer vector is returned, with values computed according to the specified value of type:

"mid":

The distance between the midpoints of the two regions (rounded down to the nearest integer) is returned.

"gap":

The length of the gap between the closest points of the two regions is computed - negative lengths are returned for overlapping regions, indicating the length of the overlap.

"span":

The distance between the furthermost points of the two regions is computed.

"diag":

The number of regions in regions(x) between the two anchors is returned. This requires that both anchors have the same universe of regions (an error is raised otherwise).

Interchromosomal interactions are marked with NA. Alternatively, if type="intra", a logical vector is returned indicating whether the interaction occurs between two regions on the same chromosome. intrachr(x) is an alias for pairdist(x, type="intra").

Value

An integer vector of base-pair distances for type="gap" or "span".

An integer vector of the number of intervening regions for type="diag".

A numeric vector of base-pair distances for type="mid".

A logical vector for type="intra" or from intrachr.

Author(s)

Aaron Lun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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))
test <- GenomicInteractions(anchor1, anchor2)
test

pairdist(test)
pairdist(test, type="gap")
pairdist(test, type="span")
intrachr(test)

# Common regions.
regions <- GRanges("chr1", IRanges(sort(sample(1000, 10)), width=5))
i1 <- sample(length(regions), 10)
i2 <- sample(length(regions), 10)
test.common <- GenomicInteractions(i1, i2, regions)
pairdist(test.common, type="diag")

LTLA/GenomicInteractions documentation built on June 24, 2019, 2:09 p.m.