calculate_relative_overlap2d: Relative Anchor Overlap of two Interactions

Description Usage Arguments Value Examples

View source: R/auxiliary.R

Description

Calculates the overlap between anchor A of interaction 1 and anchor A of interaction 2, as well as anchor B of interaction 1 and anchor B of interaction 2. The overlap (in nucleotides) is then normalized by the length of the anchors.

Note: anchors A and B of the same interaction have to be on the same chromosome; start coordinate is always less than end coordinate

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
calculate_relative_overlap2d(
  int1_anchor_a_start,
  int1_anchor_a_end,
  int1_anchor_b_start,
  int1_anchor_b_end,
  int2_anchor_a_start,
  int2_anchor_a_end,
  int2_anchor_b_start,
  int2_anchor_b_end
)

Arguments

int1_anchor_a_start

integer vector; genomic start coordinate(s) of anchor A in replicate 1 interaction

int1_anchor_a_end

integer vector; genomic end coordinate(s) of anchor A in replicate 1 interaction

int1_anchor_b_start

integer vector; genomic start coordinate(s) of anchor B in replicate 1 interaction

int1_anchor_b_end

integer vector; genomic end coordinate(s) of anchor B in replicate 1 interaction

int2_anchor_a_start

integer vector; genomic start coordinate(s) of anchor A in replicate 2 interaction

int2_anchor_a_end

integer vector; genomic end coordinate(s) of anchor A in replicate 2 interaction

int2_anchor_b_start

integer vector; genomic start coordinate(s) of anchor B in replicate 2 interaction

int2_anchor_b_end

integer vector; genomic end coordinate(s) of anchor B in replicate 2 interaction

Value

numeric vector; relative overlaps between interaction pairs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 100% overlap
calculate_relative_overlap2d(100, 120, 240, 260,
                             100, 120, 240, 260)

# 50% overlap
calculate_relative_overlap2d(100, 120, 240, 250,
                             100, 110, 240, 260)

# negative overlap
calculate_relative_overlap2d(100, 120, 240, 250,
                             130, 140, 260, 280)

# larger negative overlap
calculate_relative_overlap2d(100, 120, 240, 250,
                             200, 220, 340, 350)

# vectorized example
calculate_relative_overlap2d(c(100, 100, 100, 100),
                             c(120, 120, 120, 120),
                             c(240, 240, 240, 240),
                             c(260, 250, 250, 250),
                             c(100, 100, 130, 200),
                             c(120, 110, 140, 220),
                             c(240, 240, 260, 340),
                             c(260, 260, 280, 350))

idr2d documentation built on Nov. 8, 2020, 6:16 p.m.