This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Split BAM by average coverage

I have a BAM file of a microbial genome assembly, performed on CLC (assembly+read mappings). The assembly has some contigs with extremelly low or high coverages - about ten-fold bellow or above the "average" average coverage. Is there a easy way to extract contigs based on average coverage thresholdds? I want to have a closer look and possibly reassemble those contigs.

For example, one contigs with much above average coverage seems to be rRNA genes, and there seems to be a lot of SNPs there. I want to reassemble these reads with more stringent settings and see if I have multiple copies of the rRNA genes.

assembly bam genome

1 answer

Create a BED of your regions of interest and use, for example, GATK DepthOfCoverage to get the mean depth of those regions.

Create a new BED file with the filtered regions

Create a new BAM with samtools view -o new.bam -L select.bed old.bam

Log in to answer this question.