| 1 |
.. _random: |
| 2 |
|
| 3 |
############### |
| 4 |
*random* |
| 5 |
############### |
| 6 |
|
| 7 |
| |
| 8 |
|
| 9 |
.. image:: ../images/tool-glyphs/random-glyph.png |
| 10 |
:width: 600pt |
| 11 |
| |
| 12 |
|
| 13 |
`bedtools random` will generate a random set of intervals in BED6 format. One |
| 14 |
can specify both the number (``-n``) and the size (``-l``) of the intervals |
| 15 |
that should be generated. |
| 16 |
|
| 17 |
|
| 18 |
.. seealso:: |
| 19 |
|
| 20 |
:doc:`../tools/shuffle` |
| 21 |
:doc:`../tools/jaccard` |
| 22 |
|
| 23 |
|
| 24 |
========================================================================== |
| 25 |
Usage and option summary |
| 26 |
========================================================================== |
| 27 |
**Usage**: |
| 28 |
|
| 29 |
:: |
| 30 |
|
| 31 |
bedtools random [OPTIONS] -g <GENOME> |
| 32 |
|
| 33 |
**(or)**: |
| 34 |
: |
| 35 |
: |
| 36 |
|
| 37 |
randomBed [OPTIONS] -g <GENOME> |
| 38 |
|
| 39 |
=========================== =============================================================================================================================================================================================================== |
| 40 |
Option Description |
| 41 |
=========================== =============================================================================================================================================================================================================== |
| 42 |
**-l** | The length of the intervals to generate. |
| 43 |
| ``Default = 100`` |
| 44 |
|
| 45 |
**-n** | The number of intervals to generate. |
| 46 |
| ``Default = 1,000,000`` |
| 47 |
|
| 48 |
**-seed** Supply an integer seed for the shuffling. This will allow feature shuffling experiments to be recreated exactly as the seed for the pseudo-random number generation will be constant. *By default, the seed is chosen automatically*. |
| 49 |
=========================== =============================================================================================================================================================================================================== |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
========================================================================== |
| 55 |
Default behavior |
| 56 |
========================================================================== |
| 57 |
By default, `bedtools random` generate 1 million intervals of length 100 |
| 58 |
placed randomly in the genome specificed with ``-g``. |
| 59 |
|
| 60 |
.. code-block:: bash |
| 61 |
|
| 62 |
$ bedtools random -g hg19.genome |
| 63 |
chr2 87536758 87536858 1 100 - |
| 64 |
chrX 46051735 46051835 2 100 + |
| 65 |
chr18 5237041 5237141 3 100 - |
| 66 |
chr12 45809998 45810098 4 100 + |
| 67 |
chrX 42034890 42034990 5 100 - |
| 68 |
chr10 77510935 77511035 6 100 - |
| 69 |
chr3 39844278 39844378 7 100 - |
| 70 |
chr6 101012700 101012800 8 100 + |
| 71 |
chr12 38123482 38123582 9 100 + |
| 72 |
chr7 88508598 88508698 10 100 - |
| 73 |
|
| 74 |
$ bedtools random -g hg19.genome |
| 75 |
chr3 141987850 141987950 1 100 + |
| 76 |
chr5 137643331 137643431 2 100 + |
| 77 |
chr2 155523858 155523958 3 100 - |
| 78 |
chr5 147874094 147874194 4 100 + |
| 79 |
chr1 71838335 71838435 5 100 - |
| 80 |
chr8 71154323 71154423 6 100 - |
| 81 |
chr2 133240474 133240574 7 100 + |
| 82 |
chr9 131495427 131495527 8 100 + |
| 83 |
chrX 125952943 125953043 9 100 + |
| 84 |
chr3 59685545 59685645 10 100 + |
| 85 |
|
| 86 |
|
| 87 |
========================================================================== |
| 88 |
``-n`` Specify the *number* of intervals to generate. |
| 89 |
========================================================================== |
| 90 |
The `-n` option allows one to override the default of generating 1 million |
| 91 |
intervals. |
| 92 |
|
| 93 |
.. code-block:: bash |
| 94 |
|
| 95 |
$ bedtools random -g hg19.genome -n 3 |
| 96 |
chr20 47975280 47975380 1 100 - |
| 97 |
chr16 23381222 23381322 2 100 + |
| 98 |
chr3 104913816 104913916 3 100 - |
| 99 |
|
| 100 |
|
| 101 |
========================================================================== |
| 102 |
``-l`` Specify the *length* of intervals to generate. |
| 103 |
========================================================================== |
| 104 |
The `-l` option allows one to override the default interval length of 100bp. |
| 105 |
|
| 106 |
.. code-block:: bash |
| 107 |
|
| 108 |
$ bedtools random -g hg19.genome -l 5 |
| 109 |
chr9 54133731 54133736 1 5 + |
| 110 |
chr1 235288830 235288835 2 5 - |
| 111 |
chr8 26744718 26744723 3 5 + |
| 112 |
chr3 187313616 187313621 4 5 - |
| 113 |
chr11 88996846 88996851 5 5 - |
| 114 |
chr13 84714855 84714860 6 5 - |
| 115 |
chr13 10759738 10759743 7 5 - |
| 116 |
chr6 122569739 122569744 8 5 + |
| 117 |
chr17 50884025 50884030 9 5 - |
| 118 |
chr11 38576901 38576906 10 5 + |
| 119 |
|
| 120 |
|
| 121 |
========================================================================== |
| 122 |
``-seed`` Defining a "seed" for the random interval creation. |
| 123 |
========================================================================== |
| 124 |
`bedtools random` uses a pseudo-random number generator to permute the |
| 125 |
locations of BED features. Therefore, each run should produce a different |
| 126 |
result. This can be problematic if one wants to exactly recreate an experiment. |
| 127 |
By using the `seed` option, one can supply a custom integer seed for |
| 128 |
`bedtools random`. In turn, each execution of `bedtools random` with the same |
| 129 |
seed and input files should produce identical results. |
| 130 |
|
| 131 |
.. code-block:: bash |
| 132 |
|
| 133 |
$ bedtools random -g hg19.genome -seed 71346 |
| 134 |
chrY 23380696 23380796 1 100 - |
| 135 |
chr14 94368315 94368415 2 100 + |
| 136 |
chr14 45353323 45353423 3 100 - |
| 137 |
chr14 100546766 100546866 4 100 - |
| 138 |
chr12 43294368 43294468 5 100 - |
| 139 |
chr1 141470585 141470685 6 100 - |
| 140 |
chr10 31273665 31273765 7 100 + |
| 141 |
chr5 19102979 19103079 8 100 + |
| 142 |
chr3 116730634 116730734 9 100 - |
| 143 |
chr3 101222965 101223065 10 100 - |
| 144 |
|
| 145 |
# (same seed, thus same as above) |
| 146 |
$ bedtools random -g hg19.genome -seed 71346 |
| 147 |
chrY 23380696 23380796 1 100 - |
| 148 |
chr14 94368315 94368415 2 100 + |
| 149 |
chr14 45353323 45353423 3 100 - |
| 150 |
chr14 100546766 100546866 4 100 - |
| 151 |
chr12 43294368 43294468 5 100 - |
| 152 |
chr1 141470585 141470685 6 100 - |
| 153 |
chr10 31273665 31273765 7 100 + |
| 154 |
chr5 19102979 19103079 8 100 + |
| 155 |
chr3 116730634 116730734 9 100 - |
| 156 |
chr3 101222965 101223065 10 100 - |
| 157 |
|