COMPLEMENTBED

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

Maps all regions of the genome which are not covered by the input.

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

Example

This wrapper can be used in the following way:

rule bedtools_complement_bed:
    input:
        in_file="a.bed",
        genome="dummy.genome"
    output:
        "results/bed-complement/a.complement.bed"
    params:
        ## Add optional parameters
        extra="-L"
    log:
        "logs/a.complement.bed.log"
    wrapper:
        "v3.7.0/bio/bedtools/complement"

rule bedtools_complement_vcf:
    input:
        in_file="a.vcf",
        genome="dummy.genome"
    output:
        "results/vcf-complement/a.complement.vcf"
    params:
        ## Add optional parameters
        extra="-L"
    log:
        "logs/a.complement.vcf.log"
    wrapper:
        "v3.7.0/bio/bedtools/complement"

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

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

Software dependencies

  • bedtools=2.31.1

Input/Output

Input:

  • in_file: interval files (BED/GFF/VCF)

  • genome: genome file

Output:

  • complemented BED/GFF/VCF file

Params

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

Authors

  • Antonie Vietor

Code

__author__ = "Antonie Vietor"
__copyright__ = "Copyright 2020, Antonie Vietor"
__email__ = "antonie.v@gmx.de"
__license__ = "MIT"

from snakemake.shell import shell

extra = snakemake.params.get("extra", "")

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

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