Skip to content

Minimum depth threshold for "samtools coverage"? #1563

Description

@charlesfoster

Is your feature request related to a problem? Please specify.

I'd like a simple way to calculate the coverage stats for a bam file. The closest out-of-the-box thing I can find is samtools coverage. I run the command like so:

samtools coverage input.bam

The simple summary stats are great, and what I need, except for the fact that the 'covbases' statistic is defined as 'Number of covered bases with depth >= 1'. Instead, I would prefer to have the statistic of 'Number of covered bases with depth >= X', where X is a minimum depth defined by a command line flag.

Describe the solution you would like.

I would like to be able to use a command like:

samtools coverage --min-depth 20 input.bam

With the output statistics being calculated (in this case) only for bases covered with depth >=20. Would this be possible? So far I use a different command like:

bedtools genomecov -ibam input.bam -d | awk '$3 >= 20 { count++ } END { print (count/NR)*100 }'

But I'd prefer to have the much simpler samtools command and simplify the dependencies of my pipeline.

Would this be possible? Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions