PINDEL#

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

Call variants with pindel.

URL: https://gmt.genome.wustl.edu/packages/pindel

Example#

This wrapper can be used in the following way:

pindel_types = ["D", "BP", "INV", "TD", "LI", "SI", "RP"]


rule pindel:
    input:
        ref="genome.fasta",
        # samples to call
        samples=["mapped/a.bam"],
        # bam configuration file, see http://gmt.genome.wustl.edu/packages/pindel/quick-start.html
        config="pindel_config.txt",
    output:
        expand("pindel/all_{type}", type=pindel_types),
    params:
        extra="",  # optional parameters (except -i, -f, -o, -j, -J)
    log:
        "logs/pindel.log",
    threads: 4
    wrapper:
        "v3.0.1/bio/pindel/call"


rule pindel_include_regions:
    input:
        ref="genome.fasta",
        samples=["mapped/a.bam"],
        config="pindel_config.txt",
        include_bed="regions.bed",
    output:
        expand("pindel/all_included_{type}", type=pindel_types),
    log:
        "logs/pindel_j.log",
    threads: 4
    wrapper:
        "v3.0.1/bio/pindel/call"


rule pindel_exclude_regions:
    input:
        ref="genome.fasta",
        samples=["mapped/a.bam"],
        config="pindel_config.txt",
        exclude_bed="regions.bed",
    output:
        expand("pindel/all_excluded_{type}", type=pindel_types),
    log:
        "logs/pindel_include.log",
    threads: 4
    wrapper:
        "v3.0.1/bio/pindel/call"

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#

The include and exclude BED file arguments are incompatible with each other. Either supply one of them or none of them.

Software dependencies#

  • pindel=0.2.5b9

Input/Output#

Input:

Output:

Authors#

  • Johannes Köster, Niklas Mähler

Code#

__author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"

from snakemake.shell import shell

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

include_bed = snakemake.input.get("include_bed", "")
exclude_bed = snakemake.input.get("exclude_bed", "")

if include_bed and exclude_bed:
    raise Exception("supply either include_bed or exclude_bed, not both")

if include_bed:
    include_bed = f"-j {include_bed}"

if exclude_bed:
    exclude_bed = f"-J {exclude_bed}"

output_prefix = snakemake.output[0].rsplit("_", 1)[0]

shell(
    "pindel "
    "-T {snakemake.threads} "
    "{extra} "
    "{include_bed} "
    "{exclude_bed} "
    "-i {snakemake.input.config} "
    "-f {snakemake.input.ref} "
    "-o {output_prefix} {log}"
)