I want to count the number of reads falling into specified regions. Why is there a difference when I used
-F 4 -L and just
samtools view -c -L ../../../gene_matrix/matrix_gene.bed ENCFF001KYF.bam
samtools view -c -F 4 -L ../../../gene_matrix/matrix_gene.bed ENCFF001KYF.bam
samtools view -c -F 4 ENCFF001KYF.bam
So, the number of mapped reads is 23240270. And when I search for the number of reads in a specified regions not taking into account
-F option, I am getting more reads (31168853) then I have the mapped reads. How is it possible? Why do I get some strange reads that fall into my region which flag is not set to 4? I though if the read is in the region then it will be for sure mapped.