01 What is Quality Control?
Quality control (QC) in RNA-seq is the process of inspecting your raw sequencing data before you do any biology with it. It is not an optional extra step — it is the single most important thing you do at the start of an RNA-seq analysis.
Sequencing machines are not perfect. A modern Illumina sequencer reads hundreds of millions of short DNA fragments (reads) and assigns a quality score to every single base it calls. Some bases are read confidently; others are guesses. Some reads are contaminated with adapter sequences from the library preparation step. Some samples degrade before sequencing even begins.
If you skip QC and align these imperfect reads directly to a genome, you get garbage in → garbage out. Your differential expression results will include false positives, your coverage plots will look noisy, and your conclusions could be wrong. QC is your protection against all of this.
QC tells you three things:
- Is the sequencing data good enough to use? — Some runs fail catastrophically and should be discarded entirely.
- What problems exist and how bad are they? — Low-quality tails, adapter contamination, GC bias, over-represented sequences.
- What preprocessing do I need? — Do I need to trim adapters? Remove low-quality bases? Filter out certain reads?
Plant genomics note: In plant RNA-seq experiments, QC problems are especially common. Plant RNA extractions often contain phenolic compounds, polysaccharides, and secondary metabolites that can degrade RNA quality before sequencing even starts. The QC report is your first signal that something went wrong in the wet lab.
02 Where QC Fits in the RNA-seq Workflow
RNA-seq analysis is a pipeline — a sequence of steps that transforms raw sequencing reads into biological knowledge. QC always comes first, and it actually happens twice: before and after trimming.
This module covers steps 2, 3, and 4. By the end of the module you will be able to run a complete QC-to-trimming pipeline on any RNA-seq dataset.
03 What Can Go Wrong with Sequencing Data
Before you can interpret a QC report, you need to understand the types of problems that can appear. Here are the most common ones you will encounter in real RNA-seq projects.
Every base in a FASTQ file has a quality score called a Phred score (also written Q score). This score encodes the probability that the base call is wrong.
The formula is: Q = −10 × log₁₀(P) where P is the probability of an error.
This means Q30 = 1 in 1,000 chance of error (99.9% accuracy). Q20 = 1 in 100 chance (99% accuracy). In RNA-seq, you generally want the majority of your bases to have Q ≥ 30. Anything below Q20 is considered low quality and should be trimmed.
| Problem | What it means | Caused by | Fixed by |
|---|---|---|---|
Low per-base quality |
Quality scores drop at the 3′ end of reads | Normal Illumina chemistry — signal degrades over longer reads | Quality trimming |
Adapter contamination |
Adapter sequences appear at the end of reads | Short insert size — read runs off the end of the fragment into the adapter | Adapter trimming |
High duplication rate |
Many reads are identical copies | Low input RNA, PCR over-amplification during library prep | Mark duplicates after alignment; use more RNA input |
GC content bias |
GC distribution does not match the expected genome curve | PCR bias, contamination, or a highly AT/GC-rich organism | Investigate; may be normal for your organism |
Over-represented sequences |
A single sequence makes up >1% of all reads | rRNA contamination, adapter dimers, library prep artefacts | rRNA depletion in the wet lab; adapter trimming |
Low read count |
Too few reads per sample (<10M for most RNA-seq) | Sequencing failure, low RNA input, failed library | Re-sequence the sample |
The rRNA contamination problem in plants: If your library preparation used poly-A selection, you should see very little rRNA in your data. If you see massive over-represented sequences similar to known rRNA, your poly-A selection may have failed. This is a serious wet-lab problem — QC catches it before you waste weeks of computational analysis.
04 QC Tools You Will Learn in This Module
The bioinformatics community has settled on a core set of tools for RNA-seq QC. You will use all of these in this module.
| Tool | What it does | Output | Lesson |
|---|---|---|---|
FastQC |
Runs ~12 quality checks on a single FASTQ file and generates an HTML report with pass/warn/fail badges | .html report + .zip data file |
Lessons 3 & 4 |
MultiQC |
Aggregates FastQC reports from all samples into a single interactive HTML dashboard — essential for comparing 10+ samples at once | multiqc_report.html |
Lesson 5 |
Trimmomatic |
Java-based trimmer. Highly configurable. Trims adapters, low-quality bases, leading/trailing bases. Industry standard for many years. | Trimmed FASTQ files | Lesson 6 |
Trim Galore |
Wrapper around Cutadapt. Simpler to use than Trimmomatic. Automatically detects adapter sequences. Excellent for paired-end data. | Trimmed FASTQ files + QC report | Lesson 7 |
🤔 FastQC vs MultiQC — what is the difference?
FastQC analyses one FASTQ file and produces one report. If you have 24 samples (12 conditions × 2 replicates), you run FastQC 24 times and get 24 separate HTML reports. Reading 24 reports manually is tedious and error-prone.
MultiQC reads all 24 FastQC outputs and combines them into a single interactive report where every sample appears as one line in every plot. You can immediately see which samples are outliers. This is why MultiQC is now standard practice in any serious RNA-seq project.
05 Setting Up Your Environment
Before running any QC tools, you need to set up a Conda environment with the required software. This keeps all your QC tools isolated from other projects and ensures reproducibility.
FastQC requires Java. Trimmomatic requires Java. MultiQC requires Python. Trim Galore requires Cutadapt (Python) and FastQC. If you install all these in your base environment, they can conflict with other tools. A dedicated rnaseq-qc environment means you can always recreate this exact software setup, share it with collaborators, and avoid dependency conflicts.
In Module 3 (Conda) you learned the full theory. Here you simply use it. If you have not set up Conda yet, install Miniconda3 first.
Step 1 — Create and activate the environment
# Create a new Conda environment named rnaseq-qc # -c bioconda and -c conda-forge supply the bioinformatics packages conda create -n rnaseq-qc \ -c bioconda -c conda-forge \ fastqc multiqc trimmomatic trim-galore \ -y # Activate the environment — must do this every new terminal session conda activate rnaseq-qc # Verify all four tools are installed fastqc --version FastQC v0.12.1 multiqc --version multiqc, version 1.21 trimmomatic -version 0.39 trim_galore --version Trim Galore version 0.6.10
Step 2 — Create your project directory structure
Good directory organisation is essential in bioinformatics. Create this structure once and reuse it throughout the module.
# Create the full project directory tree in one command # Brace expansion {...} creates multiple directories simultaneously mkdir -p ~/rnaseq-project/{data/{raw,trimmed},qc/{fastqc_raw,fastqc_trimmed,multiqc},results,logs} # Verify the full structure tree ~/rnaseq-project rnaseq-project/ ├── data/ │ ├── raw/ ← original FASTQ files — NEVER modify these │ └── trimmed/ ← trimmed reads from Trimmomatic/Trim Galore ├── qc/ │ ├── fastqc_raw/ ← FastQC reports on raw data │ ├── fastqc_trimmed/ ← FastQC reports after trimming │ └── multiqc/ ← MultiQC combined dashboard ├── results/ ← final outputs (counts tables, plots) └── logs/ ← log files from every tool you run # Protect raw data — make it read-only so you cannot accidentally delete it chmod -R 444 ~/rnaseq-project/data/raw
The golden rule of raw data: Never modify or delete files in data/raw/. These are your original, unprocessed reads from the sequencer. They are irreplaceable. The chmod -R 444 command makes the entire directory read-only so even an accidental rm command will fail with a permission error.
Step 3 — Peek at a FASTQ file to understand its format
Before running FastQC, it is worth understanding what the raw data actually looks like. A FASTQ file is a plain text file — you can read it directly on the command line.
# FASTQ files are gzip-compressed (.gz) to save disk space # zcat decompresses on-the-fly and sends output to stdout # pipe to head -8 to see the first 2 reads (4 lines each) cd ~/rnaseq-project/data/raw zcat sample1_R1.fastq.gz | head -8 @SRR8245019.1 1/1 ← Line 1: read identifier (starts with @) ACTGGTACGATCGATCGTAGCTAGCTAGCTA ← Line 2: the DNA sequence (150 bases) + ← Line 3: separator (always +) IIIIIIIIIIIIIIIIIIIIIIIIIIIIIII ← Line 4: quality scores (ASCII-encoded Phred) @SRR8245019.2 2/1 GCTAGCTAGCGATCGATCGTAGCTAGCTAGC + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH # Count total reads: divide total lines by 4 zcat sample1_R1.fastq.gz | wc -l 80000000 # 80,000,000 lines ÷ 4 = 20,000,000 reads — a typical RNA-seq run
Line 1 — Read identifier: Starts with @. Contains the instrument name, run ID, flowcell coordinates, and read number. Every read has a unique identifier.
Line 2 — DNA sequence: The actual nucleotide sequence the sequencer called. Each character is one base (A, T, G, C, or N for unknown). For paired-end 150 bp sequencing, this line is exactly 150 characters long.
Line 3 — Separator: Always a + sign. Sometimes the read identifier is repeated here, but most modern tools just write + to save space.
Line 4 — Quality scores: One ASCII character per base in Line 2. The character encodes a Phred quality score using the formula: Phred = ASCII value − 33. The character I has ASCII value 73, so its Phred score is 73 − 33 = 40, meaning 99.99% base-call accuracy. The character ! (ASCII 33) gives Phred 0 — essentially a random guess.
06 Exercises
- Create the Conda environment named
rnaseq-qcwith FastQC, MultiQC, Trimmomatic, and Trim Galore installed from the bioconda and conda-forge channels. - Activate the environment and confirm all four tools installed by running their
--versionflags. - Create the full project directory structure at
~/rnaseq-project/with all subdirectories as shown in Step 2 above.
▶ Show answer
Run: conda create -n rnaseq-qc -c bioconda -c conda-forge fastqc multiqc trimmomatic trim-galore -y
Then: conda activate rnaseq-qc and verify with fastqc --version, multiqc --version, trimmomatic -version, trim_galore --version.
Create all directories in one command: mkdir -p ~/rnaseq-project/{data/{raw,trimmed},qc/{fastqc_raw,fastqc_trimmed,multiqc},results,logs}
- Download or obtain any
.fastq.gzfile and place it in~/rnaseq-project/data/raw/. - Use
zcatandhead -12to display the first 12 lines. How many complete reads does this show? - Count the total number of reads using:
zcat sample.fastq.gz | wc -lthen divide by 4. How many reads are there? - What is the length of the first read? Try:
zcat sample.fastq.gz | head -2 | tail -1 | wc -c(subtract 1 for the newline character).
▶ Show answer
12 lines ÷ 4 lines per read = 3 complete reads shown by head -12.
Divide total line count by 4 to get read count. A typical Illumina RNA-seq run has 20–50 million reads per sample.
Modern paired-end RNA-seq is usually 150 bp reads. Older runs may be 75 bp or 100 bp. The wc -c count includes the newline character, so the actual read length is the result minus 1.
- Look at Line 4 of the first read in your FASTQ file. What ASCII characters do you see?
- The character
Ihas ASCII value 73. What is its Phred score? (Subtract 33, because Illumina uses Phred+33 encoding.) - What does Phred 40 mean in terms of base-call accuracy? Use: accuracy = 1 − 10^(−Q/10)
- What Phred score does the character
#(ASCII 35) represent? Is this a good or bad quality base?
▶ Show answer
I → ASCII 73 → Phred score 73 − 33 = 40. Accuracy = 1 − 10^(−4) = 99.99%. This is excellent — only 1 error per 10,000 base calls.
# → ASCII 35 → Phred score 35 − 33 = 2. Accuracy = 1 − 10^(−0.2) = ~37%. This is a very poor quality base — nearly worthless. Bases with Phred < 20 should be trimmed away before alignment.