GenomicInteractions (version 1.6.2)

calculateDistances: Calculate interaction distances

Description

This function takes a GInteractions object and calculates the distances between the anchors according to the value of method. The distances returned follow the same convention as distance(x, y) in GenomicRanges where the distance between adjacent regions is 0. Note that if anchors are overlapping this method will print a warning and return the distance as 0.

Usage

calculateDistances(GIObject, method = "midpoint", floor = TRUE)
"calculateDistances"(GIObject, method = "midpoint", floor = TRUE)

Arguments

GIObject
A GInteractions object
method
Character vector indicating how to calculate distances, must be one of `midpoint', `outer', `inner'.
floor
A logical specifying whether to round down distances to nearest base pair or not. Default TRUE.

Value

An vector containing the distances between anchors/GRanges, NA if on different chromosomes, rounded down to the nearest bp.

Examples

Run this code

library(GenomicRanges)

anchor.one = GRanges(c("chr1", "chr1", "chr1", "chr1"), IRanges(c(10, 20, 30, 20), width=5))
anchor.two = GRanges(c("chr1", "chr1", "chr1", "chr2"), IRanges(c(100, 200, 300, 50), width=5))
interaction_counts = sample(1:10, 4)
test <- GenomicInteractions(anchor.one, anchor.two, experiment_name="test", 
                           description="this is a test", counts=interaction_counts)
calculateDistances(test, method="midpoint")
        

Run the code above in your browser using DataLab