I want to have an estimate of how many reads in a SAM file are mapped to the reference I'm using. I used
samtools view -S -F 0x0004 input.sam > output.sam
to filter out all reads that are not mapped but then I also saw this "proper pair" flag (0x0002) and got confused. Should I use this one (i.e. keep the reads containing it) instead of filtering out those reads containing 0x0004?
What exactly is a "proper pair"? Does it mean that the read itself as well as its mate are both mapped?