BCFTOOLS CONCAT

Concatenate vcf/bcf files with bcftools.

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

Example

This wrapper can be used in the following way:

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

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 alllows for additional program arguments (not –threads, -o/–output, or -O/–output-type).

Software dependencies

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

Input/Output

Input:

  • vcf files

Output:

  • Concatenated VCF/BCF file

Authors

  • Johannes Köster
  • Filipe G. Vieira

Code

__author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__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 concat {bcftools_opts} {extra} {snakemake.input[0]} {log}")