This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to check coverage in bam file?

Hi all,

How do I check the coverage of bam files? These files are bam files derived from GTEx rna short reads. For fastq files, you can count the number of lines and divide by 4 to get the reads wc -l / 4. Is there anyway to get read coverage from bam files similarly?

SRR1092349.bam                     
SRR1366519.bam      
SRR1455653.bam              
SRR820448.bam
bam

2 answers

Read coverage can't be calculated by number of lines. You will need to use a program like pandepth (LINK) or modsepth (LINK) that can produce chromosome, specific interval or entire genome level estimates.

Is there way to get the overall coverage of one bam file instead of per chrmosome? Also would samtools fit for this?

What have you tried? Please google "BAM coverage" and use one of the tools you find, or explore samtools depth and mosdepth. GenoMax has mentioned mosdepth for a reason - it is a lot faster than samtools.

pandepth provides coverage across the entire genome.

##RegionLength: NNNNNNNNNNN    CoveredSite: NNNNNNNNN  Coverage(%): 99.85      MeanDepth: 10.40
$ samtools coverage -r chr11 in.bam
#rname  startpos  endpos  numreads  covbases  coverage  meandepth  meanbaseq  meanmapq
chr11    1         3302    358       3295      99.788    7.58237    17         60

Log in to answer this question.