Everything for Part 6
Download. Process. Compare.
Get the nine-slide lesson and a ZIP containing all three FASTQ datasets, the known adapter sequence, and step-by-step commands.
Practice ZIP: about 495 KB · Slides: nine pages, about 90 KB
Inside the ZIP: good.fq.gz, tail.fq.gz, adapter.fq.gz, a.fa, and README.txt.
These are synthetic teaching files. Extract the outer ZIP; keep the three .fq.gz files compressed. You do not need the Part 5 downloads for this exercise.
The website edition changes one high-quality character in each FASTQ file to make its Phred+33 encoding clear to FastQC, including after trimming. Read sequences, identifiers, lengths, and counts are unchanged. The README records the adjustment.
Step 01 · Choose a reason
More trimming is not always better.
In Part 5, we interpreted FastQC warnings in context. Now we will act on two specific problems and check the results. Keep your existing FastQC installation ready.
- 1Inspect
Read the QC pattern and consider the experiment.
- 2Decide
Choose a reason to trim, filter, or leave reads unchanged.
- 3Verify
Recheck quality, read lengths, and retained reads.
Trimming
Remove unwanted bases and keep a shorter read. For example, remove a known adapter or a poor-quality end.
Filtering
Discard the whole read if it fails a rule. For example, exclude a read that is too short after trimming.
Both operations can remove useful information. A known adapter may justify targeted removal; a poor-quality tail needs a decision about its effect on the next analysis. GC, duplication, or composition warnings may reflect the library design and do not automatically call for trimming.
The useful question is whether processing improves the data for your biological question while retaining enough reliable sequence.
Step 02 · Ubuntu terminal
Install fastp once.
Run these commands inside Ubuntu, the same environment used for FastQC:
sudo apt update
sudo apt install fastp -y
fastp --versionYour Ubuntu password may be requested; typing it does not display characters. If fastp is already installed, check its version and continue.
Step 03 · Keep the exercise together
Prepare a separate Part 6 folder.
mkdir -p ~/bioinformatics_training/part6
cd ~/bioinformatics_training/part6
explorer.exe .In the Windows Explorer window, copy the four extracted inputs into this folder: good.fq.gz, tail.fq.gz, adapter.fq.gz, and a.fa. Return to Ubuntu and confirm they are present:
ls *.fq.gz a.fa- good.fq.gz
- A high-quality control. All 5,000 reads are 100 bases long.
- tail.fq.gz
- The same sequences as the control, with 70 high-quality bases followed by 30 Q10 bases.
- adapter.fq.gz
- High-quality reads; exactly 4,000 of 5,000 contain a 67-base insert followed by the known 33-base adapter. The remaining 1,000 have no deliberately added adapter.
- a.fa
- The known adapter in FASTA format. This is a sequence file, not a program to run.
High-quality positions are Q40, except for one Q30 base in the first read of each website input. Both Q30 and Q40 are high-quality calls.
Step 04 · Exercise A
Trim the poor-quality tail.
Run this command from the Part 6 folder. It writes a new FASTQ file and preserves the original input.
fastp -i tail.fq.gz -o tail.clean.fq.gz -r -l 50 \
-h tail.fastp.html -j tail.fastp.json-i/-o- Name the input and output FASTQ files.
-r- Enable cut-right quality trimming: scan from the start with a sliding window. In the tested version, a failing window triggers trimming from its first low-quality base through the end of the read.
-l 50- Discard reads shorter than 50 bases after processing.
-h/-j- Give this run its own HTML and JSON report names.
Cut-right can remove more than trimming backwards from the end, so check the output rather than assuming every read loses exactly the visibly poor bases. For these particular practice reads, the tested output is 70 bases long.
These single-end demonstrations also use fastp’s normal filtering and adapter processing. They are not isolated tests of one option. Record the tool version and consult its settings before applying them to real libraries.
Step 05 · Exercise B
Remove the known adapter.
Use the supplied FASTA file to tell fastp which adapter was deliberately added to this dataset:
fastp -i adapter.fq.gz -o a.clean.fq.gz --adapter_fasta a.fa \
-h adapter.fastp.html -j adapter.fastp.json--adapter_fasta a.fa supplies the adapter sequence. For a read containing the full added adapter, the intended change is from 100 bases to a 67-base insert.
The slide commands work as written. The website adds distinct report names so the second run does not overwrite the first run’s default fastp.html and fastp.json. Re-running either command with the same output names will replace its previous outputs.
In real data, confirm the library’s adapters and primers first. These examples use synthetic single-end reads; paired-end, amplicon, UMI, and long-read workflows need settings appropriate to their design.
Step 06 · Verify the output
Run quality control again.
Once both fastp commands finish, there should be five .fq.gz files: three originals and two cleaned outputs. Run FastQC on all five:
fastqc *.fq.gz
explorer.exe .Open tail_fastqc.html beside tail.clean_fastqc.html, and adapter_fastqc.html beside a.clean_fastqc.html. Use good_fastqc.html as the control. You can also open tail.fastp.html and adapter.fastp.html for the processing summaries.
- Per base sequence quality: did the low-quality tail disappear?
- Adapter Content: is the unwanted adapter signal reduced?
- Basic Statistics: how many reads remain, and how long are they?
- The next analysis: is enough useful sequence left for mapping?
What happened in the tested exercise?
The website practice files were checked with fastp 0.20.1 and FastQC 0.11.9 in Ubuntu. All input FASTQs contain 5,000 valid records with matching sequence and quality lengths. Counts and exact trimming behaviour can vary with other tool versions.
| File | Reads and lengths | What to look for |
|---|---|---|
good.fq.gz | 5,000 reads; 100 bases | High quality and no substantial adapter signal. Kept unchanged as the control. |
tail.fq.gz → tail.clean.fq.gz | 5,000 reads retained; all 70 bases after processing | The Q10 suffix is removed and the remaining bases are high quality. |
adapter.fq.gz → a.clean.fq.gz | 5,000 reads retained: 4,000 × 67 bases, 2 × 95 bases, and 998 × 100 bases | The strong 80% adapter signal falls to background. fastp records 4,002 adapter-trimmed reads. |
On a small screen, scroll the table sideways.
Why 4,002 rather than 4,000? Two reads without a deliberately added adapter end with short incidental matches to the adapter prefix. fastp also removes five bases from each of those reads. This is a useful reminder that matching rules can remove some sequence beyond the intended full adapters.
The tail output retains 350,000 of 500,000 input bases (70%). The adapter output retains 367,990 bases (about 73.6%). Keeping every read does not mean keeping every base.
A different FastQC module may still show WARN or FAIL, especially after read lengths change. These exercises demonstrate processing and comparison; green flags alone do not establish that data are suitable for a particular analysis.
Step 07 · 10-minute challenge
Was the trade-off worth it?
- Run the two fastp commands.
- Compare FastQC reports for the original and cleaned reads.
- Describe what changed in the quality and adapter plots, read lengths, and retained counts.
- Would you trim
good.fq.gz? Explain your reason.
Check your reasoning
The tail dataset has a clear low-quality suffix; the adapter dataset has a known unwanted sequence. Processing improves those targeted patterns while shortening reads. The good control has no demonstrated quality or adapter problem that justifies trimming in this exercise. For real data, the decision also depends on the library and downstream requirements.
Write one sentence recording your observation, your processing decision, and the evidence that supports it.
If you get stuck
Share the command, error, or report pattern you are unsure about in the Part 6 LinkedIn discussion.
The command says “fastp: command not found”.
Run the installation commands in Ubuntu, then check fastp --version. FastQC is a separate tool; see the Part 4 installation if needed.
An input file or a.fa cannot be found.
Run pwd and ls -lh. All four extracted inputs must be in the Part 6 working folder. Keep the FASTQ files compressed and use the exact file names shown above.
Why does an earlier copy of a high-quality file show Q9?
FastQC can infer older Phred+64 encoding when every synthetic quality character is I. The website files include one retained Q30 character per input so all five reports identify Phred+33 correctly. Download the website ZIP and repeat the exercise in a fresh folder if your original copy shows this issue.
Why did a different warning appear after trimming?
Processing changes the read lengths and the composition of the remaining data. Compare the plots and the targeted problem. For example, a variable-length output can flag Sequence Length Distribution without showing that adapter trimming failed.
fastp says “No adapter detected for read1”. Did the adapter command fail?
This message refers to automatic adapter detection. The sequences supplied through --adapter_fasta a.fa are still used. Check the trimming summary and before-and-after FastQC reports; the tested exercise removes all 4,000 deliberately added full adapters.
Further reading: the official fastp documentation explains trimming, adapter FASTA input, defaults, and report options; the tested version’s cut-right implementation shows how it retains leading high-quality bases in a failing window. The FastQC quality guide explains the plots and the synthetic-data encoding edge case.
Continue · Part 7
Map reads against a reference genome.
Continue from quality control and read cleaning to reference mapping.