| 1 |
.. _reldist: |
| 2 |
|
| 3 |
############### |
| 4 |
*reldist* |
| 5 |
############### |
| 6 |
|
| 7 |
| |
| 8 |
|
| 9 |
.. image:: ../images/tool-glyphs/reldist-glyph.png |
| 10 |
:width: 600pt |
| 11 |
|
| 12 |
Traditional approaches to summarizing the similarity between two sets of genomic intervals |
| 13 |
are based upon the number or proportion of *intersecting* intervals. However, such measures |
| 14 |
are largely blind to spatial correlations between the two sets where, despite consistent spacing |
| 15 |
or proximity, intersections are rare (for example, enhancers and transcription start sites rarely overlap, |
| 16 |
yet they are much closer to one another than two sets of random intervals). Favorov et al [1] proposed |
| 17 |
a *relative distance* metric that describes distribution of relative distances between each interval in |
| 18 |
one set and the two closest intervals in another set (see figure above). If there is no spatial |
| 19 |
correlation between the two sets, one would expect the relative distances to be uniformly distributed |
| 20 |
among the relative distances ranging from 0 to 0.5. If, however, the intervals tend to be much closer than expected |
| 21 |
by chance, the distribution of observed relative distances would be shifted towards low relative distance values (e.g., the figure below). |
| 22 |
|
| 23 |
.. image:: ../images/tool-glyphs/reldist-plot.png |
| 24 |
:width: 600pt |
| 25 |
|
| 26 |
|
| 27 |
.. code:: |
| 28 |
|
| 29 |
[1] Exploring Massive, Genome Scale Datasets with the GenometriCorr Package. |
| 30 |
Favorov A, Mularoni L, Cope LM, Medvedeva Y, Mironov AA, et al. (2012) |
| 31 |
PLoS Comput Biol 8(5): e1002529. doi:10.1371/journal.pcbi.1002529 |
| 32 |
|
| 33 |
|
| 34 |
.. seealso:: |
| 35 |
|
| 36 |
:doc:`../tools/jaccard` |
| 37 |
:doc:`../tools/closest` |
| 38 |
|
| 39 |
|
| 40 |
=============================== |
| 41 |
Usage and option summary |
| 42 |
=============================== |
| 43 |
**Usage**: |
| 44 |
:: |
| 45 |
|
| 46 |
bedtools reldist [OPTIONS] -a <BED/GFF/VCF> -b <BED/GFF/VCF> |
| 47 |
|
| 48 |
|
| 49 |
=========================== ========================================================================================================================================================= |
| 50 |
Option Description |
| 51 |
=========================== ========================================================================================================================================================= |
| 52 |
**-a** BED/GFF/VCF file A. Each feature in A is compared to B in search of overlaps. Use "stdin" if passing A with a UNIX pipe. |
| 53 |
**-b** BED/GFF/VCF file B. Use "stdin" if passing B with a UNIX pipe. |
| 54 |
**-detail** Instead of a summary, report the relative distance for each interval in A |
| 55 |
=========================== ========================================================================================================================================================= |
| 56 |
|
| 57 |
|
| 58 |
=============================== |
| 59 |
Default behavior |
| 60 |
=============================== |
| 61 |
By default, ``bedtools reldist`` reports the distribution of relative distances between two sets of intervals. |
| 62 |
The output reports the frequency of each relative distance (ranging from 0.0 to 0.5). If the two sets of intervals |
| 63 |
are randomly distributed with respect to one another, each relative distance "bin" with be roughly equally represented |
| 64 |
(i.e., a uniform distribution). For example, consider the relative distance distance distribution for exons and AluY |
| 65 |
elements: |
| 66 |
|
| 67 |
.. code-block:: bash |
| 68 |
|
| 69 |
|
| 70 |
$ bedtools reldist \ |
| 71 |
-a data/refseq.chr1.exons.bed.gz \ |
| 72 |
-b data/ |
| 73 |
aluY.chr1.bed.gz |
| 74 |
0.00 164 43408 0.004 |
| 75 |
0.01 551 43408 0.013 |
| 76 |
0.02 598 43408 0.014 |
| 77 |
0.03 637 43408 0.015 |
| 78 |
0.04 793 43408 0.018 |
| 79 |
0.05 688 43408 0.016 |
| 80 |
0.06 874 43408 0.020 |
| 81 |
0.07 765 43408 0.018 |
| 82 |
0.08 685 43408 0.016 |
| 83 |
0.09 929 43408 0.021 |
| 84 |
0.10 876 43408 0.020 |
| 85 |
0.11 959 43408 0.022 |
| 86 |
0.12 860 43408 0.020 |
| 87 |
0.13 851 43408 0.020 |
| 88 |
0.14 903 43408 0.021 |
| 89 |
0.15 893 43408 0.021 |
| 90 |
0.16 883 43408 0.020 |
| 91 |
0.17 828 43408 0.019 |
| 92 |
0.18 917 43408 0.021 |
| 93 |
0.19 875 43408 0.020 |
| 94 |
0.20 897 43408 0.021 |
| 95 |
0.21 986 43408 0.023 |
| 96 |
0.22 903 43408 0.021 |
| 97 |
0.23 944 43408 0.022 |
| 98 |
0.24 904 43408 0.021 |
| 99 |
0.25 867 43408 0.020 |
| 100 |
0.26 943 43408 0.022 |
| 101 |
0.27 933 43408 0.021 |
| 102 |
0.28 1132 43408 0.026 |
| 103 |
0.29 881 43408 0.020 |
| 104 |
0.30 851 43408 0.020 |
| 105 |
0.31 963 43408 0.022 |
| 106 |
0.32 950 43408 0.022 |
| 107 |
0.33 965 43408 0.022 |
| 108 |
0.34 907 43408 0.021 |
| 109 |
0.35 884 43408 0.020 |
| 110 |
0.36 965 43408 0.022 |
| 111 |
0.37 944 43408 0.022 |
| 112 |
0.38 911 43408 0.021 |
| 113 |
0.39 939 43408 0.022 |
| 114 |
0.40 921 43408 0.021 |
| 115 |
0.41 950 43408 0.022 |
| 116 |
0.42 935 43408 0.022 |
| 117 |
0.43 919 43408 0.021 |
| 118 |
0.44 915 43408 0.021 |
| 119 |
0.45 934 43408 0.022 |
| 120 |
0.46 843 43408 0.019 |
| 121 |
0.47 850 43408 0.020 |
| 122 |
0.48 1006 43408 0.023 |
| 123 |
0.49 937 43408 0.022 |
| 124 |
|
| 125 |
In contrast, consider the relative distance distribution observed between exons and conserved elements: |
| 126 |
|
| 127 |
.. code-block:: bash |
| 128 |
|
| 129 |
$ bedtools reldist \ |
| 130 |
-a data/refseq.chr1.exons.bed.gz \ |
| 131 |
-b data/gerp.chr1.bed.gz |
| 132 |
reldist count total fraction |
| 133 |
0.00 20629 43422 0.475 |
| 134 |
0.01 2629 43422 0.061 |
| 135 |
0.02 1427 43422 0.033 |
| 136 |
0.03 985 43422 0.023 |
| 137 |
0.04 897 43422 0.021 |
| 138 |
0.05 756 43422 0.017 |
| 139 |
0.06 667 43422 0.015 |
| 140 |
0.07 557 43422 0.013 |
| 141 |
0.08 603 43422 0.014 |
| 142 |
0.09 487 43422 0.011 |
| 143 |
0.10 461 43422 0.011 |
| 144 |
0.11 423 43422 0.010 |
| 145 |
0.12 427 43422 0.010 |
| 146 |
0.13 435 43422 0.010 |
| 147 |
0.14 375 43422 0.009 |
| 148 |
0.15 367 43422 0.008 |
| 149 |
0.16 379 43422 0.009 |
| 150 |
0.17 371 43422 0.009 |
| 151 |
0.18 346 43422 0.008 |
| 152 |
0.19 389 43422 0.009 |
| 153 |
0.20 377 43422 0.009 |
| 154 |
0.21 411 43422 0.009 |
| 155 |
0.22 377 43422 0.009 |
| 156 |
0.23 352 43422 0.008 |
| 157 |
0.24 334 43422 0.008 |
| 158 |
0.25 315 43422 0.007 |
| 159 |
0.26 370 43422 0.009 |
| 160 |
0.27 330 43422 0.008 |
| 161 |
0.28 330 43422 0.008 |
| 162 |
0.29 280 43422 0.006 |
| 163 |
0.30 309 43422 0.007 |
| 164 |
0.31 326 43422 0.008 |
| 165 |
0.32 287 43422 0.007 |
| 166 |
0.33 294 43422 0.007 |
| 167 |
0.34 306 43422 0.007 |
| 168 |
0.35 307 43422 0.007 |
| 169 |
0.36 309 43422 0.007 |
| 170 |
0.37 271 43422 0.006 |
| 171 |
0.38 293 43422 0.007 |
| 172 |
0.39 311 43422 0.007 |
| 173 |
0.40 331 43422 0.008 |
| 174 |
0.41 320 43422 0.007 |
| 175 |
0.42 299 43422 0.007 |
| 176 |
0.43 327 43422 0.008 |
| 177 |
0.44 321 43422 0.007 |
| 178 |
0.45 326 43422 0.008 |
| 179 |
0.46 306 43422 0.007 |
| 180 |
0.47 354 43422 0.008 |
| 181 |
0.48 365 43422 0.008 |
| 182 |
0.49 336 43422 0.008 |
| 183 |
0.50 38 43422 0.001 |
| 184 |
|
| 185 |
|
| 186 |
Moreover, if one compares the relative distances for one set against itself, every interval |
| 187 |
should be expected to overlap an interval in the other set (itself). As such, the relative |
| 188 |
distances will all be 0.0: |
| 189 |
|
| 190 |
.. code-block:: bash |
| 191 |
|
| 192 |
$ bedtools reldist \ |
| 193 |
-a data/refseq.chr1.exons.bed.gz \ |
| 194 |
-b data/refseq.chr1.exons.bed.gz |
| 195 |
reldist count total fraction |
| 196 |
0.00 43424 43424 1.000 |
| 197 |
|