TRIMMOMATIC

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

trimmomatic for illumina data.

URL: http://www.usadellab.org/cms/?page=trimmomatic

Example

This wrapper can be used in the following way:


test/Snakefile not found.

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.

Input/Output

Input:

  • data: input fastq (list)

  • trimmomatic: trimmomatic jar.

  • adpaters: adapter file.

  • java: java cmd path. (optional)

Output:

  • outfiles: 4 files or 1 file, list.

Params

  • extras: extra arguments to fastqc. (optional)

Authors

  • yangqun

Code

# trimmomatic wrapper
__author__ = "yangqun"

import sys
import os
from snakemake.shell import shell

# arguments.
for tag in ['data', 'trimmomatic', 'adapters']:
    assert tag in snakemake.input.keys()

data = snakemake.input.get('data')
trimmomatic = snakemake.input.get('trimmomatic')
adapters = snakemake.input.get('adapters')

java = snakemake.input.get('java', 'java')
extras = snakemake.params.get('extras', '')

assert 'outfiles' in snakemake.output.keys()
outfiles = snakemake.output.get('outfiles')

# PE or SE
if len(data) not in [1, 2]:
    sys.exit("input data must be SE or PE. got {} files.".format(len(data)))
elif len(data) == 1:
    if len(outfiles) != 1:
        sys.exit("Got SE data, but outfiles is no 1.")
    else:
        mode = "SE"
elif len(data) == 2:
    if len(outfiles) != 4:
        sys.exit("Got PE data, but outfiles is no 4.")
    else:
        mode = "PE"

shell(
    "{java} -jar {trimmomatic} {mode} {data} {outfiles} {extras} "
    "ILLUMINACLIP:{adapters}:2:30:10:2:True SLIDINGWINDOW:4:15 LEADING:3 TRAILING:3 MINLEN:36"
)