Organizing FASTQ files
Prepare demultiplexed paired-end Illumina reads for the UCE workflow. Before trimming or assembly, we will verify the input files, sample identifiers, paired-read structure and project organization.
Objective
At the end of this module, you should have a clearly identified directory containing the original sequencing reads, a consistent set of sample identifiers, and confirmation that each paired-end sample has the expected R1 and R2 files.
The workflow starts from demultiplexed sample-level FASTQ files.
PHYLUCE 1.7.3 and illumiprocessor are used downstream to clean and
organize those reads; this tutorial does not cover Illumina run demultiplexing.
1. Define the project and raw-read directories
Keep the original FASTQ files separated from all downstream outputs. Throughout the tutorial, shell variables are used instead of machine-specific paths.
PROJECT="/path/to/my_UCE_project" READS="$PROJECT/raw_reads" mkdir -p "$READS" cd "$PROJECT" printf "Project: %s\n" "$PROJECT" printf "Raw reads: %s\n" "$READS"
Treat the files in raw_reads/ as immutable input. Trimming and all
subsequent analyses should write new files to other directories.
2. Expected FASTQ organization
Sequencing facilities use different filename conventions. A simple paired-end dataset may look like:
raw_reads/ ├── sample01_R1.fastq.gz ├── sample01_R2.fastq.gz ├── sample02_R1.fastq.gz ├── sample02_R2.fastq.gz ├── sample03_R1.fastq.gz └── sample03_R2.fastq.gz
Illumina-generated filenames may contain additional information such as sample indexes, lane identifiers and run numbers:
raw_reads/ ├── sample01_INDEX_L001_R1_001.fastq.gz ├── sample01_INDEX_L001_R2_001.fastq.gz ├── sample02_INDEX_L001_R1_001.fastq.gz └── sample02_INDEX_L001_R2_001.fastq.gz
Both patterns are acceptable. The important requirements are that the files are demultiplexed by sample and that forward and reverse reads can be paired unambiguously.
3. Inventory the FASTQ files
List all compressed FASTQ files:
find "$READS" \ -type f \ \( -name "*.fastq.gz" -o -name "*.fq.gz" \) \ | sort
Count them:
find "$READS" \ -type f \ \( -name "*.fastq.gz" -o -name "*.fq.gz" \) \ | wc -l
With one R1 and one R2 file per sample, the number of FASTQ files should equal twice the number of samples. If samples were sequenced across multiple lanes, additional files can be present and should be identified before read processing.
4. Verify R1/R2 pairs
If your filenames use the common _R1/_R2 convention,
the following shell check reports R1 files without a corresponding R2 file:
find "$READS" -type f -name "*_R1*.fastq.gz" -print0 |
while IFS= read -r -d '' R1
do
R2="${R1/_R1/_R2}"
if [[ ! -f "$R2" ]]
then
echo "Missing R2: $R1"
fi
doneIf nothing is printed, every R1 matched an R2 under this naming rule. If your sequencing facility uses another naming convention, adapt the pattern rather than renaming the original files without a clear record.
5. Choose stable sample identifiers
Sample identifiers will propagate through cleaned reads, assemblies, UCE loci, alignments, BAM files, VCF files and population-genomic analyses. Use identifiers that are unique and easy to parse.
Recommended sample01 sample02 sample03 Avoid sample 1 sample(2) new sample final sample#3
Avoid spaces and shell-sensitive characters. Letters, numbers, underscores and hyphens are safer choices.
6. Preserve original filenames
In most cases, there is no need to rename the raw FASTQ files. The official PHYLUCE
workflow uses an illumiprocessor configuration file to connect the
original sequencing files with standardized sample names and the appropriate
adapter/index information.
Original filenames often retain information about sample indexes, sequencing lanes and run structure. Preserving them improves traceability to the original sequencing delivery.
7. What PHYLUCE expects after read processing
PHYLUCE 1.7.3 does not require a particular raw-read filename, but downstream assembly
expects the cleaned reads to follow the directory and naming structure produced by
illumiprocessor. For each sample, the important directory is
split-adapter-quality-trimmed/:
clean_reads/
└── sample01/
└── split-adapter-quality-trimmed/
├── sample01-READ1.fastq.gz
├── sample01-READ2.fastq.gz
└── sample01-READ-singleton.fastq.gzWe will create this structure in the read-processing module rather than manually.
8. Pre-flight check
References and official documentation
PHYLUCE 1.7.3 — Quality Control
PHYLUCE 1.7.3 — Tutorial I: UCE Phylogenomics
The cleaned-read structure shown above follows the PHYLUCE 1.7.3 documentation. The next modules will preserve this structure so that the assembly wrappers receive the files in the form expected by PHYLUCE.