BCFTOOLS FIXPLOIDY

https://img.shields.io/badge/wrapper_version-v9.8.0-10785b https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/bcftools/fixploidy?label=version%20update%20pull%20requests&color=1cb481

Set correct ploidy on variants calls

URL: https://samtools.github.io/bcftools/bcftools.html

Example

This wrapper can be used in the following way:

rule test_bcftools_fixploidy:
    input:
        "a.bcf",
    output:
        "a.fixed.bcf",
    log:
        "test_bcftools_fixploidy.log",
    threads: 3
    params:
        extra="",
    wrapper:
        "v9.8.0/bio/bcftools/fixploidy"

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

This wrapper requires additional threads for IO compression.

Software dependencies

  • bcftools=1.23.1

  • snakemake-wrapper-utils=0.8.0

Input/Output

Input:

  • Path to variants file (VCF/VCF.GZ/BCF)

Output:

  • Path to corrected variants file (VCF/BCF/VCF.GZ)

Params

  • extra: Optional parameters besides IO and their formats.

Authors

Code

__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2026, Thibault Dayris"
__email__ = "thibault.dayris@gustaveroussy.fr"
__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 plugin fixploidy {bcftools_opts} {snakemake.input[0]} -- {extra} {log}")