Truncate unevenly covered BAM file at certain coverage


Hello all,

This is basic enough question, but I can't seem to find the answer online.

I have a BAM from RNA-seq alignment which is very unevenly covered. However the mean coverage is huge (~100,000x - it's a mitochondrion). I want to use it for polishing, so I would like to retain about 100x "sliding window" (or simply at any given nucleotide) coverage across the whole chromosome, and lose the rest.

How can I achieve this?

Thank you in advance, as always

UPD: Apparently, there's a discussion here that directly answers my question.




Source link