BCFTOOLS MERGE

Merge vcf/bcf files with bcftools.

URL: http://www.htslib.org/doc/bcftools.html#merge

Example

This wrapper can be used in the following way:

rule bcftools_merge:
    input:
        calls=["a.bcf", "b.bcf"],
    output:
        "all.bcf",
    log:
        "all.log"
    params:
        uncompressed_bcf=False,
        extra="",  # optional parameters for bcftools concat (except -o)
    wrapper:
        "v1.9.0/bio/bcftools/merge"

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

  • The uncompressed_bcf param allows to specify that a BCF output should be uncompressed (ignored otherwise).
  • The extra param allows for additional program arguments (not –threads, -o/–output, or -O/–output-type).

Software dependencies

  • bcftools=1.14
  • snakemake-wrapper-utils=0.4

Authors

  • Patrik Smeds
  • Filipe G. Vieira

Code

__author__ = "Patrik Smeds"
__copyright__ = "Copyright 2018, Patrik Smeds"
__email__ = "patrik.smeds@gmail.com"
__license__ = "MIT"


from snakemake.shell import shell
from snakemake_wrapper_utils.bcftools import get_bcftools_opts


bcftools_opts = get_bcftools_opts(snakemake, parse_ref=False, parse_memory=False)
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)

shell("bcftools merge {bcftools_opts} {extra} {snakemake.input} {log}")