BAMTOBED

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

Conversion utility that converts sequence alignments in BAM format into BED, BED12, and/or BEDPE records.

URL: https://bedtools.readthedocs.io/en/latest/content/tools/bamtobed.html

Example

This wrapper can be used in the following way:

rule bamtobed:
    input:
        "{sample}.bam",
    output:
        "{sample}.bed",
    log:
        "logs/bamtobed/{sample}.log",
    params:
        extra="-bedpe",  # optional parameters
    wrapper:
        "v3.10.2-32-gf4e5b66/bio/bedtools/bamtobed"

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

  • This program/wrapper does not handle multi-threading.

Software dependencies

  • bedtools=2.31.1

Input/Output

Input:

  • BAM file, this must be the first file in the input file list

Output:

  • BED file, this must be the first file in the output file list

Params

  • extra: additional program arguments (except -i)

Authors

  • Filipe G. Vieira

Code

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


from snakemake.shell import shell


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


shell(
    "(bamToBed"
    " {extra}"
    " -i {snakemake.input[0]}"
    " > {snakemake.output[0]}"
    ") {log}"
)