mosdepth icon indicating copy to clipboard operation
mosdepth copied to clipboard

FR - --reverse-thresholds

Open rjsicko opened this issue 5 years ago • 2 comments

For my use case, reversing the logic of the the --thresholds option would be helpful. Basically outputting the number of bases below the specified thresholds instead of greater than.

For clinical sequencing, I want a list of target regions that aren't covered by X reads. My previous clunky solution was: mosdepth --by $target_bed $out $bam | bedtools interesect -a $target.bed -b $sample.per-base.bed.gz -wao | awk (to get regions under threshold).

This time I'm going to try mosdepth -n --by $target.bed --threads 4 --thresholds 0,10,25,50 $out $bam | awk (calc num bases under thresholds by subtracting column 5 from 6,7 or 8 and grabbing the regions that are > 0)

Thanks, Bob

rjsicko avatar Mar 07 '19 19:03 rjsicko

I'd accept a PR where if one specified, e.g.: --thresholds -10,-25,-50, it would invert to count bases below.

brentp avatar Mar 07 '19 22:03 brentp

Nice, that is a better idea. I'll see if I can fumble my way through implementing that. For now, I solved my problem piping the quantized output to bedtools then piped to awk for no or low coverage.

rjsicko avatar Mar 07 '19 22:03 rjsicko