BAMTOOLS SPLIT

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

Split bam file into sub files, default by reference

URL: https://github.com/pezmaster31/bamtools

Example

This wrapper can be used in the following way:

rule bamtools_split:
    input:
        "mapped/{sample}.bam",
    output:
        "mapped/{sample}.REF_xx.bam",
    params:
        extra="-reference",
    log:
        "logs/bamtoos_split/{sample}.log",
    wrapper:
        "v3.8.0-1-g149ef14/bio/bamtools/split"

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

A complete usage documentation is available here: https://raw.githubusercontent.com/wiki/pezmaster31/bamtools/Tutorial_Toolkit_BamTools-1.0.pdf

This tool/wrapper does not handle multi threading

Software dependencies

  • bamtools=2.5.2

Input/Output

Input:

  • bam file, this must be the only file in input.

Output:

  • multiple bam file multiple formats.

Params

  • extra: Optional parameters

Authors

  • Patrik Smeds

Code

__author__ = "Patrik Smeds"
__copyright__ = "Copyright 2021, Patrik Smeds"
__email__ = "patrik.smeds@scilifelab.uu.se"
__license__ = "MIT"


from snakemake.shell import shell

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

extra = snakemake.params.get("extra", "")

if len(snakemake.input) != 1:
    raise ValueError("One bam input file expected, got: " + str(len(snakemake.input)))

shell("bamtools split -in {snakemake.input} {extra} {log}")