DEEPTOOLS ALIGNMENT-SIEVE

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

filters/shift alignments in a BAM/CRAM file according the the specified parameters. It can optionally output to BEDPE format.

URL: https://deeptools.readthedocs.io/en/develop/content/tools/alignmentSieve.html

Example

This wrapper can be used in the following way:

rule test_deeptools_alignment_sieve:
    input:
        aln="a.bam",
    output:
        "filtered.bam",
    threads: 1
    log:
        "logs/deeptools.log",
    params:
        extra="",
    wrapper:
        "v3.9.0/bio/deeptools/alignmentsieve"

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

Input/output formats are automatically detected.

Software dependencies

  • deeptools=3.5.5

Input/Output

Input:

  • aln: Path to BAM/CRAM formatted alignments. Bam filesm ust be indexed.

Output:

  • Path to filtered bam alignments or bedpe intervals.

Params

  • extra: Optional arguments for alignmentSieve.py

Authors

  • Thibault Dayris

Code

__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2023, Thibault Dayris"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"

from snakemake.shell import shell


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

blacklist = snakemake.input.get("blacklist", "")
if blacklist:
    extra += f" --blackListFileName {blacklist} "

out_file = snakemake.output[0]
if out_file.endswith(".bed"):
    extra += " --BED "

shell(
    "alignmentSieve "
    "{extra} "
    "--numberOfProcessors {snakemake.threads} "
    "--bam {snakemake.input.aln} "
    "--outFile {out_file} "
    "{log} "
)