A FASTQ file stores sequencing reads together with a quality score for every base. It is the usual starting point for read-level analysis, and knowing its four-line structure makes most quality problems easier to diagnose.
The four lines of a record
Each read in a FASTQ file takes four lines.
- A header that starts with
@. It usually contains an instrument identifier, a flow-cell lane, a tile, coordinates and a read number. The details differ between sequencers. - The sequence itself, written as
A,C,G,Tand sometimesN. - A separator line that starts with
+. It may repeat the header or be empty. - A quality string with one character for each base in line two.
The quality characters are ASCII-encoded Phred scores. The common Sanger convention adds 33 to the score, so I (ASCII 73) means a Phred score of 40. The pattern ! to I therefore covers scores from 0 to 40. Older Illumina pipelines used a different offset, which is why a file can look wrong if its encoding is misread.
Why four lines is not always enough
A FASTQ record is defined by the sequence length, not by counting line breaks. If a read contains a line break, or if a tool writes sequence and quality on more than one line, a naive parser that reads four lines at a time will fail. Robust parsers read the header, then read sequence lines until the next +, then read exactly as many quality characters as there are bases.
This matters when files are concatenated, edited by hand or converted between formats. If a tool reports "truncated quality string", compare the sequence and quality lengths before assuming the file is corrupt.
Single-end and paired-end files
A single-end experiment usually has one FASTQ file per sample. A paired-end experiment has two files: one for read 1 and one for read 2. The records are in the same order, so the first record in the read-1 file belongs with the first record in the read-2 file.
The pair is identified by the header, not only by position. Most pipelines expect matching read identifiers up to the first space, or matching /1 and /2 suffixes. If the order or naming differs, the aligner may pair the wrong reads without an obvious error.
Compression and size
FASTQ files are large because every base has a quality character. Gzip compression is standard and usually reduces the size several-fold. Most tools accept .fastq.gz directly and decompress while reading. Do not rename a gzip file to .fastq and expect a tool to cope; check the first bytes or run file on it.
Compression is not the same as archiving. Keep the original reads unchanged, and record the checksum of each file. If a trimmed file is produced later, the original remains the evidence that the trimming step can be repeated.
What to check before analysis
- Read count: compare it with the expected number from the sequencing provider.
- Read length: confirm it matches the platform and run mode.
- Quality encoding: check whether the quality range looks like Phred+33.
- Adapter content: a high level of adapter sequence suggests the insert was short or the run over-sequenced.
- Duplicate headers: identical identifiers make pairing and merging ambiguous.
- File integrity: a checksum from the provider is more useful than a visual check.
A quick quality report is cheaper than a failed alignment. Tools such as FastQC summarise per-base quality, GC content, over-represented sequences and duplication. A report is a prompt for questions, not a pass or fail mark.
What FASTQ does not contain
FASTQ does not record the reference genome, the sample condition, the library kit or the analysis history. Those belong in a sample sheet and a laboratory record. A common failure in small projects is a folder of FASTQ files with names like sample1_R1.fastq.gz and no record of which sample, condition or batch sample1 refers to.
Store the sample sheet with the reads, and use names that do not depend on memory. At minimum record the sample identifier, the condition or group, the replicate number, the library preparation, the sequencing run and the person who prepared it.
What a good record looks like
A good record has a unique header, a sequence of the expected length and a quality string of the same length. The header should let you trace the read back to a run and a sample without guessing. If the header contains spaces, decide early which part is the read identifier and tell every tool the same rule.
A good file also has a companion record: the sample sheet, the sequencing run report and a checksum. Those files answer questions that FASTQ cannot answer, such as which condition a sample belongs to and whether the file changed after delivery.
Key points
- Four lines per record: header, sequence, separator, quality.
- The quality string has one character per base.
- Paired-end reads are two files in the same order.
- Sequence length, not line count, defines a record.
- Keep the original file and a checksum.
Common mistakes
- Counting four lines per read in a file that wraps sequence lines.
- Mixing Phred+33 and Phred+64 files.
- Trimming the only copy of the reads and losing the original.
- Assuming file order is enough for pairing without checking identifiers.
- Treating a FASTQ file as self-describing when the sample metadata is elsewhere.
When to ask for help
If a file will not parse, if read counts differ from the provider's report, or if you are unsure whether a quality pattern is normal, send one small example file and the provider's summary. You can order an analysis or read the RNA-seq QC checklist before starting. The free FASTQ Read Processing tool can inspect a small file in the browser, and the NGS pipeline overview shows where FASTQ sits in a project.
Sources and further reading
Written by the Solagene team for research and education. Found an error? Tell us and we will correct it.