Debian Codegraph @

docs/content/tools/shift.rst

raw
1 .. _shift:
2
3 ###############
4 *shift*
5 ###############
6
7 |
8
9 .. image:: ../images/tool-glyphs/shift-glyph.png
10 :width: 600pt
11
12 |
13
14 ``bedtools shift`` will move 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+<shift>,$3+<shift>}'``,
17 ``bedtools shift`` will restrict the resizing to the size of the chromosome
18 (i.e. no features before 0 or past the chromosome end).
19
20 .. note::
21
22 In order to prevent the extension of intervals beyond chromosome boundaries,
23 ``bedtools shift`` requires a *genome* file defining the length of each
24 chromosome or contig.
25
26 .. seealso::
27
28 :doc:`../tools/slop`
29
30 ==========================================================================
31 Usage and option summary
32 ==========================================================================
33 **Usage**:
34 ::
35
36 bedtools shift [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-s or (-m and -p)]
37
38 **(or):**
39 ::
40
41 shiftBed [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-s or (-m and -p)]
42
43 =========================== ===============================================================================================================================================================================================================
44 Option Description
45 =========================== ===============================================================================================================================================================================================================
46 **-s** Shift the BED/GFF/VCF entry -s base pairs. *Integer* or *Float* (e.g. 0.1) if used with -pct
47 **-m** Shift entries on the - strand -m base pairs. *Integer* or *Float* (e.g. 0.1) if used with -pct
48 **-p** Shift entries on the + strand -p base pairs. *Integer* or *Float* (e.g. 0.1) if used with -pct
49 **-pct** Define -s, -m and -p as a fraction of the feature's length. E.g. if used on a 1000bp feature, -s 0.50, will shift the feature 500 bp \"upstream\". Default = false.
50 **-header** Print the header from the input file prior to results.
51 =========================== ===============================================================================================================================================================================================================
52
53
54
55 ==========================================================================
56 Default behavior
57 ==========================================================================
58 By default, ``bedtools shift`` will shift features a fixed number of bases. This shift can either be applied to all features (``-s``), or seperately to features on the plus (``-p``) and minus (``-m``) strands. Shifts can either be positive or negative.
59
60 .. code-block:: bash
61
62 $ cat A.bed
63 chr1 5 100 +
64 chr1 800 980 -
65
66 $ cat my.genome
67 chr1 1000
68
69 $ bedtools shift -i A.bed -g my.genome -s 5
70 chr1 10 105 +
71 chr1 805 985 -
72
73 $ bedtools shift -i A.bed -g my.genome -p 2 -m -3
74 chr1 7 102 +
75 chr1 797 977 -
76
77
78 However, if the requested number of bases exceeds the boundaries of the
79 chromosome, ``bedtools shift`` will "clip" the feature accordingly.
80
81 .. code-block:: bash
82
83 $ cat A.bed
84 chr1 5 100 +
85 chr1 800 980 +
86
87 $ cat my.genome
88 chr1 1000
89
90 $ bedtools shift -i A.bed -g my.genome -s 5000
91 chr1 999 1000 +
92 chr1 999 1000 +
93
94
95 ==========================================================================
96 ``-pct`` Shifting features by a given fraction
97 ==========================================================================
98 ``bedtools shift`` will shift the feature by a user-specific fraction of the
99 feature length. Hence, 0.5 will add half the length of the feature to the start and end coordinates.
100
101 For example:
102
103 .. code-block:: bash
104
105 $ cat A.bed
106 chr1 100 200 a1 1 +
107
108 $ bedtools shift -i A.bed -g my.genome -s 0.5 -pct
109 chr1 150 250 a1 1 +
110
111
112 ==========================================================================
113 ``-header`` Print the header for the A file before reporting results.
114 ==========================================================================
115 By default, if your A file has a header, it is ignored when reporting results.
116 This option will instead tell bedtools to first print the header for the
117 A file prior to reporting results.
118