Genomics 101

Lesson 5 of 13 · 10 min

How NGS Works: Reads and the FASTQ Format

Next-generation sequencing, or NGS, reads the order of DNA bases for millions of fragments at the same time. Illumina is the most common NGS platform in biology labs, and it works by a method called sequencing by synthesis. This lesson explains how that method produces data and how the data is stored on your computer.

Sequencing By Synthesis

On the machine, millions of short DNA fragments are attached to the surface of a glass flow cell and copied in place into dense clusters, where each cluster is many identical copies of one fragment. Each cycle adds one fluorescently labeled base, a camera photographs the color, and that color reveals which of A, C, G, or T was just added. Repeating this for many cycles spells out the sequence of every cluster, and the sequence reported for one fragment is called a read.

Read length is simply how many bases are in a read, and Illumina runs commonly produce reads of 50, 100, or 150 bases. Single-end sequencing reads each fragment from one end only, giving one read per fragment. Paired-end sequencing reads the same fragment from both ends, producing two reads that come from one molecule and can be mapped back to the genome more accurately.

The FASTQ Format

Illumina data arrives as FASTQ files, which usually end in .fastq or, when compressed, .fastq.gz. A FASTQ file stores every read using exactly four lines. Printing the first four lines of a file therefore shows one complete read.

bash
head -n 4 reads.fastq
@SEQ_ID:1:1101:1000:2000 1:N:0:ATCACG
GGGTGATGGCCGCTGCCGATGGCGTCAAATCCCACCAAGT
+
IIIIIIIIIIIIIIIFFFFFFFFFF:::::::::,,,,##

The command head prints the beginning of a file, and -n 4 tells it to show four lines, which is exactly one read. Line one is the header and always starts with @, line two is the DNA sequence, and line three is a separator that always starts with + and is otherwise usually empty. Line four is the quality string, with one character for every base, so it always has the same length as the sequence line.

Each character in the quality line encodes a Phred quality score, a number that says how confident the machine is in that base call. A score of 20 means about a 1-in-100 chance the base is wrong, and 30 means about 1-in-1000, so higher is better. The scores are stored as single ASCII characters using the Phred+33 scheme, which is why exactly one symbol lines up with each base.

Tip: Before any analysis, run FastQC to check read quality. The command fastqc reads.fastq.gz scans the file and produces an HTML report that flags problems such as low-quality bases at the ends of reads or leftover adapter sequences.

Try it yourself: Open a small FASTQ file and find the four lines of one read. For a plain file run head -n 4 reads.fastq; if the file ends in .fastq.gz run zcat reads.fastq.gz | head -n 4 instead (use gunzip -c in place of zcat on macOS). Point to the @ header, the DNA sequence, the + separator, and the quality string, then confirm the sequence and quality lines have the same number of characters.