calculate_midpoint_distance1d: Distance between Midpoints of two Peaks

Description Usage Arguments Value Examples

View source: R/auxiliary.R

Description

Calculates the distance in nucleotides between the midpoints of two peaks.

Note: peaks must be on the same chromosome; start coordinate is always less than end coordinate

Usage

1
calculate_midpoint_distance1d(peak1_start, peak1_end, peak2_start, peak2_end)

Arguments

peak1_start

integer vector; genomic start coordinate(s) of peak in replicate 1

peak1_end

integer vector; genomic end coordinate(s) of peak in replicate 1

peak2_start

integer vector; genomic start coordinate(s) of peak in replicate 2

peak2_end

integer vector; genomic end coordinate(s) of peak in replicate 2

Value

positive integer vector; distances between peak pairs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# identical, zero distance
calculate_midpoint_distance1d(100, 120,
                          100, 120)

# centered, zero distance
calculate_midpoint_distance1d(100, 120,
                          90, 130)

# off by 10 per anchor
calculate_midpoint_distance1d(100, 120,
                         110, 130)

# vectorized example
calculate_midpoint_distance1d(c(100, 100, 100),
                          c(120, 120, 120),
                          c(100, 90, 110),
                          c(120, 130, 130))

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