BCFTOOLS STATS

Generate VCF stats using bcftools stats.

URL: https://github.com/samtools/bcftools

Example

This wrapper can be used in the following way:

rule bcf_stats:
    input:
        "{prefix}"
    output:
        "{prefix}.stats.txt"
    log:
        "{prefix}.bcftools.stats.log"
    params:
        ""
    wrapper:
        "v1.2.0/bio/bcftools/stats"

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

  • bcftools==1.12

Input/Output

Input:

  • BCF, VCF, or VCF.gz input

Output:

  • stats text file

Authors

  • William Rowell

Code

__author__ = "William Rowell"
__copyright__ = "Copyright 2020, William Rowell"
__email__ = "wrowell@pacb.com"
__license__ = "MIT"


from snakemake.shell import shell

# bcftools takes additional decompression threads through --threads
# Other threads are *additional* threads passed to the '--threads' argument
threads = (
    "" if snakemake.threads <= 1 else " --threads {} ".format(snakemake.threads - 1)
)
log = snakemake.log_fmt_shell(stdout=False, stderr=True)

shell(
    "bcftools stats {threads} {snakemake.params} {snakemake.input} > {snakemake.output} {log}"
)