This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trimmomatic on Fastq file

I have 4 sample of fastaq file each one has two read , i want to use a loop on trimmomatic over them but i face problem with the code: my files are

BD143_TGACCA_L006_R1_001.pe.fq.gz
BD143_TGACCA_L006_R2_001.pe.fq.gz
BD143_TGACCA_L005_R1_001.pe.fq.gz
BD143_TGACCA_L005_R2_001.pe.fq.gz
BD174_CAGATC_L005_R1_001.pe.fq.gz
BD174_CAGATC_L005_R2_001.pe.fq.gz
BD225_TAGCTT_L007_R1_001.pe.fq.gz
BD225_TAGCTT_L007_R2_001.pe.fq.gz

I try to use this command line but it doesn't work any help please ?

for file in *R1_001.fq.gz; do base=$(basename ${file} _R1_001.fq.gz); trimmomatic PE -threads 1 -phred33 -trimlog trimLogFile -summary statsSummaryFile ${file} ${base}_R2_001.fq.gz ${base}_R1_001.trim.fq.gz ${base}_R1_001un.fq.gz ${base}_R2_001.trim.fq.gz ${base}_R2_001un.trim.fq.gz ILLUMINACLIP:$adap/TruSeq3-PE-2.fa:2:30:10:1 SLIDINGWINDOW:4:15 MINLEN:30 ; done
rna-seq software error

what exactly is not working? do you get any errors/warnings/ ... ?

replace ; trimmomatic PE with ; echo trimmomatic PE and show us what happens

this is what i got

trimmomatic PE -threads 1 -phred33 -trimlog trimLogFile -summary statsSummaryFile *R1_001.fq.gz *R1_001.fq.gz_R2_001.fq.gz *R1_001.fq.gz_R1_001.trim.fq.gz *R1_001.fq.gz_R1_001un.fq.gz *R1_001.fq.gz_R2_001.trim.fq.gz *R1_001.fq.gz_R2_001un.trim.fq.gz ILLUMINACLIP:/home/hwaida/miniconda3/envs/ngs1/share/trimmomatic-0.39-1/adapters/TruSeq3-PE-2.fa:2:30:10:1 SLIDINGWINDOW:4:15 MINLEN:30

well, that's pretty clear what is happening :-)

replace the first part with for file in $( ls *R1_001.fq.gz ) ;

it is a bit strange though the * is not expanded in your command line. You are working in a linux-bash environment, correct? and the files are located where you execute this command? (== they are thus not located in a different folder?)

I suspect the latter as this would result in the behaviour you posted above.

i got this: ls: cannot access '*R1_001.fq.gz': No such file or directory

sorry but i am new to bioinformatics, any suggestion to solve it, as i located where i execute command :(

yes i work on linux-bash environment, yes they located where i execute the command

1 answer

One problem is your file names have _R1_001.pe.fq.gz where as you are using _R1_001.fq.gz in your basename command. So change that (in all relevant locations in your command) and try again.

Log in to answer this question.