I'm trying to find out the average depth of coverage per target region in a bed file. I can easily use bedtools -depth to find the depth of coverage at each base, but I'd much rather have it as average coverage per region. The bedtools "-hist" option produces 110 reports on one of my features. I only want 1 number (average coverage) per target region. Any way to do this?
I found threads from a few years ago but wonder if there is anything current. One of the solutions doesn't compile on my Ubuntu server and the bash script gets a "fatal: division by zero attempted"