samtools bedcov [options] region.bed in1.sam|in1.bam|in1.cram[...]
Reports the total read base count (i.e. the sum of per base read depths) for each genomic region specified in the supplied BED file. The regions are output as they appear in the BED file and are 0-based. Counts for each alignment file supplied are reported in separate columns.
- -Q INT
Only count reads with mapping quality greater than INT
- -g FLAGS
By default, reads that have any of the flags UNMAP, SECONDARY, QCFAIL, or DUP set are skipped. To include these reads back in the analysis, use this option together with the desired flag or flag combination. FLAGS can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/), in octal by beginning with `0' (i.e. /^0[0-7]+/), as a decimal number not beginning with '0' or as a comma-separated list of flag names. 
For a list of flag names see samtools-flags(1).
- -G FLAGS
Discard any read that has any of the flags specified by FLAGS set. FLAGS are specified as for the -g option. [UNMAP,SECONDARY,QCFAIL,DUP]
Do not include deletions (D) and ref skips (N) in bedcov computation.
- -d INT
Print an additional column, for each file, containing the number of bases having a depth above and including the given threshold. If the option is not used, the extra column is not displayed. The option value must be an integer >= 0.
If this option is set, it will allows user to specify customized index file location(s) if the data folder does not contain any index file. Example usage: samtools bedcov [options] -X <in.bed> </data_folder/in1.bam> [...] </index_folder/index1.bai> [...]
Written by Heng Li from the Sanger Institute.
Samtools website: <http://www.htslib.org/>