Reference Code backup Executable files
Add requested base pairs of slop to each feature
bedtools slop [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-b or (-l and -r)]
This tool is part of the bedtools
suite and it's also known as slopBed
.
bedtools slop
will increase the size of each feature in a feature file by a user-defined number of bases. While something like this could be done with
awk '{OFS="\t" print $1,$2-<slop>,$3+<slop>}'
bedtools slop
will restrict the resizing to the size of the chromosome (i.e. no start < 0 and no end > chromosome size).
Input: ========= slop (-b 5
): ~~~~~=========~~~~~ slop (-l 5
): ~~~~~========= slop (-pct-b 0.1
): ~=========~
fetchChromSizes
.Options
-l 500
for a negative-stranded feature, it will add 500 bp to the end coordinate.-l 0.50
, will add 500 bp upstream.Examples
By default, bedtools slop
will either add a fixed number of bases in each direction (-b) or an asymmetric number of bases in each direction with -l and -r.
$ cat A.bed chr1 5 100 chr1 800 980 $ cat my.genome chr1 1000 $ bedtools slop-i A.bed
-g my.genome
-b 5
chr1 0 105 chr1 795 985 $ bedtools slop-i A.bed
-g my.genome
-l 2
-r 3
chr1 3 103 chr1 798 983
However, if the requested number of bases exceeds the boundaries of the chromosome, bedtools slop
will clip the feature accordingly.
$ cat A.bed chr1 5 100 chr1 800 980 $ cat my.genome chr1 1000 $ bedtools slop-i A.bed
-g my.genome
-b 5000
chr1 0 1000 chr1 0 1000