BCFTOOLS CALL

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

Call variants with bcftools call.

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

Example

This wrapper can be used in the following way:

rule bcftools_call:
    input:
        pileup="{sample}.pileup.bcf",
    output:
        calls="{sample}.calls.bcf",
    params:
        uncompressed_bcf=False,
        caller="-m",  # valid options include -c/--consensus-caller or -m/--multiallelic-caller
        extra="--ploidy 1 --prior 0.001",
    log:
        "logs/bcftools_call/{sample}.log",
    wrapper:
        "v3.4.0/bio/bcftools/call"

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.19

  • snakemake-wrapper-utils=0.6.2

Authors

  • Johannes Köster

  • Michael Hall

  • 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)


class CallerOptionError(Exception):
    pass


valid_caller_opts = {"-c", "--consensus-caller", "-m", "--multiallelic-caller"}

caller_opt = snakemake.params.get("caller", "")
if caller_opt.strip() not in valid_caller_opts:
    raise CallerOptionError(
        "bcftools call expects either -m/--multiallelic-caller or "
        "-c/--consensus-caller as caller option."
    )


shell(
    "bcftools call"
    " {bcftools_opts}"
    " {caller_opt}"
    " {extra}"
    " {snakemake.input[0]}"
    " {log}"
)