I have a bam file and I have a bed file with my region of interests. Now I'm interested in the mean coverage for each of these region. That's no problem with picard's CollectHsMetrics and the PER_TARGET_COVERAGE flag.
But now I would like to exclude those reads in coverage calculation that doesn't overlap my target region with a given fraction or at least given bases.
I feel that bedtools might help me here. But I didn't figure out until now how.
Can someone help me?