This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is There A Way To Run Fastqc On All The Fastq Files In The Different Directories With Just One Command?

Hi,

I have a folder structure with multiple fastq files in different directories.

Is there a way to run fastqc on all the fastq files in the different directories with just one command?

I have tried it with

find . -name "*.fq" | fastqc -

but it didn't work.

thanks in advance

Assa

fastqc pipeline

3 answers

try

find . -name "*.fq"  -exec cat '{}' ';' | fastqc  /dev/stdin

or

find . -name "*.fq.gz"  -exec gunzip -c  '{}' ';' | fastqc  /dev/stdin

My files are not zipped, so I used the first option. But I get an error massage:

Skipping '-' which didn't exist, or couldn't be read
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
find: `cat' terminated by signal 13
...

This won't work, as it will open the interactive windows of the fastqc program (x11).

sorry, I was reasoning with cutadapt not fastqc. Try to read /dev/stdin.

I think I figure it out thanks to your Idea. I just changed cat with fastq

now it's running. I still need to see if it runs all over the files. but at least it works.

Thanks for the advice

I like a similar (but maybe simpler?) version of this using xargs:

find . -name "*.fq" | xargs -n 1 fastqc

And if your filenames have spaces in them, it works fine with:

find . -name "*.fq" -print0 | xargs -0 -n 1 fastqc

At least on my version (0.10.1, apparently), fastqc will accept filenames listed on the command line. So, in the same vein as Pierre's answer, I would probably do:

find -name '*.fq' -exec fastqc '{}' + ';' or find -name '*.fq' | xargs fastqc

(I think the xargs way is a little easier for my brain to remember).

Was having trouble with related issue and solved it. This may not be your problem, but for posterity, I wanted to link.

When fastq are generated by casava, fastqc has a special option. I found this thread: http://seqanswers.com/forums/showthread.php?t=34878

and it comes down to fastqc --casava *.fastq.gz that will generate results for the reads separately. Maybe this will help others?

Log in to answer this question.