SAMTOOLS MERGE

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

Merge two bam files with samtools.

Example

This wrapper can be used in the following way:

rule samtools_merge:
    input:
        ["mapped/A.bam", "mapped/B.bam"],
    output:
        "merged.bam",
    log:
        "merged.log",
    params:
        extra="",  # optional additional parameters as string
    threads: 8
    wrapper:
        "v3.7.0/bio/samtools/merge"

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:

  • list of bam files to merge

Output:

  • merged bam file

Authors

  • Johannes Köster

  • Filipe G. Vieira

Code

__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.samtools import get_samtools_opts

samtools_opts = get_samtools_opts(snakemake)
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)

shell("samtools merge {samtools_opts} {extra} {snakemake.input} {log}")