I'm trying to retrieve the number of reads and the number of alignments with MAPQ=0.
To address the question I'm using samtools
in the following way:
samtools view -@ 4 BAM | awk '{if($5==0) {print $0}}' > mapq0.sam
cut -f1 mapq0.sam | sort -u | wc -l
1606759 # Number of reads
wc -l mapq0.sam
2952315 #Number of alignments
However, I'm getting different numbers when running Samstat
:
MAPQ < 3 30814.0
I think I'm missing something very basic. Moreover, I'd expect to have a greater number in Samstat MAPQ<3 since obviously it also considers, MAPQ=1,2...
Any hint?
Thank you