Question: samtools depth -a while removing duplicates
0
gravatar for QVINTVS_FABIVS_MAXIMVS
2.8 years ago by
USA SoCal
QVINTVS_FABIVS_MAXIMVS2.2k wrote:

I want to run samtools depth with the -a flag to capture positions with 0 coverage.

However due to the circumstances I do not have bam files with the duplicates removed. I realize I can run rmdups but we chose not to due to financial and time constraints (analyzing 1000s of whole genomes on cloud service)

So I would like to ensure I'm not counting duplicate reads with the samtools depth command. Is it possible to use a flag for this?

I would also like to include the -a flag because positions with 0 coverage are informative for my analysis.

Thanks!

depth samtools • 1.5k views
ADD COMMENTlink modified 2.8 years ago by winter_li40 • written 2.8 years ago by QVINTVS_FABIVS_MAXIMVS2.2k
1
gravatar for Devon Ryan
2.8 years ago by
Devon Ryan86k
Freiburg, Germany
Devon Ryan86k wrote:

There's no way to do this directly with samtools depth. If you really need this, then you can do it in either pysam (this is easier) or htslib (assuming you know C). In either case you'll need to write the duplicate removal code.

ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by Devon Ryan86k

I'm actually doing this in pysam but there is no depth function for Aligned_File class (I think). So I'm using pysam.depth()

I suppose you are correct. I could fetch the reads within a region, remove dups and hard code some per base pair depth function.

ADD REPLYlink written 2.8 years ago by QVINTVS_FABIVS_MAXIMVS2.2k

depth() is essentially a wrapper around mpileup, so just use the latter.

ADD REPLYlink written 2.8 years ago by Devon Ryan86k
0
gravatar for winter_li
2.8 years ago by
winter_li40
winter_li40 wrote:

I think if you wanna remove duplicates reads ,you must mark duplicates first. I recommend you to use Picard to do this.

ADD COMMENTlink written 2.8 years ago by winter_li40
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: 589 users visited in the last hour