TADPOLE

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

Run Tadpole.

URL: https://jgi.doe.gov/data-and-tools/software-tools/bbtools/bb-tools-user-guide/tadpole-guide/

Example

This wrapper can be used in the following way:

rule tadpole_correct_se:
    input:
        sample=["reads/se/{sample}.fastq"],
    output:
        out="out/correct_se/{sample}.fastq.gz",
        discarded="out/correct_se/{sample}.discarded.fastq.gz",
    log:
        "logs/correct_se/{sample}.log",
    params:
        mode="correct",
        extra="",
    threads: 2
    resources:
        mem_mb=1024,
    wrapper:
        "v1.25.0/bio/bbtools/tadpole"


rule tadpole_correct_pe:
    input:
        sample=["reads/pe/{sample}.1.fastq", "reads/pe/{sample}.2.fastq"],
    output:
        out=["out/correct_pe/{sample}.1.fastq", "out/correct_pe/{sample}.2.fastq"],
        discarded="out/correct_pe/{sample}.discarded.fastq",
    log:
        "logs/correct_pe/{sample}.log",
    params:
        mode="correct",
        extra="",
    threads: 2
    resources:
        mem_mb=1024,
    wrapper:
        "v1.25.0/bio/bbtools/tadpole"


rule tadpole_extend_se:
    input:
        sample=["reads/se/{sample}.fastq"],
    output:
        out="out/extend_se/{sample}.fastq.gz",
        discarded="out/extend_se/{sample}.discarded.fastq.gz",
    log:
        "logs/extend_se/{sample}.log",
    params:
        mode="extend",
        extra="",
    threads: 2
    resources:
        mem_mb=1024,
    wrapper:
        "v1.25.0/bio/bbtools/tadpole"


rule tadpole_extend_pe:
    input:
        sample=["reads/pe/{sample}.1.fastq", "reads/pe/{sample}.2.fastq"],
    output:
        out=["out/extend_pe/{sample}.1.fastq", "out/extend_pe/{sample}.2.fastq"],
        discarded="out/extend_pe/{sample}.discarded.fastq",
    log:
        "logs/extend_pe/{sample}.log",
    params:
        mode="extend",
        extra="",
    threads: 2
    resources:
        mem_mb=1024,
    wrapper:
        "v1.25.0/bio/bbtools/tadpole"

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 java_opts param allows for additional arguments to be passed to the java compiler, e.g. -XX:ParallelGCThreads=10 (not for -XmX or -Djava.io.tmpdir, since they are handled automatically).

Software dependencies

  • bbmap=39.01
  • python=3.11.0
  • snakemake-wrapper-utils=0.5.2

Input/Output

Input:

  • sample: list of R1 and (if PE) R2 fastq file(s)
  • extra: kmer data, but not for error-correction or extension (optional)

Output:

  • trimmed: trimmed fastq file with R1 reads, trimmed fastq file with R2 reads (PE only, optional)
  • discarded: fastq file with discarded reads (optional)

Params

  • mode: Run mode (one of contig, extend, correct, insert, or discard; mandatory)
  • extra: additional program arguments

Authors

  • Filipe G. Vieira

Code

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


from snakemake.shell import shell
from snakemake_wrapper_utils.java import get_java_opts


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


assert snakemake.params.mode in ["contig", "extend", "correct", "insert", "discard"]


n = len(snakemake.input.sample)
assert (
    n == 1 or n == 2
), "input->sample must have 1 (single-end) or 2 (paired-end) elements."

if n == 1:
    reads = "in={}".format(snakemake.input.sample)
    out = "out={}".format(snakemake.output.out)
else:
    reads = "in={} in2={}".format(*snakemake.input.sample)
    out = "out={} out2={}".format(*snakemake.output.out)


in_extra = snakemake.input.get("extra", "")
if in_extra:
    reads += f" extra={in_extra}"


discarded = snakemake.output.get("discarded", "")
if discarded:
    out += f" outd={discarded}"


shell(
    "tadpole.sh {java_opts}"
    " threads={snakemake.threads}"
    " mode={snakemake.params.mode}"
    " {reads}"
    " {extra}"
    " {out}"
    " {log}"
)