COMPLEMENTBED

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:
        "v1.9.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:
        "v1.9.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.

Software dependencies

  • bedtools=2.30

Input/Output

Input:

  • BED/GFF/VCF files
  • genome file

Output:

  • complemented BED/GFF/VCF file

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}"
)