SLOPBED

https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/bedtools/slop?label=version%20update%20pull%20requests

Increase the size of each feature in a BED/BAM/VCF by a specified factor.

URL: https://bedtools.readthedocs.io/en/latest/content/tools/slop.html

Example

This wrapper can be used in the following way:

rule bedtools_merge:
    input:
        "A.bed"
    output:
        "A.slop.bed"
    params:
        ## Genome file, tab-seperated file defining the length of every contig
        genome="genome.txt",
        ## Add optional parameters
        extra = "-b 10" ## in this example, we want to increase the feature by 10 bases to both sides
    log:
        "logs/slop/A.log"
    wrapper:
        "v3.10.2-32-gf4e5b66/bio/bedtools/slop"

Note that input, output and log file paths can be chosen freely.

When running with

snakemake --use-conda

the software dependencies will be automatically deployed into an isolated environment before execution.

Notes

  • Extra parameters requires either -b or (-l and -r)

  • This program/wrapper does not handle multi-threading.

Software dependencies

  • bedtools=2.31.1

Input/Output

Input:

  • Path to an interval file (BED/GFF/VCF)

Output:

  • Path to the expanded intervals file

Params

  • genome: Path to a genome file

  • extra: additional program arguments (except for -i or -g)

Authors

  • Jan Forster

Code

__author__ = "Jan Forster"
__copyright__ = "Copyright 2019, Jan Forster"
__email__ = "j.forster@dkfz.de"
__license__ = "MIT"

from snakemake.shell import shell

## Extract arguments
extra = snakemake.params.get("extra", "")

log = snakemake.log_fmt_shell(stdout=True, stderr=True)

shell(
    "(bedtools slop"
    " {extra}"
    " -i {snakemake.input[0]}"
    " -g {snakemake.params.genome}"
    " > {snakemake.output})"
    " {log}"
)