Sort Fastq Files...
2
1
Entering edit mode
9.3 years ago
znra1 ▴ 10

Does anyone have a utility or pointers to sort fastq files based on the quality value?

TiA, Nash

fastq sort quality • 3.2k views
2
Entering edit mode

Just to be sure, by sorting you mean, reads with best average quality should be on the top of the list? Rather, what is your criteria for sorting? And by sorting, do you mean no filtering?

5
Entering edit mode
9.3 years ago

I assume that you wish to sort the reads by average quality. This could be done easily with Heng Li's bioawk like so:

cat test.fq | awk -c fastx ' { print meanqual($seq),$name,$seq,$qual} ' | sort -k 1 -rn | awk ' { printf("@%s\n%s\n+\n%s\n",$2,$3,\$4) } ' > sorted.fq

0
Entering edit mode

(+1) got to read bioawk! :)

1
Entering edit mode

bioawk the awesomest tool that rocks the hardest

0
Entering edit mode

bioawk looks really good. Is there any manual for this? I found some description here

1
Entering edit mode
0
Entering edit mode

Thanks a lot. Good to know.

0
Entering edit mode
9.3 years ago
znra1 ▴ 10

Thanks Istvan...but it looks like there might be a typo somewhere? awk on my Ubuntu 12.04 LST doesn't seem to recognize the -c option??

Nash

0
Entering edit mode

you should post this as a comment and you will need to install bioawk and run that!

0
Entering edit mode

Ok....thanks. I just tried make from your tar file, but it looks like this Ubuntu non-developer distribution really needs a lot of basic unix libs and tools (I had to get lex and yacc first!). Any idea where I can get zlib.h to compile addon.c please? Sorry for the inconvenience...

0
Entering edit mode