BCFTOOLS MERGE

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

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"],
        idx=["a.bcf.csi", "b.bcf.csi"],
    output:
        "all.bcf",
    log:
        "all.log",
    params:
        uncompressed_bcf=False,
        extra="",  # optional parameters for bcftools concat (except -o)
    wrapper:
        "v3.10.2/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.20

  • snakemake-wrapper-utils=0.6.2

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.calls} {log}")