Question: How to calculate number of positions covered by at least 10 times in bam file?
0
gravatar for rimgubaev
5 months ago by
rimgubaev180
Russia/Moscow/Skoltech
rimgubaev180 wrote:

Hello everyone! I wonder if somebody could recommend how to calculate the number of positions covered by at least 10 times in bam file? To calculate the number of positions covered by at least once in the bam file I used this oneliner:

bedtools genomecov -ibam my_alignment.bam -bg | awk '{ s+=($3-$2) } END { print s }'

But I have no idea how to modify it, so please help!

ADD COMMENTlink modified 5 months ago by ATpoint38k • written 5 months ago by rimgubaev180
2
gravatar for Pierre Lindenbaum
5 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum130k wrote:
samtools depth in.bam | awk '($3>10)' | wc -l
ADD COMMENTlink modified 5 months ago • written 5 months ago by Pierre Lindenbaum130k

Thank you, that works well!

ADD REPLYlink written 5 months ago by rimgubaev180
2
gravatar for ATpoint
5 months ago by
ATpoint38k
Germany
ATpoint38k wrote:

A simple if does the trick.

bedtools genomecov -ibam my_alignment.bam -bg | awk '{ if($4 >= 10) s+=($3-$2) } END { print s }' foo
ADD COMMENTlink modified 5 months ago • written 5 months ago by ATpoint38k

Thanks, id is perfect!!!

ADD REPLYlink written 5 months ago by rimgubaev180
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 618 users visited in the last hour