Thanks.
However, I think it the two regions are overlapped, this overlapped region will have larger depth of coverage than the others, which is not exactly the real depth of the target region.
Say, the two regions are 200 bp each, of which 100 bp region is overlapped, each of the region is sequenced 100X,
then the depth of the overlapped 100 bp region will be 200X while the other is 100X.
And the original thought is to get the sequenced depth.
I still can not find the best solution to this,
1) mapping to each target region only, discard those mapped reads less than 50 bp? then calculate the depth of this reigon.
2) use samtools to dump the bam to depth of each position, then get the median value as the sequence depth.
However, none of these ideas is the best I considered.