Debian Codegraph @

docs/content/tools/slop.rst

raw
1 .. _slop:
2
3 ###############
4 *slop*
5 ###############
6
7 |
8
9 .. image:: ../images/tool-glyphs/slop-glyph.png
10 :width: 600pt
11
12 |
13
14 ``bedtools slop`` will increase the size of each feature in a feature file by a
15 user-defined number of bases. While something like this could be done with an
16 ``awk '{OFS="\t" print $1,$2-<slop>,$3+<slop>}'``,
17 ``bedtools slop`` will restrict the resizing to the size of the chromosome
18 (i.e. no start < 0 and no end > chromosome size).
19
20 .. note::
21
22 In order to prevent the extension of intervals beyond chromosome boundaries,
23 ``bedtools slop`` requires a *genome* file defining the length of each
24 chromosome or contig.
25
26 .. seealso::
27
28 :doc:`../tools/flank`
29
30 ==========================================================================
31 Usage and option summary
32 ==========================================================================
33 **Usage**:
34 ::
35
36 bedtools slop [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-b or (-l and -r)]
37
38 **(or):**
39 ::
40
41 slopBed [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-b or (-l and -r)]
42
43 =========================== ===============================================================================================================================================================================================================
44 Option Description
45 =========================== ===============================================================================================================================================================================================================
46 **-b** Increase the BED/GFF/VCF entry by the same number base pairs in each direction. *Integer*.
47 **-l** The number of base pairs to subtract from the start coordinate. *Integer*.
48 **-r** The number of base pairs to add to the end coordinate. *Integer*.
49 **-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.
50 **-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.
51 **-header** Print the header from the input file prior to results.
52 =========================== ===============================================================================================================================================================================================================
53
54
55
56 ==========================================================================
57 Default behavior
58 ==========================================================================
59 By default, ``bedtools slop`` will either add a fixed number of bases in each
60 direction (``-b``) or an asymmetric number of bases in each direction
61 with ``-l`` and ``-r``.
62
63
64 .. code-block:: bash
65
66 $ cat A.bed
67 chr1 5 100
68 chr1 800 980
69
70 $ cat my.genome
71 chr1 1000
72
73 $ bedtools slop -i A.bed -g my.genome -b 5
74 chr1 0 105
75 chr1 795 985
76
77 $ bedtools slop -i A.bed -g my.genome -l 2 -r 3
78 chr1 3 103
79 chr1 798 983
80
81
82 However, if the requested number of bases exceeds the boundaries of the
83 chromosome, ``bedtools slop`` will "clip" the feature accordingly.
84
85 .. code-block:: bash
86
87 $ cat A.bed
88 chr1 5 100
89 chr1 800 980
90
91 $ cat my.genome
92 chr1 1000
93
94 $ bedtools slop -i A.bed -g my.genome -b 5000
95 chr1 0 1000
96 chr1 0 1000
97
98
99
100 ==========================================================================
101 ``-s`` Resizing features according to strand
102 ==========================================================================
103 ``bedtools slop`` will optionally increase the size of a feature based on strand.
104
105 For example:
106
107 .. code-block:: bash
108
109 $ cat A.bed
110 chr1 100 200 a1 1 +
111 chr1 100 200 a2 2 -
112
113 $ cat my.genome
114 chr1 1000
115
116 $ bedtools slop -i A.bed -g my.genome -l 50 -r 80 -s
117 chr1 50 280 a1 1 +
118 chr1 20 250 a2 2 -
119
120
121 ==========================================================================
122 ``-pct`` Resizing features by a given fraction
123 ==========================================================================
124 ``bedtools slop`` will optionally increase the size of a feature by a
125 user-specific fraction.
126
127 For example:
128
129 .. code-block:: bash
130
131 $ cat A.bed
132 chr1 100 200 a1 1 +
133
134 $ bedtools slop -i A.bed -g my.genome -b 0.5 -pct
135 chr1 50 250 a1 1 +
136
137 $ bedtools slop -i a.bed -l 0.5 -r 0.0 -pct -g my.genome
138 chr1 50 200 a1 1 +
139
140
141 ==========================================================================
142 ``-header`` Print the header for the A file before reporting results.
143 ==========================================================================
144 By default, if your A file has a header, it is ignored when reporting results.
145 This option will instead tell bedtools to first print the header for the
146 A file prior to reporting results.
147