This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to Create Loop for all fastq file

Dear All, hope you are doing well. I am trying to write a loop for my all fastq and doing preprocessing using bash. I am taking an error, Can you help me to write bash loops?

for file in *.fastq; do cdna_classifier.py  -Q 7  -z 200   test7/{file}*  output/{file} done

My goal:taking every fastq file with its name after that saving with same name as a fastq file Tools pychopper

Error: cdna_classifier.py: error: unrecognized arguments: output/*.fastq.fastq

nanopore rna-seq bash

echo bash loop:

$ for file in *.fastq; do echo test7/{file}*  output/{file}; done

check if correct files are echoed. Code is incorrect as it is listing fastq files in current directory, but supplying files from test7 directory. In addition, * is not necessary. It should be some thing like this:

$ for file in test7/*.fastq; do cdna_classifier.py  -Q 7  -z 200   $file  output/${file##*/}; done

Make sure that output directory and test7 directory exist in current directory.

Try something simple like this:

for file in *.fastq
  do
   #grab the actual name of the sample
    name=$(basename ${file} .fastq)
   #reconstruct input and output file names as needed
    cdna_classifier.py  -Q 7  -z 200   test7/${name}.fastq  output/${name}.out
done 

0 answers

No answers yet.

Log in to answer this question.