After performing BWA MEM alignment, I want to extract only the reads with MAPQ 0, how to do it?
The "-q" parameter only filter out reads with MAPQ less then a specific value...therefore it is not working for me.
If this is not possible, is there any other strategy?
Here i explain my case: I´m analysing the chloroplast genome. First, i need to filter out all reads with MAPQ less then 40 in order to improve the mapping. Using: samtools view -q 40 input.sam output.bam But...since the reads mapped on the inverted repeats (IRs) regions have MAPQ 0 (because they perfectly map on both IRs), they are removed as well. Therefore, in order to recover them, i would extract the reads with MAPQ 0 e merge them back.
Is there any other way to solve it? Thank you for your help