Lecture 5
CUTADAPT
Cutadapt
Basic usage
Input files for cutadapt need to be in one the these formats:
The input file format is recognized from the file name extension (given in parentheses in the list above). You can also explicitly specify which format the input has by using the --format option.
The output format is the same as the input format, except for the FASTA/QUAL pairs -- those will always be converted to FASTQ. Also, cutadapt does not check the output file name: If you input FASTQ data, but use -o output.fasta, then the output file will actually be in FASTQ format.
Cutadapt supports compressed input and output files. Whether an input file
needs to be decompressed or an output file needs to be compressed is
detected automatically by inspecting the file name: If it ends in .gz, then gzip compression is assumed. You can therefore run cutadapt like this and it works as expected:
cutadapt -a AACCGGTT -o output.fastq.gz input.fastq.gz
Cutadapt can do a lot more in addition to removing adapters. There are
various command-line options that make it possible to modify and filter
reads and to redirect them to various output files. Each read is processed in the following way:
Removing adapters
Cutadapt supports trimming of multiple types of adapters:
Adapter type
Command-line option
3' adapter -a ADAPTER
5' adapter -g ADAPTER
Anchored 3' adapter -a ADAPTER$
Anchored 5' adapter -g ^ADAPTER
5' or 3' (both possible) -b ADAPTER
Trimming paired-end reads
Cutadapt supports trimming of paired-end reads, trimming both reads in a pair at the same time.
Assume the input is in reads.1.fastq and reads.2.fastq and that ADAPTER_FWD should be trimmed from the forward reads (first file) and ADAPTER_REV from the reverse reads (second file)
cutadapt -a ADAPTER_FWD -A ADAPTER_REV -o out.1.fastq -p out.2.fastq reads.1.fastq reads.2.fastq
-p is the short form of --paired-output. The option -A is used here to specify an adapter sequence that cutadapt should remove from the second read in each pair. There are also the options -G, -B. All of them work just like their lowercase counterparts, except that the adapter is searched for in the second read in each paired-end read. There is also option -U, which you can use to remove a fixed number of bases from the second read in a pair.
While it is possible to run cutadapt on the two files separately, processing both files at the same time is highly recommended since the program can check for problems in your input files only when they are processed together.
When you use -p/--paired-output, cutadapt checks whether the files are properly paired. An error is raised if one of the files contains more reads than the other or if the read names in the two files do not match. Only the part of the read name before the first space is considered.
Upload data
https://zenodo.org/record/3977236/files/female_oral2.fastq-4143.gz
Carry out FastQC
Find overrepresented sequences
>overrep_seq1
GTGTCAGCCGCCGCGGTAGTCCGACGTGGCTGTCTCTTATACACATCTCC
We can BLAST overrepresented sequences to see what they are. In this case, if we take the top overrepresented sequenceand use blastn against the default Nucleotide (nr/nt) database we don’t get any hits. But if we use VecScreen we see it is the Nextera adapter.
Over-represented sequences
A normal high-throughput library will contain a diverse set of sequences, with
no individual sequence making up a tiny fraction of the whole. Finding that a single sequence is very over-represented in the set either means that it is highly biologically significant, or indicates that the library is contaminated, or not as diverse as expected.
FastQC lists all of the sequence which make up more than 0.1% of the total. For each over-represented sequence FastQC will look for matches in a database of common contaminants and will report the best hit it finds. Hits must be at least 20bp in length and have no more than 1 mismatch. Finding a hit doesn’t necessarily mean that this is the source of the contamination, but may point you in the right direction. It’s also worth pointing out that many adapter sequences are very similar to each other so you may get a hit reported which isn’t technically correct, but which has a very similar sequence to the actual match.
RNA sequencing data may have some transcripts that are so abundant that they register as over-represented sequence. With DNA sequencing data no single sequence should be present at a high enough frequency to be listed, but we can sometimes see a small percentage of adapter reads.
Tool
Cutadapt with the following parameters
“Single-end or Paired-end reads?”: Single-end
param-file “Reads in FASTQ format”: Reads (Input dataset)
In “Read 1 Options”:
“Insert 3’ (End) Adapters”:
“Source”: Enter custom sequence
“Enter custom 3’ adapter sequence”: CTGTCTCTTATACACATCT
In “Filter Options”
“Minimum length”: 20
In “Read Modification Options”
“Quality cutoff”: 20
param-select “Outputs selector”: Report
Inspect the generated txt file (Report)
Question
What % reads contain adapter?
What % reads have been trimmed because of bad quality?
What % reads have been removed because they were too short?
Solution
56.8% reads contain adapter (Reads with adapters:)
35.1% reads have been trimmed because of bad quality (Quality-trimmed:)
0 % reads were removed because they were too short
Checking quality after trimming
�FASTQE
Processing multiple datasets
Process paired-end data
https://zenodo.org/record/61771/files/GSM461178_untreat_paired_subset_1.fastq
https://zenodo.org/record/61771/files/GSM461178_untreat_paired_subset_2.fastq
FASTQC
Click on param-files Multiple datasets
With paired-end reads the average quality scores for forward reads will
almost always be higher than for reverse reads.
After trimming, reverse reads will be shorter because of their quality and then will be eliminated during the filtering step. If one of the reverse reads is removed, its corresponding forward read should be removed too. Otherwise we will get different number of reads in both files and in different order, and order is important for the next steps. Therefore it is important to treat the forward and reverse reads together for trimming and filtering.
Cutadapt
Single-end or Paired-end reads?”: Paired-end
param-file “FASTQ/A file #1”: GSM461178_untreat_paired_subset_1.fastq (Input dataset)
param-file “FASTQ/A file #2”: GSM461178_untreat_paired_subset_2.fastq (Input dataset)
The order is important here!
In Read 1 Options or Read 2 Options
No adapters were found in these datasets. When you process your own data and you know which adapter sequences were used during library preparation, you should provide their sequences here.
In “Filter Options”
“Minimum length”: 20
In “Read Modification Options”
“Quality cutoff”: 20
In “Output Options”
“Report”: Yes
Inspect the generated txt file (Report)
Question
How many basepairs has been removed from the reads because of bad quality?
How many sequence pairs have been removed because they were too short?
Solution
44,164 bp (Quality-trimmed:) for the forward reads and 138,638 bp for the reverse reads.
1,376 sequences have been removed because at least one read was shorter than the length cutoff (322 when only the forward reads were analyzed).