Category

Genomic Interval Manipulation


Usage

bedtools slop [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> [-b or (-l and -r)]


Manual

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).

Schematic summary of the functionality

Input:                         =========     
slop (-b 5):              ~~~~~=========~~~~~
slop (-l 5):              ~~~~~=========
slop (-pct -b 0.1):           ~=========~

Required arguments

  • -i <BED/GFF/VCF>: Query bed/gff/vcf file
  • -g <GENOME>: Chromosome size file. The file should tab delimited and structured as follows: <chromName> <chromSize>.  You can get this file for the genome release that you are working with by using fetchChromSizes.
  • Slop/extension arguments: you must specify either the symmetric or asymmetric flanking arguments.
    • Symmetric flanking:
      • -b <integer>: Increase the BED/GFF/VCF entry by the same number base pairs in each direction.
    • Asymmetric flanking: Both -l and -r parameters have to be specified.
      • -l <integer>: The number of base pairs to subtract from the start coordinate.
      • -r <integer>: The number of base pairs to add to the end coordinate.

Options

  • -r INT: The number of base pairs to add to the end coordinate.
  • -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.
  • -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.
  • -header: Print the header from the input file prior to results.

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

File formats this tool works with
BEDGFFGTFVCF

Share your experience or ask a question