.. _`bio/bcftools/index`: BCFTOOLS INDEX ============== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/bcftools/index?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/bcftools/index Index vcf/bcf file. **URL**: http://www.htslib.org/doc/bcftools.html#index Example ------- This wrapper can be used in the following way: .. code-block:: python rule bcftools_index: input: "a.bcf", output: "a.bcf.csi", log: "index/a.log", params: extra="", # optional parameters for bcftools index wrapper: "v3.0.1/bio/bcftools/index" 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 `extra` param allows for additional program arguments (not `--threads`, `-o/--output`). Software dependencies --------------------- * ``bcftools=1.18`` * ``snakemake-wrapper-utils=0.6.2`` Authors ------- * Jan Forster * Filipe G. Vieira Code ---- .. code-block:: python __author__ = "Johannes Köster" __copyright__ = "Copyright 2016, Johannes Köster" __email__ = "koester@jimmy.harvard.edu" __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_output_format=False, parse_memory=False ) extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) if "--tbi" in extra or "--csi" in extra: raise ValueError( "You have specified index format (`--tbi/--csi`) in `params.extra`; this is automatically infered from the first output file." ) if snakemake.output[0].endswith(".tbi"): extra += " --tbi" elif snakemake.output[0].endswith(".csi"): extra += " --csi" else: raise ValueError("invalid index file format ('.tbi', '.csi').") shell("bcftools index {bcftools_opts} {extra} {snakemake.input[0]} {log}") .. |nl| raw:: html