Is There A Way To Run Fastqc On All The Fastq Files In The Different Directories With Just One Command?
3
6
Entering edit mode
11.0 years ago
Assa Yeroslaviz ★ 1.9k

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 • 26k views
ADD COMMENT
6
Entering edit mode
11.0 years ago

try

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

or

find . -name "*.fq.gz"  -exec gunzip -c  '{}' ';' | fastqc  /dev/stdin
ADD COMMENT
7
Entering edit mode

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
ADD REPLY
0
Entering edit mode

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
...
ADD REPLY
0
Entering edit mode

removed the dash after fastqc

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode
11.0 years ago
Fwip ▴ 500

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).

ADD COMMENT
1
Entering edit mode
9.7 years ago
zerbeb ▴ 50

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?

ADD COMMENT

Login before adding your answer.

Traffic: 2318 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