Hi there,
I have a BAM file containing mutliple contigs. I want to compute coverage only on a specific contig. I'm usualy using bedtools for computing coverage directly on my bam, like that:
bedtools genomecov -ibam simple.bam > simple.cov
The problem is that when i'm using this command on my "multiple.sam" the coverage of every contig is computed, including human chromosone, that I dont want in output.
I started to search a way to filtrate my bam,like this one (MN908947.3 is the only contig I want to keep) :
samtools view -b multiple.bam MN908947.3 > filtrate.bam
bedtools genomecov -ibam filtrate.bam -d > result.cov
But it's exactly the same result, bedtools compute every contig , ie 0 because for almost contig because bam is filtrated. This file is to huge to be handled easly.
I started to read more about this tool here : samjs but I dont realy know if this tool can solve my problem, and how to use it with java synthax.
Do you have any clues?
Thx and stay safe:)
It worked perfectly, thx a lot:)