Filtering reads on the basis of percentage of ambiguous(N's) characters
Hi,
I want to filter my fastq reads based on ambiguous characters, basically N's. So if I have a read sequence having N's greater than 5%, I want to discard that read, if lower than 5%, I want to keep it. It would be really helpful if someone know about any tool which already does that.
Thanks
• 2,771 views
•
link
1 answer
using paste + awk:
gunzip -c input.fq.gz |\
paste - - - - |\
awk -F '\t' '{S=$2;L=1.0*length(S);gsub(/[^ATGCatgc]/,"",S);L2=length(S); if(L2/L > 0.05) print $0;}' |\
tr "\t" "\n"
• 1 views
•
link
Log in to answer this question.