Debian Codegraph @

docs/content/tools/flank.rst

raw
1 .. _flank:
2
3 ###############
4 *flank*
5 ###############
6
7 |
8
9 .. image:: ../images/tool-glyphs/flank-glyph.png
10 :width: 600pt
11
12 |
13
14 ``bedtools flank`` will create two new flanking intervals for each interval in
15 a BED/GFF/VCF file. Note that ``flank`` will restrict the created flanking
16 intervals to the size of the chromosome (i.e. no start < 0 and no end >
17 chromosome size).
18
19 .. note::
20
21 In order to prevent creating intervals that violate chromosome boundaries,
22 ``bedtools flank`` requires a *genome* file defining the length of each
23 chromosome or contig.
24
25 .. seealso::
26
27 :doc:`../tools/slop`
28
29 ==========================================================================
30 Usage and option summary
31 ==========================================================================
32 **Usage**:
33 ::
34
35 bedtools flank [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-b or (-l and -r)]
36
37 **(or):**
38 ::
39
40 flankBed [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-b or (-l and -r)]
41
42 =========================== ===============================================================================================================================================================================================================
43 Option Description
44 =========================== ===============================================================================================================================================================================================================
45 **-b** Increase the BED/GFF/VCF entry by the same number base pairs in each direction. *Integer*.
46 **-l** The number of base pairs to subtract from the start coordinate. *Integer*.
47 **-r** The number of base pairs to add to the end coordinate. *Integer*.
48 **-s** Define -l and -r based on strand. For example. if used, -l 500 for a negative-stranded feature, it will add 500 bp to the *end* coordinate.
49 **-pct** Define -l and -r as a fraction of the feature's length. E.g. if used on a 1000bp feature, -l 0.50, will add 500 bp "upstream". Default = false.
50 =========================== ===============================================================================================================================================================================================================
51
52
53
54 ==========================================================================
55 Default behavior
56 ==========================================================================
57 By default, ``bedtools flank`` will either add a fixed number of bases in each
58 direction (``-b``) or an asymmetric number of bases in each direction
59 with ``-l`` and ``-r``.
60
61
62 .. code-block:: bash
63
64 $ cat A.bed
65 chr1 100 200
66 chr1 500 600
67
68 $ cat my.genome
69 chr1 1000
70
71 $ bedtools flank -i A.bed -g my.genome -b 5
72 chr1 95 100
73 chr1 200 205
74 chr1 495 500
75 chr1 600 605
76
77 $ bedtools flank -i A.bed -g my.genome -l 2 -r 3
78 chr1 98 100
79 chr1 200 203
80 chr1 498 500
81 chr1 600 603
82
83
84
85
86 However, if the requested number of bases exceeds the boundaries of the
87 chromosome, ``bedtools flank`` will "clip" the feature accordingly.
88
89 .. code-block:: bash
90
91 $ cat A.bed
92 chr1 100 200
93 chr1 500 600
94
95 $ cat my.genome
96 chr1 1000
97
98 $ bedtools flank -i A.bed -g my.genome -b 800
99 chr1 0 100
100 chr1 200 1000
101 chr1 0 500
102 chr1 600 1000
103
104
105 ==========================================================================
106 ``-pct`` Resizing features by a given fraction
107 ==========================================================================
108 ``bedtools flank`` will optionally create flanking intervals whose size is
109 user-specified fraction of the original interval.
110
111 For example:
112
113 .. code-block:: bash
114
115 $ cat A.bed
116 chr1 100 200
117 chr1 500 700
118
119 ################################################################
120 # note the flanking intervals from the second record in A.bed
121 # are 20bp whereas the flanking intervals from the first record
122 # are only 10bp
123 ################################################################
124 $ bedtools flank -i A.bed -g my.genome -b 0.1 -pct
125 chr1 90 100
126 chr1 200 210
127 chr1 480 500
128 chr1 700 720
129
130
131