Skip to lesson content

FASTQ to Phylogeny · Part 3 · Free beginner exercise

Can I trust this base?

Understanding FASTQ quality scores

What do the letters and symbols on the fourth FASTQ line actually mean? Connect each character to a quality score, then read the confidence behind each base call.

View the LinkedIn post and discussion ↗
One read, eight basesUnderstand each quality characterNo new softwareUse Ubuntu from Parts 1 and 2Learn, then practiseEight slides and a 10-minute challenge

The fourth line has a job.

In Part 2, we created FASTA and FASTQ files and identified the four lines in a FASTQ read. Now we will focus on the quality string.

Our example throughout this lesson
@read_demo
ATGCGTAC
+
IIII5?I+

The second line contains the bases. The fourth line contains one quality character for every base. Both strings have eight characters.

The key idea

A quality score describes the estimated confidence in a base call. It gives us a way to express how likely that call is to be wrong.

Step 01 · Wet lab to dry lab

From sequencing signal to confidence

A sequencer measures a physical signal. Software then decides which base is most likely and estimates how confident that call is.

  1. Signal measured

    The instrument records fluorescence, an electrical signal, or another platform-specific measurement.

  2. Base called

    Base-calling software interprets the signal as a base such as A, C, G, or T.

  3. Confidence estimated

    The software assigns an estimated probability that the base call could be wrong.

  4. Stored in FASTQ

    The sequence is stored with one quality character for every base.

A quality score tells us about confidence in the call. By itself, it does not explain why that confidence is high or low.

Step 02 · Read the probability

What does a Phred score mean?

FASTQ quality values are usually expressed as Phred scores, written as Q. A higher Q means a lower estimated probability of an incorrect base call.

The Phred relationship

Q = −10 log10(Perror)

Perror = 10−Q/10

You do not need to calculate logarithms for this exercise. Focus on what the values mean:

Estimated error probability for a base call
QualityError probabilityAbout 1 error inEstimated accuracy
Q100.110 base calls90%
Q200.01100 base calls99%
Q300.0011,000 base calls99.9%
Q400.000110,000 base calls99.99%

Every increase of 10 in Q corresponds to a tenfold decrease in the estimated error probability. Q30 has one tenth the estimated error probability of Q20.

What Q30 means

Q30 means an estimated error probability of 0.1%, or about 1 in 1,000. It does not mean “30% quality.” This is an estimate for a base call, not a guarantee of exactly one error in a particular set of 1,000 bases.

The definition and values follow Illumina’s explanation of quality scores.

Step 03 · Phred+33 encoding

Why are there letters and symbols?

Modern FASTQ commonly uses Phred+33 encoding: the numerical quality score is stored as a printable character. These characters represent quality values; they are not additional nucleotides.

+Q10

About 1 in 10 incorrect
90% estimated accuracy

5Q20

About 1 in 100 incorrect
99% estimated accuracy

?Q30

About 1 in 1,000 incorrect
99.9% estimated accuracy

IQ40

About 1 in 10,000 incorrect
99.99% estimated accuracy

The I here is a capital letter I, and 5 is the digit five. Their meaning comes from their character codes.

What does the “+33” mean?

The character’s ASCII code equals the Phred score plus 33. To decode it, subtract 33: the ASCII code for capital I is 73, so 73 − 33 = 40, or Q40. You do not need to memorise ASCII codes; software handles this for real datasets.

This lesson uses Phred+33. Other encodings occur in older data; the NCBI SRA File Format Guide describes the main variants.

Step 04 · One read

Read one base at a time

Line up each base with the quality character at the same position. Our eight-base sequence, ATGCGTAC, pairs with IIII5?I+.

One quality character for every base
Position12345678
SequenceATGCGTAC
Quality characterIIII5?I+
Phred scoreQ40Q40Q40Q40Q20Q30Q40Q10

On a narrow screen, scroll the table sideways to see all eight positions.

Which base has the lowest confidence?

Position 8: C. Its quality character is +, which represents Q10, the lowest score in this example. That means a 10% estimated probability that this call is wrong; it does not prove that this particular C is incorrect.

Two different uses of the plus sign

