FelixKrueger / TrimGalore

A wrapper around Cutadapt and FastQC to consistently apply adapter and quality trimming to FastQ files, with extra functionality for RRBS data
GNU General Public License v3.0
459 stars 149 forks source link

Add trimmed sequences to fastq header? #166

Closed js72587 closed 1 year ago

js72587 commented 1 year ago

Is there a way to add the trimmed sequences (--clip_R1, --three_prime_clip_R1, etc.) to the fastq headers? It seems cutadapt has the --rename parameter to do this, but it doesn't look like TrimGalore has this option; is my understanding correct?

Thank you!

FelixKrueger commented 1 year ago

It doesn't have the this option right now, but it shouldn't be overly complicated to add (at least not for --clip_r1, --three_prime_clip_r1 and so on).

js72587 commented 1 year ago

Thank you! That'd be great.

FelixKrueger commented 1 year ago

If I were to give this a go, what would you like to see? I could imagine something like:

if --clip_r1 or --clip_r2 is 1 or greater, we could add something like this to the header (here for --clip_r1 4:

:clip5:GATC

if --three_prime_clip_r1 or --three_prime_clip_r2 is 1 or greater, we could add something like this to the header (here for --three_prime_clip_r1 6:

:clip3:TAAATC

Or, if both 5' and 3' clipping were selected, add both like so:

:clip5:GATC:clip3:TAAATC

Does this sound useful?

js72587 commented 1 year ago

Yes, that would be exactly what we're looking for. Thanks a lot!

FelixKrueger commented 1 year ago

Hi again. I have just added a new option --rename that should do exactly what outlined above. I have tried to make it work in single-end as well as paired-end mode (for use with --rrbs or --polyA). it should work for 5'-clipping (--clip_(r1/r2)) and 3'-clipping (--three_prime_clip_(r1/r2)), and combinations thereof. Furthermore, it should also work with --hardtrim5 and --hardtrim3, and hopefully help help with UMI handling.

Can you please clone the dev version, and let me know if it works in your hands?

js72587 commented 1 year ago

Thanks so much for implementing this so quickly! I'll test it and will be back with feedback later this week. Really appreciated!

js72587 commented 1 year ago

Hi Felix, I tested this and it works perfectly. Thank you so much!

FelixKrueger commented 1 year ago

Fantastic. It will find its way into the next release then. All the best!