Question: cutadapt for trimming reads to specific length
2
gravatar for Varun Gupta
3.7 years ago by
Varun Gupta1.1k
United States
Varun Gupta1.1k wrote:

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

trim-galore cutadapt • 4.5k views
ADD COMMENTlink modified 3.4 years ago by elgart10 • written 3.7 years ago by Varun Gupta1.1k
1

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

ADD REPLYlink modified 3.7 years ago • written 3.7 years ago by geek_y11k

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

ADD REPLYlink written 3.7 years ago by Varun Gupta1.1k
1

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 REPLYlink modified 3.7 years ago • written 3.7 years ago by genomax85k

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 REPLYlink written 3.7 years ago by Varun Gupta1.1k
1
gravatar for biofalconch
3.7 years ago by
biofalconch470
Mexico
biofalconch470 wrote:

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

ADD COMMENTlink written 3.7 years ago by biofalconch470

I will try this. Thanks

ADD REPLYlink written 3.7 years ago by Varun Gupta1.1k
1
gravatar for Satyajeet Khare
3.7 years ago by
Satyajeet Khare1.5k
Pune, India
Satyajeet Khare1.5k wrote:

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 COMMENTlink modified 3.7 years ago • written 3.7 years ago by Satyajeet Khare1.5k
1
gravatar for elgart
3.4 years ago by
elgart10
elgart10 wrote:

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

ADD COMMENTlink written 3.4 years ago by elgart10
0
gravatar for dariober
3.7 years ago by
dariober11k
WCIP | Glasgow | UK
dariober11k wrote:

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 COMMENTlink written 3.7 years ago by dariober11k

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

ADD REPLYlink written 3.7 years ago by Varun Gupta1.1k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 841 users visited in the last hour