How to work out coverage (100X) of WES using exome bed file?
2
0
Entering edit mode
2.0 years ago
amy__ ▴ 160

Hello,

I know that there are lots of coverage questions on here but quite a few are 10 years + and really confusing.

I have WES fastq files, I have mapped these to hg38 and have their bam files. I also have the bed files for the Exome panel used in the sequencing.

I wish to work out the coverage (like 100X). I know that bedtools has a way but I am finding it hard to work out.

Do I need to get a list of the gene locations even though I have the exon region bed files?

Thanks! Amy

bed WES coverage • 1.6k views
ADD COMMENT
3
Entering edit mode
2.0 years ago
ATpoint 81k

Adapting from Tools To Calculate Average Coverage For A Bam File?:

samtools view -u -L exome.bed your.bam \
| samtools depth -a \
|  awk '{sum+=$3} END { print "Average = ",sum/NR}'

The first one subsets for alignment covering the exome (use the bed file with the targets of the capture), and the rest then calculated the average coverage.

ADD COMMENT
2
Entering edit mode

samtools depth can use a bedfile

samtools depth -b exome.bed -a in.bam |  awk '{sum+=$3} END { print "Average = ",sum/NR}'
ADD REPLY
0
Entering edit mode

Thank you so much, I will try this!

ADD REPLY
0
Entering edit mode

Hi ATpoint, do you know what the variable $3 is? Thanks! Amy

ADD REPLY
1
Entering edit mode

What do you mean? The third column in the depth output (that is what $3) means is what we want to sum up. Does that make sense?

ADD REPLY
0
Entering edit mode

Hi, yes you are right, I'm sorry! Slurm was messing with the command! Thanks for all your help

ADD REPLY
3
Entering edit mode
2.0 years ago

https://github.com/brentp/mosdepth

mosdepth  -by exome.bed  --no-per-base output in.bam

look into the summary Total region to get the mean depth

ADD COMMENT

Login before adding your answer.

Traffic: 2676 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6