Question: compute genome coverage from specific bam contig
gravatar for regue.hadrien
5 months ago by
regue.hadrien30 wrote:

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 • 178 views
ADD COMMENTlink written 5 months ago by regue.hadrien30
gravatar for Pierre Lindenbaum
5 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum131k wrote:

use mosdepth with --chrom option.

ADD COMMENTlink written 5 months ago by Pierre Lindenbaum131k

It worked perfectly, thx a lot:)

ADD REPLYlink written 5 months ago by regue.hadrien30
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2136 users visited in the last hour