BCFTOOLS NORM

Left-align and normalize indels, check if REF alleles match the reference, split multiallelic sites into multiple rows; recover multiallelics from multiple rows. For more information see BCFtools documentation.

URL:

Example

This wrapper can be used in the following way:

rule norm_vcf:
    input:
        "{prefix}.bcf",
    output:
        "{prefix}.norm.vcf",
    log:
        "{prefix}.norm.log",
    params:
        extra="--rm-dup none",  # optional
    wrapper:
        "v1.2.0/bio/bcftools/norm"

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.11
  • snakemake-wrapper-utils=0.2

Authors

  • Dayne Filer
  • Filipe G. Vieira

Code

__author__ = "Dayne Filer"
__copyright__ = "Copyright 2019, Dayne Filer"
__email__ = "dayne.filer@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_memory=False, parse_temp_dir=False)
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)


shell(
    "bcftools norm {bcftools_opts} {extra} {snakemake.input[0]} -o {snakemake.output[0]} {log}"
)