This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Fastq Sort By Sequence

Dear all,

I have some questions about manipulating fastq files. Its the first time I do this, so I want advice, how to do it. Its a special case, because I only want to keep reads when the following criteria prevail:

The read must contains at least 8 T'-s at both end.

example of wanted reads:

TTTTTTTT+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN+TTTTTTTT

Is there a way to collect these reads?

Regards, Laszlo

fastq sort filter paired-end

2 answers

zgrep -B 1 -A 2 -G "^TTTTTTTT.*TTTTTTTT$" sample.fastq.gz | grep -v "^--$" | gzip > sample.lots_of_Ts.fastq.gz

Or just use grep and skip the gzip at the end if you're not working with gzipped files.

Nice. Isn't -G redundant, because it's default?

True, it is redundant.

Thank you very much!

this should be a comment, not an answer. And validate dpryan's answer please.

Log in to answer this question.