Monday, April 6, 2015

How to get number of reads from fastq.gz

If you have a gzipped fastq file and want to get the number of reads without unpacking use zcat to read the file and pipe it to wc -l to get the number of lines, then divide it with 4 (since each read will occupy 4 lines in total): 

zcat file.fastq.gz | echo $((`wc -l`/4))

No comments:

Post a Comment