Entering edit mode
8.1 years ago
emblake
▴
90
I have 60 PE fastq files that I would like to batch process using TrimGalore! I know a for...in loop would best serve my purpose, but I don't think I'm setting it up correctly. Would someone more experienced with scripting assist? Thank you!
File format: SMXX_R1_merged.fastq.gz, SMXX_R2_merged.fastq.gz
#!/bin/bash
for f1 in *_R1_merged.fastq.gz
do
f2=${f1%%_R1_merged.fastq.gz}"_R2_merged.fastq.gz"
trim_galore --illumina --paired --fastqc -o trim_galore/ $f1 $f2
done
You can run with GNU parallel.
You have a typo: *parallel ;-)
Might be best to include link as well: https://www.gnu.org/software/parallel/
I've installed GNU parallel and run:
but it fails with:
I can see that the file naming convention is incorrect, but I'm not sure how to fix it.
Looks like the path is not correct. Are you sure /path/to/fastq is your directory that contains your gz files ? Can you print
find /path/to/fastq -name "*_R1_merged.fastq.gz" | cut -d "_" -f1
?I checked the path, and there was an issue with a subfolder named 'trim_galore'. I corrected the error, and it seems to be executing just fine now. Thanks very much!