I am generating overlaps using this command in bedtools:
intersectBed -a snps.bed -b region.bed -wb
And now I am trying to compare the same files using the R package GenomicRanges, countOverlaps(snps, region.bed, type=c("within"), but I am not getting the same results.
In particular, it seems as the positions at the borderline of the region.bed are not counted as overlaps, for example this entry in snps.bed: 1 112162878 112162879
and this entry in region.bed: 1 112162834 112162878
Is this what others have seen as well? How can I get bedtools to count these entries as overlaps, without adding flanking bases? Thank you