bedtools2
bedtools2 copied to clipboard
bedtools genomecov and non-primary alignments
Does genomecov use non-primary alignments (secondary/supplementary) from the BAM in it's calculations? If so is there any in-built way to exclude them?
I've just come across this same query, and, from what I can tell, genomecov does use non-primary alignments. To figure this out, I compared it to calculations from mosdepth.
# 1. bedtools genomecov
bedtools genomecov -bga -ibam input.bam > bedtools.depth.tsv
# 2. mosdepth defaults: excluding non-primary, QC fail, unmapped reads, and duplicates = bitwise flag 1796
mosdepth default input.bam
# 3. mosdepth: excluding QC fail, unmapped reads, and duplicates = bitwise flag 1540
mosdepth -F 1540 flag1540 input.bam
The results of (1) and (3) were identical.
Thank you for doing the work I didn't!
Do you have any thoughts on the best way to exclude non-primary reads when running genomecov?
Pre-filter with samtools view?