This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to calculate average depth for each Amplicon in targeted amplicon sequencing?

Hello,

I am working with targeted amplicon sequencing data for 200 samples! I want to calculate the average depth per amplicon? I tried bedtools coverage, but it gives total number of reads which map to the target region and I am not sure if that is the average depth. It is little confusing to me.

command used:

/home/tools/bedtools2/bin/bedtools coverage -a ../../amplicon_coords.bed -b sample1_RG_sorted_indexed.bam

Is there any other way or any modified way to use bedtools coverage option to calculate the average depth per amplicon?

Any help will be appreciated.

Thanks!!

next-gen bedtools

I recently saw some things about ampvis2, which might be of interest for you, see for example this blog post.

2 answers

I wrote bamstats04: http://lindenb.github.io/jvarkit/BamStats04.html

$ java -jar dist/bamstats04.jar -B src/test/resources/toy.bed.gz src/test/resources/toy.bam 2> /dev/null | column -t 

#chrom  start  end  length  sample  mincov  maxcov  meancov  mediancov  nocoveragebp  percentcovered
ref     10     13   3       S1      3       3       3.0      3.0        0             100
ref2    1      2    1       S1      2       2       2.0      2.0        0             100
ref2    13     14   1       S1      6       6       6.0      6.0        0             100
ref2    16     17   1       S1      6       6       6.0      6.0        0             100

Thanks @Pierre Kindenbaum!! It is very helpful!! Also easy to understand!

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

I am getting this type of results by following your command of bamstats... am confused with the coverage..how can i describe it. please help

#chrom start end length  sample mincov maxcov avgcov_0 mediancov_0 nocoveragebp_0 percentcovered_0
chr6  88278254 88278533 279     44      104     207   183.3763440860215      206.0      0     100
chr6  88278254 88278533 279     88      120     244   210.26164874551972     241.0      0     100
chr6  88278254 88278533 279     45      70      142   122.12544802867383     142.0      0     100

Log in to answer this question.