SAMTOOLS CALMD

Calculates MD and NM tags. For more information see SAMtools documentation.

URL:

Example

This wrapper can be used in the following way:

rule samtools_calmd:
    input:
        aln = "{sample}.bam", # Can be 'sam', 'bam', or 'cram'
        ref = "genome.fasta"
    output:
        "{sample}.calmd.bam"
    params:
        "-E" # optional params string
    threads: 2
    wrapper:
        "v1.1.0/bio/samtools/calmd"

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.

Software dependencies

  • samtools==1.11

Authors

  • Filipe G. Vieira

Code

__author__ = "Filipe G. Vieira"
__copyright__ = "Copyright 2020, Filipe G. Vieira"
__license__ = "MIT"


from os import path
from snakemake.shell import shell

log = snakemake.log_fmt_shell(stdout=False, stderr=True)

out_name, out_ext = path.splitext(snakemake.output[0])
out_ext = out_ext[1:].upper()

shell(
    "samtools calmd --threads {snakemake.threads} {snakemake.params} --output-fmt {out_ext} {snakemake.input.aln} {snakemake.input.ref} > {snakemake.output[0]} {log}"
)