compute genome coverage from specific bam contig
1
0
Entering edit mode
11 months ago

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:)

samtools bedtools • 301 views
ADD COMMENT
1
Entering edit mode
11 months ago

use mosdepth https://github.com/brentp/mosdepth/ with --chrom option.

ADD COMMENT
0
Entering edit mode

It worked perfectly, thx a lot:)

ADD REPLY

Login before adding your answer.

Traffic: 1371 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6