cutadapt for trimming reads to specific length
5
3
Entering edit mode
8.1 years ago
Varun Gupta ★ 1.3k

Hi I am trying to trim my fastq files where I have reads ranging from 20bp to 150bp as shown by fastqc result. I want to keep a definitive length of my reads to 120bp. So if any read is greater than 120 bp trim it to 120 and if any read is less than 120 then discard it. How can I do this using cutadapt?

I can use -m option to throw away reads less than 120 bp but I still get reads greater than 120 bp. How can I trim them to 120 bp.

This is the command I am using

cutadapt -m 120 -o file1.trimmed.fq -p file2.trimmed.fq file1.fq file2.fq

Also can trim galore do that?

Thanks

cutadapt trim-galore • 12k views
ADD COMMENT
1
Entering edit mode

If your goal is just to trim the reads, why do you want to use cutadapt ? You could use something like fastq_trimmer

ADD REPLY
0
Entering edit mode

I was using cutadapt so thought this would be possible using it. I will look into fastq_trimmer. Thanks

ADD REPLY
1
Entering edit mode

Since no one has asked this I will. Why do you want to do this? Unless the reads have really poor Q-scores (< Q10) or show presence of adapters, there should be little reason to trim them. Far too many people take "failures" of FastQC modules seriously.

ADD REPLY
0
Entering edit mode

Hi genomax2, The reads are fine as far as quality scores are concerned. The reason I want to do this is I am using rMATS downstream which as of now requires fixed length of the reads.

ADD REPLY
0
Entering edit mode

Hi, Varun,

I asked similar questions in the rMATS forum. I have pair-end fastq reads with a length of 151 bp. After adaptor trimming, the length is not uniform for all reads, the developer told me that I can still use "--variable-read-length --readLength 151" arguments in the command line. I tried and this works for me.

Xiao

ADD REPLY
3
Entering edit mode
7.8 years ago
elgart ▴ 30

cutdapt -l 120 -m 120 -o file1.trimmed.fq -p file2.trimmed.fq file1.fq file2.fq

ADD COMMENT
0
Entering edit mode

The l in the "-l" is the lower case of L, not the upper case "I".

ADD REPLY
1
Entering edit mode
8.1 years ago
biofalconch ★ 1.3k

Trimmomatic can achieve this one nice and easy. Just use the parameter CROP, which uses a number of bases you want to keep.

ADD COMMENT
0
Entering edit mode

I will try this. Thanks

ADD REPLY
1
Entering edit mode
8.1 years ago
Satyajeet Khare ★ 1.6k

Hi Varun,

I do this in two separate steps. I first remove the adapters and run fastqc and then depending on the read quality of the new file, I trim them to required size using fastx_trimmer. The reason being that removal of adapter changes sequence quality on fastqc. So parameters for trimming change.

Best,

ADD COMMENT
0
Entering edit mode
8.1 years ago

If you want to stick to cutadapt I guess you could use the -m option (Discard trimmed reads that are shorter than LENGTH) together with the -M option (Discard trimmed reads that are longer than LENGTH).

ADD COMMENT
1
Entering edit mode

-M option would discard reads longer than 120 bp. I want to trim it if they are longer than 120 to 120bp

ADD REPLY

Login before adding your answer.

Traffic: 1655 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6