BGZIP

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

Block compression/decompression utility

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

Example

This wrapper can be used in the following way:

rule bgzip:
    input:
        "{prefix}.vcf",
    output:
        "{prefix}.vcf.gz",
    params:
        extra="", # optional
    threads: 1
    log:
        "logs/bgzip/{prefix}.log",
    wrapper:
        "v9.4.1/bio/bgzip"

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

  • Run mode (compression/decompression) is automatically inferred from the extension of the input file.

Software dependencies

  • htslib=1.23.1

Input/Output

Input:

  • file to be compressed or decompressed

Output:

  • compressed or decompressed output

Params

  • extra: additional bgzip parameters

Authors

  • William Rowell

  • Filipe G. Vieira

Code

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


from snakemake.shell import shell

extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)


if snakemake.input[0].endswith(".gz"):
    extra += " --decompress"


shell(
    "bgzip --threads {snakemake.threads} {extra} --output {snakemake.output[0]} {snakemake.input[0]} {log}"
)