So I am recently getting my foot in the door in using bedtools and I had a question about correct usage for my end goal
I am looking to essentially filter a BAM file for reads that only have 100% intersection on regions specified with a bed file.
[====================BAM===================] (A) (-----------------) (-----------------------) (B)
I would only want to pull down reads in A that have complete overlap of reads in B.
The command I am using is:
bedtools intersect -F 1.0 -a file.bam -b regions.bed
However when I run
samtools mpileup -l regions.bed file.bam
I see that there are inconsistencies in the depth at each of the positions in the regions. This doesn't quite make sense to me intuitively because I would expect an even depth across each position in the region because the intersect should filter out reads with incomplete coverage across the region.
Perhaps I am thinking of the usages of these tools wrong though and could definitely use some help in clarifying either inconsistencies in my intuition or commands that don't match my intentions.