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
472 stars 151 forks source link

Queries regarding TrimGalore #191

Closed unikill066 closed 5 months ago

unikill066 commented 5 months ago

I usually have paired-end sequencing data, and I intend to run trim_galore on the example files below:

121_1_L001_R1_001.fastq.gz
121_2_L001_R1_001.fastq.gz
121_3_L001_R1_001.fastq.gz
121_4_L001_R1_001.fastq.gz
121_1_L001_R2_001.fastq.gz
121_2_L001_R2_001.fastq.gz
121_3_L001_R2_001.fastq.gz
121_4_L001_R2_001.fastq.gz

I am attempting to execute trim_galore on all these samples using the following commands:

trim_galore --paired --cores 4 121_1_L001_R1_001.fastq.gz 121_1_L001_R2_001.fastq.gz
trim_galore --paired --cores 4 121_2_L001_R1_001.fastq.gz 121_2_L001_R2_001.fastq.gz
trim_galore --paired --cores 4 121_3_L001_R1_001.fastq.gz 121_3_L001_R2_001.fastq.gz
trim_galore --paired --cores 4 121_4_L001_R1_001.fastq.gz 121_4_L001_R2_001.fastq.gz

Here are my queries: Is there an efficient method to run all the fastq files at once with a single command, or do I need to use a script? Additionally, when executing trim_galore, I aim to prevent the _val_1 and _val_2 prefixes from being appended to the newly generated fq.gz files.

FelixKrueger commented 5 months ago

I am sure there is some command line magic that would allow you to run things more efficiently, you should be able to find solutions by some googling or asking ChatGPT.

Here are a few thoughts:

This command should run 4 processes in parallel. The piped string (unique portion of the filename) is used as PREFIX, and is substituted whenever it is seen in the following command. Using another instance of bash -c to allow * expansion.

unikill066 commented 5 months ago

Thank you, @FelixKrueger. I wonder if there is a flag available for not adding any extensions such as _val_. However, if there isn't, that's fine—I can rename then files accordingly.

FelixKrueger commented 5 months ago

Just to confirm, there is no flag to not add the val, so rename s/_val_/_/ will have to do. All the best!