.. _`bio/bcftools/sort`: BCFTOOLS SORT ============= .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/bcftools/sort?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/bcftools/sort Sort vcf/bcf file. **URL**: http://www.htslib.org/doc/bcftools.html#sort Example ------- This wrapper can be used in the following way: .. code-block:: python rule bcftools_sort: input: "{sample}.bcf", output: "{sample}.sorted.bcf", log: "logs/bcftools/sort/{sample}.log", params: # Set to True, in case you want uncompressed BCF output uncompressed_bcf=False, # Extra arguments extras="", resources: mem_mb=8000, wrapper: "v3.0.1/bio/bcftools/sort" Note that input, output and log file paths can be chosen freely. When running with .. code-block:: bash 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`, `-O/--output-type`, `-m/--max-mem`, or `-T/--temp-dir`). Software dependencies --------------------- * ``bcftools=1.18`` * ``snakemake-wrapper-utils=0.6.2`` Authors ------- * Filipe G. Vieira Code ---- .. code-block:: python __author__ = "Filipe G. Vieira" __copyright__ = "Copyright 2020, Filipe G. Vieira" __license__ = "MIT" import tempfile from snakemake.shell import shell from snakemake_wrapper_utils.bcftools import get_bcftools_opts bcftools_opts = get_bcftools_opts(snakemake, parse_ref=False) extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) with tempfile.TemporaryDirectory() as tmpdir: shell( "bcftools sort" " {bcftools_opts}" " {extra}" " --temp-dir {tmpdir}" " {snakemake.input[0]}" " {log}" ) .. |nl| raw:: html