.. _`bio/benchmark/chm-eval-sample`: CHM-EVAL-SAMPLE =============== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/benchmark/chm-eval-sample?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/benchmark/chm-eval-sample Download CHM-eval sample for benchmarking variant calling. **URL**: https://github.com/lh3/CHM-eval Example ------- This wrapper can be used in the following way: .. code-block:: python rule chm_eval_sample: output: bam="resources/chm-eval-sample.bam", bai="resources/chm-eval-sample.bam.bai" params: # Optionally only grab the first 100 records. # This is for testing, remove next line to grab all records. first_n=100 log: "logs/chm-eval-sample.log" wrapper: "v3.0.1/bio/benchmark/chm-eval-sample" 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. Software dependencies --------------------- * ``samtools=1.18`` * ``curl`` Params ------ * ``first_n``: Optional parameter for grab only the first `n` elements. Authors ------- * Johannes Köster Code ---- .. code-block:: python __author__ = "Johannes Köster" __copyright__ = "Copyright 2020, Johannes Köster" __email__ = "johannes.koester@uni-due.de" __license__ = "MIT" from snakemake.shell import shell log = snakemake.log_fmt_shell(stdout=False, stderr=True) url = "ftp://ftp.sra.ebi.ac.uk/vol1/run/ERR134/ERR1341796/CHM1_CHM13_2.bam" pipefail = "" fmt = "-b" prefix = snakemake.params.get("first_n", "") if prefix: prefix = "| head -n {} | samtools view -h -b".format(prefix) fmt = "-h" pipefail = "set +o pipefail" shell( """ {pipefail} {{ samtools view {fmt} {url} {prefix} > {snakemake.output.bam} samtools index {snakemake.output.bam} }} {log} """ ) else: shell( """ {{ curl -L {url} > {snakemake.output.bam} samtools index {snakemake.output.bam} }} {log} """ ) .. |nl| raw:: html