SAMtools: get breadth of coverage
Get breadth of coverage of a reference genome.
How many bases of my reference genome are covered by my short reads sample at a level of 5X or higher?
# set shell variables to your file-names
1) Map short reads against reference genome (bowtie2)
# create bowtie2 index database (database name: refgenome)
# map reads and sort bam file
-p 12 use 12 processors
2) Get breadth of coverage (SAMtools)
# create samtools index
# get total number of bases covered at MIN_COVERAGE_DEPTH or higher
# get length of reference genome
Result: breadth of reference genome coverage
total number of covered bases: 32876 (with >= 5X coverage depth)
Depth of coverage (average per-base coverage): 0.719 X (32876 ÷ 45678) (total number of covered bases divided by reference genome length)
percent: 71.9% (0.719 × 100) (coverage breadth in percent)