Read processing and trimming
Remove adapter contamination and low-quality sequence before de novo assembly. Three supported strategies are presented: illumiprocessor, Trim Galore and Trimmomatic. Any of the three can be used, provided the cleaned reads are standardized into the directory structure expected by PHYLUCE.
Objective
The goal is to produce cleaned paired-end reads while preserving valid read pairs, retaining useful singleton reads when appropriate, and removing adapter contamination and low-quality sequence that can compromise downstream assembly.
PHYLUCE 1.7.3 allows reads to be cleaned using any software. However, the assembly
wrappers expect the cleaned data to follow the same naming and directory structure
produced by illumiprocessor.
1. Choose a trimming strategy
| Option | Best use | Important point |
|---|---|---|
| A. illumiprocessor | Most direct route into the standard PHYLUCE workflow. | Wraps Trimmomatic and automatically generates PHYLUCE-compatible output directories. |
| B. Trim Galore | Simple modern trimming with automatic adapter handling and paired-end validation. | Outputs must be renamed and reorganized before PHYLUCE assembly. |
| C. Trimmomatic | Fine control over adapter removal, quality trimming and minimum read length. | illumiprocessor itself uses Trimmomatic; direct use requires manual output organization. |
Use only one of these routes for a given analysis unless you are explicitly comparing trimming strategies. Do not sequentially trim the same reads with all three programs.
2. Common project variables
PROJECT="/path/to/my_UCE_project" READS="$PROJECT/raw_reads" CLEAN="$PROJECT/clean_reads" THREADS=8 mkdir -p "$CLEAN"
Adjust PROJECT, READS and THREADS to your
dataset and computer. Adapter sequences and trimming thresholds should reflect the
actual library preparation and sequencing platform rather than being copied blindly.
Option A — illumiprocessor
This is the most direct route for users who want to follow the standard PHYLUCE workflow. illumiprocessor batch-processes Illumina reads, runs Trimmomatic internally, renames samples and creates the exact directory structure expected downstream.
Activate the PHYLUCE 1.7.3 environment
conda activate phyluce-1.7.3 illumiprocessor --version illumiprocessor --help
On Apple Silicon, activate the x86 environment created in Module 01 instead:
phyluce-1.7.3-x86.
Create the configuration file
illumiprocessor uses an INI-style configuration file. The exact adapter and index sequences depend on your library design. The general structure is:
[adapters] i7:<adapter structure for read/index 1> i5:<adapter structure for read/index 2, when applicable> [tag sequences] sample01:<index sequence> sample02:<index sequence> [tag map] <original sample/index identifier 1>:sample01 <original sample/index identifier 2>:sample02 [names] <original sample/index identifier 1>:sample01 <original sample/index identifier 2>:sample02
The configuration depends on the library preparation, indexing strategy and adapters used for your sequencing run. Use the library documentation and the official illumiprocessor configuration guide to construct this file.
Save the configuration, for example, as:
ILLUMICONF="$PROJECT/illumiprocessor.conf"
Run illumiprocessor
illumiprocessor \ --input "$READS" \ --output "$CLEAN" \ --config "$ILLUMICONF" \ --cores "$THREADS"
The resulting sample structure is:
clean_reads/
└── sample01/
├── adapters.fasta
├── raw-reads/
│ ├── sample01-READ1.fastq.gz
│ └── sample01-READ2.fastq.gz
├── split-adapter-quality-trimmed/
│ ├── sample01-READ1.fastq.gz
│ ├── sample01-READ2.fastq.gz
│ └── sample01-READ-singleton.fastq.gz
└── stats/
└── sample01-adapter-contam.txt
No additional renaming or directory restructuring is required before using
phyluce_assembly_assemblo_spades.
Option B — Trim Galore
Trim Galore provides a simple paired-end interface for adapter and quality trimming. The current v2 series is a standalone implementation and retains the familiar Trim Galore command-line interface.
Create a separate environment
conda create -n uce-trimgalore \ -c conda-forge \ -c bioconda \ trim-galore=2.3.0 conda activate uce-trimgalore trim_galore --version
Run one paired-end sample
SAMPLE="sample01"
R1="$READS/${SAMPLE}_R1.fastq.gz"
R2="$READS/${SAMPLE}_R2.fastq.gz"
OUT="$PROJECT/trim_galore/$SAMPLE"
mkdir -p "$OUT"
trim_galore \
--paired \
--retain_unpaired \
--quality 20 \
--output_dir "$OUT" \
"$R1" "$R2"Trim Galore v2.3.0 defaults to Phred+33 for modern Illumina data and can auto-detect standard adapter classes. If your library uses a known custom adapter, specify it explicitly rather than relying on auto-detection.
NextSeq, NovaSeq and related two-colour systems can generate poly-G artefacts.
Consult the current Trim Galore documentation for --2colour and
poly-G handling when appropriate for your sequencing platform.
Convert Trim Galore output to PHYLUCE structure
The paired Trim Galore output must be placed in the directory and naming convention expected by PHYLUCE.
DEST="$CLEAN/$SAMPLE/split-adapter-quality-trimmed"
mkdir -p "$DEST"
cp "$OUT/${SAMPLE}_R1_val_1.fq.gz" \
"$DEST/${SAMPLE}-READ1.fastq.gz"
cp "$OUT/${SAMPLE}_R2_val_2.fq.gz" \
"$DEST/${SAMPLE}-READ2.fastq.gz"
When --retain_unpaired produces surviving singleton reads, combine
the unpaired R1 and R2 reads into the single singleton file expected by PHYLUCE:
gzip -cd \
"$OUT/${SAMPLE}_R1_unpaired_1.fq.gz" \
"$OUT/${SAMPLE}_R2_unpaired_2.fq.gz" \
| gzip -c \
> "$DEST/${SAMPLE}-READ-singleton.fastq.gz"Option C — Trimmomatic
Trimmomatic provides direct control over adapter clipping, quality trimming, read-length filtering and paired/unpaired outputs. Current Trimmomatic releases support paired-end Illumina FASTQ data directly.
Create a separate environment
conda create -n uce-trimmomatic \ -c conda-forge \ -c bioconda \ trimmomatic=0.41 conda activate uce-trimmomatic trimmomatic -version
Run one paired-end sample
SAMPLE="sample01"
R1="$READS/${SAMPLE}_R1.fastq.gz"
R2="$READS/${SAMPLE}_R2.fastq.gz"
OUT="$PROJECT/trimmomatic/$SAMPLE"
mkdir -p "$OUT"
trimmomatic PE \
-threads "$THREADS" \
"$R1" \
"$R2" \
"$OUT/${SAMPLE}_R1_paired.fastq.gz" \
"$OUT/${SAMPLE}_R1_unpaired.fastq.gz" \
"$OUT/${SAMPLE}_R2_paired.fastq.gz" \
"$OUT/${SAMPLE}_R2_unpaired.fastq.gz" \
ILLUMINACLIP:/path/to/adapters.fasta:2:30:10 \
SLIDINGWINDOW:4:20 \
MINLEN:36Adapter files and trimming thresholds must be justified by the sequencing library, read length and QC profile. The current Trimmomatic documentation explicitly notes that trimming is not one-size-fits-all.
Convert Trimmomatic output to PHYLUCE structure
DEST="$CLEAN/$SAMPLE/split-adapter-quality-trimmed"
mkdir -p "$DEST"
cp "$OUT/${SAMPLE}_R1_paired.fastq.gz" \
"$DEST/${SAMPLE}-READ1.fastq.gz"
cp "$OUT/${SAMPLE}_R2_paired.fastq.gz" \
"$DEST/${SAMPLE}-READ2.fastq.gz"
gzip -cd \
"$OUT/${SAMPLE}_R1_unpaired.fastq.gz" \
"$OUT/${SAMPLE}_R2_unpaired.fastq.gz" \
| gzip -c \
> "$DEST/${SAMPLE}-READ-singleton.fastq.gz"3. Required final structure
Regardless of the trimming program used, the cleaned data should be normalized to the following structure before entering the PHYLUCE assembly module:
clean_reads/ ├── sample01/ │ └── split-adapter-quality-trimmed/ │ ├── sample01-READ1.fastq.gz │ ├── sample01-READ2.fastq.gz │ └── sample01-READ-singleton.fastq.gz │ ├── sample02/ │ └── split-adapter-quality-trimmed/ │ ├── sample02-READ1.fastq.gz │ ├── sample02-READ2.fastq.gz │ └── sample02-READ-singleton.fastq.gz │ └── ...
This normalization is essential because PHYLUCE assembly wrappers assume this directory and filename convention.
4. Repeat quality control after trimming
After cleaning the reads, repeat FastQC and MultiQC using the same approach described in Module 03. The comparison between raw and cleaned reads should confirm that adapter contamination and poor-quality sequence were reduced without excessive loss of data.
conda activate uce-qc QC_CLEAN="$PROJECT/qc/clean" mkdir -p "$QC_CLEAN" find "$CLEAN" \ -type f \ \( -name "*-READ1.fastq.gz" -o -name "*-READ2.fastq.gz" \) \ -print0 | xargs -0 fastqc \ --threads "$THREADS" \ --outdir "$QC_CLEAN" multiqc "$QC_CLEAN" \ --outdir "$QC_CLEAN/multiqc" \ --title "UCE cleaned reads"
5. Which option should you use?
| Situation | Suggested route |
|---|---|
| You want maximum compatibility with the standard PHYLUCE workflow. | illumiprocessor |
| You want a simple modern tool with minimal setup. | Trim Galore |
| You need explicit control over each trimming operation. | Trimmomatic |
For this tutorial, subsequent modules will assume only that the final cleaned reads have been placed in the standard PHYLUCE directory structure. The downstream workflow therefore remains independent of the trimming software chosen here.
6. Pre-flight check
References and official documentation
PHYLUCE 1.7.3 — Quality Control and read trimming
illumiprocessor — official documentation
illumiprocessor — source repository
Trim Galore — official documentation
Trimmomatic — official source and documentation
Software citations
Faircloth BC. illumiprocessor: a Trimmomatic wrapper for parallel adapter and quality trimming. DOI: 10.6079/J9ILL.
Bolger AM, Lohse M, Usadel B. 2014. Trimmomatic: a flexible trimmer for Illumina sequence data. Bioinformatics 30:2114–2120. doi:10.1093/bioinformatics/btu170
For Trimmomatic v0.40 and later, also consult the current Trimmomatic project citation guidance for the updated software publication.