I have mapped reads (SAM/BAM) from resequencing and I need an elegant way of calculating depth of coverage for a slices of assembly (let's say 100bp). It's possible to use samtools:
samtools view -c reads.bam contig1.142:2000-1000
but this just count number of reads that are completely aligned to given fragment and a strand (FLAG: 0 - forward 16 - reverse) if I'm right. Do you know any better way of doing it?