SAMTOOLS IDXSTATS

https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/samtools/idxstats?label=version%20update%20pull%20requests

Use samtools to retrieve and print stats from indexed BAM, SAM or CRAM files.

Example

This wrapper can be used in the following way:

rule samtools_idxstats:
    input:
        bam="mapped/{sample}.bam",
        idx="mapped/{sample}.bam.bai",
    output:
        "mapped/{sample}.bam.idxstats",
    log:
        "logs/samtools/idxstats/{sample}.log",
    params:
        extra="",  # optional params string
    wrapper:
        "v3.8.0-49-g6f33607/bio/samtools/idxstats"

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

Software dependencies

  • samtools=1.19.2

  • snakemake-wrapper-utils=0.6.2

Input/Output

Input:

  • indexed SAM, BAM or CRAM file (.SAM, .BAM, .CRAM)

  • corresponding index files

Output:

  • idxstat file (.idxstats)

Authors

  • Antonie Vietor

  • Filipe G. Vieira

Code

__author__ = "Antonie Vietor"
__copyright__ = "Copyright 2020, Antonie Vietor"
__email__ = "antonie.v@gmx.de"
__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=False, parse_output_format=False
)
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=False, stderr=True)

shell(
    "samtools idxstats {samtools_opts} {extra} {snakemake.input.bam} > {snakemake.output[0]} {log}"
)