.. _`bio/samtools/depth`: SAMTOOLS DEPTH ============== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/samtools/depth?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/samtools/depth Compute the read depth at each position or region using samtools. Example ------- This wrapper can be used in the following way: .. code-block:: python rule samtools_depth: input: bams=["mapped/A.bam", "mapped/B.bam"], bed="regionToCalcDepth.bed", # optional output: "depth.txt", log: "depth.log", params: # optional bed file passed to -b extra="", # optional additional parameters as string wrapper: "v3.0.1/bio/samtools/depth" 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` or `-o`). * For more information see, http://www.htslib.org/doc/samtools-depth.html Software dependencies --------------------- * ``samtools=1.18`` * ``snakemake-wrapper-utils=0.6.2`` Authors ------- * Dayne Filer * Filipe G. Vieira Code ---- .. code-block:: python """Snakemake wrapper for running samtools depth.""" __author__ = "Dayne L Filer" __copyright__ = "Copyright 2020, Dayne L Filer" __email__ = "dayne.filer@gmail.com" __license__ = "MIT" from snakemake.shell import shell from snakemake_wrapper_utils.samtools import get_samtools_opts samtools_opts = get_samtools_opts( snakemake, parse_write_index=False, parse_output_format=False ) extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) # check for optional bed file bed = snakemake.input.get("bed", "") if bed: bed = "-b " + bed shell("samtools depth {samtools_opts} {extra} {bed} {snakemake.input.bams} {log}") .. |nl| raw:: html