Skip to main content

Crate rsomics_bed_reldist

Crate rsomics_bed_reldist 

Source
Expand description

Relative distance statistics between two BED interval sets.

§Algorithm

For each query interval in file A, finds the nearest upstream and downstream intervals in file B. The relative distance is:

relDist = min(distLeft, distRight) / (distLeft + distRight)

where distLeft is the distance to the B interval whose end is closest upstream, and distRight is the distance to the B interval whose start is closest downstream. Only intervals on the same chromosome are considered.

Both files must be sorted by chromosome then start position (matching bedtools sort / sort -k1,1 -k2,2n output).

The relative distance is binned into 100 equal bins over [0.0, 0.5]. The output reports, for each bin, the observed fraction and count.

§Reference

Favorov et al. (2012). Exploring Massive, Genome Scale Datasets with the GenometriCorr Package. PLOS Computational Biology 8(5): e1002529. DOI: 10.1371/journal.pcbi.1002529

Structs§

RelDistRow
One row of the reldist output table.

Functions§

reldist
Compute relative distances between query intervals in a and reference intervals in b, returning a 100-bin histogram table.
write_reldist
Write reldist results to w in tab-separated format (matching bedtools reldist output).