The + on the third FASTQ line separates sequence and quality. The final + on the fourth line is a quality character for the eighth base. Its role depends on which line it appears on.

Step 05 · Wet-lab perspective

Why should the wet lab care?

Quality scores connect the sequence files back to the experiment. Several factors can affect confidence, so a low score alone cannot identify the cause.

Input material
The condition of the nucleic acid can affect the library entering sequencing.
Library preparation
Suboptimal or uneven libraries can contribute to poorer or less consistent reads.
Sequencing run
Loading, chemistry, instrument conditions, and run performance can influence read quality.
Read position and platform
Quality patterns differ by sequencing technology and can change across a read.
Base calling
The software interprets the measured signal and estimates confidence in its calls.
Low quality is a symptom, not a diagnosis

Investigating the cause requires the sample, library, run, and platform context. A quality score shows where confidence is low, but does not establish which part of the experiment caused it.

Step 06 · Ubuntu terminal

Create a mixed-quality FASTQ read

No new software is needed. Open the Ubuntu terminal from Part 1 and use the same workspace as Part 2.

1. Move into your workspace

Ubuntu · Open your workspace
cd ~/bioinformatics_training

2. Create quality_demo.fastq

Copy the entire block, including the final EOF, into Ubuntu and press Enter.

Ubuntu · Create the practice read
cat > quality_demo.fastq << 'EOF'
@read_demo
ATGCGTAC
+
IIII5?I+
EOF

The last EOF must be on its own line. Re-running this block replaces quality_demo.fastq with the same practice read.

3. Inspect the file

Ubuntu · Show the file contents
cat quality_demo.fastq
Expected output
@read_demo
ATGCGTAC
+
IIII5?I+

Your task

Identify the lowest-quality base, the Q30 character, and why the sequence and quality strings must both contain eight characters.

Check the practice-file answers
  • The lowest-quality base is C at position 8: + means Q10.
  • The Q30 character is ?, paired with T at position 6.
  • Each of the eight bases needs its own quality character, so the two strings must have equal lengths.

Step 07 · 10-minute challenge

Your turn.

Try these without looking back at the explanations above:

  1. What does a FASTQ quality score describe?
  2. What does Q30 mean in plain language?
  3. Which has lower confidence: Q10 or Q40?
  4. In Phred+33, which character in our example represents Q20?
  5. Why can a low quality score not identify the exact wet-lab cause by itself?
Check your answers
  1. It describes the estimated confidence in a base call, expressed through the probability that the call is wrong.
  2. Q30 means an estimated error probability of about 1 in 1,000, or 0.1%.
  3. Q10 has lower confidence and a higher estimated error probability than Q40.
  4. The digit 5 represents Q20 in Phred+33.
  5. Different sample, library, sequencing, and software factors can affect quality. The score does not identify which factor caused a particular low-confidence call.
To remember

Each FASTQ quality character belongs to one base. Higher Phred scores mean lower estimated error probabilities.

If you get stuck

Have a question? Share the command, error, or step you are working on in the Part 3 discussion on LinkedIn.

Ubuntu says the workspace does not exist.

Complete the workspace step in Part 1, then return here. This exercise uses ~/bioinformatics_training.

I see a > prompt and the file is not finished.

Ubuntu is waiting for the end of the text block. Type EOF on its own line, without quotes or spaces, and press Enter. To cancel and start again, press Ctrl+C and copy the complete creation block.

My quality string does not have eight characters.

Compare it with IIII5?I+: four capital I characters, then 5, ?, one more capital I, and +. Keep this on one line with no spaces. Copy the complete creation block again if needed.

Does the + quality character mean the base is definitely wrong?

No. In Phred+33, + means Q10, an estimated error probability of 10%. It indicates lower confidence, not a confirmed error.

Should I use PowerShell or Ubuntu?

Use Ubuntu for the commands in this lesson. The file-creation syntax is the same as in Part 2.

Keep a copy of the eight-slide lesson (PDF) for your next practice session.

Continue with Part 4

One read is easy. What about millions?

Assessing sequencing data with FastQC: download two practice datasets, run the reports, and compare their quality patterns.