I'm doing the QC of bam files. I found there are 2 ways to remove the low mapping quality reads.
One is to remove reads by Q<30 like
samtools view -h -b -q 30 -U below_q30.bam aligned.bam
The other is to remove by flags 512 like
samtools view -F 512 -b sorted.bam > filtered_sorted.bam. Flag 512 represents the reads not passing the quality control when doing alignment by samtools.
I'm wondering whether it's necessary to do both of these 2 steps. I mean, What is the MAPQ value of flag 512 ? If flag 512 has the same MAPQ value as 30, then there's no need to do both steps, right?