esteinig / nanoq

Minimal but speedy quality control for nanopore reads in Rust :bear:
MIT License
109 stars 9 forks source link

Read quality thresholds (Q) #44

Open Hedi65 opened 7 months ago

Hedi65 commented 7 months ago

dear developer

after using -vvv in the command line I am getting the below results

Read quality thresholds (Q)

5 66929 100.0% 7 66049 98.7% 10 19683 29.4% 12 127 00.2% 15 0 00.0% 20 0 00.0% 25 0 00.0% 30 0 00.0%

I am wondering if is it possible to get the percentage of reads with >8 or >9 too?

THanks

esteinig commented 7 months ago

Hello! At the moment the thresholds are hard-coded, although that could probably be changed, as they are pretty arbitrary. I'll flag it for the next release as a feature, thanks for letting me know this is of interest.

In the meantime, you can work around it using nanoq, awk and bash - quite verbose, but it should work:

# output read q values as txt file and get total reads from summary stats
total_reads=$(nanoq -i test.fq -s -Q qual.txt | cut -d' ' -f1)

# count reads greater than threshold in list
gt9=$(awk '$1>9{c++} END{print c+0}' qual.txt)   # > 9.0
gt8=$(awk '$1>8{c++} END{print c+0}' qual.txt)   # > 8.0

# divide and multiply for percentage
echo "scale=2 ; ($gt9 / $total_reads)*100" | bc  # > 9.0
echo "scale=2 ; ($gt8 / $total_reads)*100" | bc  # > 8.0