How to Create Loop for all fastq file
0
0
Entering edit mode
3.2 years ago
santos48 ▴ 40

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 • 1.1k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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 
ADD REPLY

Login before adding your answer.

Traffic: 1625 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6