TRIM_GALORE-SE¶
Trim unpaired reads using trim_galore.
Example¶
This wrapper can be used in the following way:
rule trim_galore_se:
input:
"reads/{sample}.fastq.gz",
output:
"trimmed/{sample}_trimmed.fq.gz",
"trimmed/{sample}.fastq.gz_trimming_report.txt",
params:
extra="--illumina -q 20",
log:
"logs/trim_galore/{sample}.log",
wrapper:
"v1.19.1/bio/trim_galore/se"
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¶
- It is expected that the fastqc Snakemake wrapper be used in place of the –fastqc option.
- All output files must be placed in the same directory.
Software dependencies¶
trim-galore==0.6.6
Input/Output¶
Input:
- fastq file with untrimmed reads (can be gzip compressed)
Output:
- trimmed fastq file
- trimming report
Params¶
extra
: additional parameters
Authors¶
- Kerrin Mendler
Code¶
"""Snakemake wrapper for trimming unpaired reads using trim_galore."""
__author__ = "Kerrin Mendler"
__copyright__ = "Copyright 2018, Kerrin Mendler"
__email__ = "mendlerke@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
import os.path
log = snakemake.log_fmt_shell()
# Don't run with `--fastqc` flag
if "--fastqc" in snakemake.params.get("extra", ""):
raise ValueError(
"The trim_galore Snakemake wrapper cannot "
"be run with the `--fastqc` flag. Please "
"remove the flag from extra params. "
"You can use the fastqc Snakemake wrapper on "
"the input and output files instead."
)
# Check that two output files were supplied
m = len(snakemake.output)
assert m == 2, "Output must contain 2 files. Given: %r." % m
# Check that all output files are in the same directory
out_dir = os.path.dirname(snakemake.output[0])
for file_path in snakemake.output[1:]:
assert out_dir == os.path.dirname(file_path), (
"trim_galore can only output files to a single directory."
" Please indicate only one directory for the output files."
)
shell(
"(trim_galore"
" {snakemake.params.extra}"
" -o {out_dir}"
" {snakemake.input})"
" {log}"
)