FASTQ is the standard file format for storing sequencing reads. Each read is stored as four lines: a header, the sequence, a separator, and a quality string. Understanding this format β and what the quality string actually means β is the foundation for everything else we do in bioinformatics QC.
π‘ TL;DR A FASTQ file is a FASTA file with quality scores attached. The quality string encodes the probability of error for each base. Higher quality scores mean fewer sequencing errors.
Every read in a FASTQ file looks like this:
Each record (sequence) will be stored in exactly 4 lines:
@ and carries the read name and (optionally) metadata. The quality string is always exactly the same length as the sequence β one character per base.+ and may optionally repeat the header.The quality string looks like gibberish, but each character encodes a Phred quality score (Q) β a number that tells you how likely that base call is wrong.
The formula is:
Q = β10 Γ logββ(P) where P = probability the base is wrong
So a base with a 1-in-100 chance of being wrong has Q = 20. A base with a 1-in-1000 chance has Q = 30. The higher the number, the more confident the sequencer was.
| Phred score | Error probability | 1 error in⦠| Accuracy |
|---|---|---|---|
| Q10 | 10% | 10 bases | 90% |
| Q20 | 1% | 100 bases | 99% |
| Q30 | 0.1% | 1,000 bases | 99.9% |
| Q40 | 0.01% | 10,000 bases | 99.99% |
Q30 is the conventional threshold for βgood qualityβ Illumina data. Q20 is often used as a lower bound for trimming.
Phred scores are stored as single ASCII characters, not as numbers, to keep the file compact. The encoding is:
ASCII character = Phred score + 33
So Q score 30 β 30 + 33 = 63 β the character ?. Score 40 β 73 β I. Score 0 β 33 β !.
The two platforms have very different error profiles, and that shapes everything about how you work with their data.
β οΈ A Nanopore dataset with mean Q12 and an Illumina dataset with mean Q12 are very different problems. Illumina Q12 indicates severe degradation or a failed run. Nanopore Q12 was typical for older flow cells and is still usable for many applications (e.g. species-level metagenomic profiling).
Nanopore accuracy has improved substantially over successive chemistries and basecallers, but still not usually as high as Illumina:
| Era | Typical Q | Notes |
|---|---|---|
| R9.4.1 (Guppy, fast mode) | Q10βQ14 | Useful for long-range structure |
| R9.4.1 (Guppy, sup mode) | Q15βQ18 | Most historical datasets |
| R10.4.1 (Dorado, sup mode) | Q20βQ25 | Current standard; good enough for variant calling |
You can peek at a FASTQ file directly, but remember that each record is 4 lines β so βthe first 8 linesβ gives you two reads:
zcat sample.fastq.gz | head -8
To count reads:
# Each read = 4 lines
zcat sample.fastq.gz | wc -l | awk '{print $1/4}'
To get a quick summary with seqfu:
seqfu stats sample.fastq.gz
π‘
seqfuhandles gzip-compressed files natively β you do not need to decompress first.
IIIIIIII and ends with !!!!!!. What does that tell you about how the sequencer performed across the read?