This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bedtools - Errors in coveragedBed

Hi all.

I was running coverageBed with my exome bam file but it takes too long time and it hasn't returned output value.

Is it right that coverageBed takes much time to finish?

my bed file was very tiny so I thought that something might go in a wrong way.

below is my command and my bed file.

coverageBed -abam /DATA1/dmcb/TAR22_WES/TAR22S_sequence_readgroup_sort_dup_remove_realigned_recal.bam -b fgfr.bed -d > TAR22.cov.del.b36

10   123239372       123239472
next-gen sequencing sequence

How big is your bam file??

my bam file size is approximately 20G.

I thought that file B size was small that I expected it will take just less than 10 minutes.. but it is my mistake

therefore, how big is your fgfr.bed file? may it be restricting your output to that single region?

sharing a samtools view input.bam | head plus a head fgfr.bed outputs would help.

Related question: is there a tool that will do the same thing more quickly, possibly using an index for the bam file? After all, IGV can plot the coverage for a small region very quickly even for a large BAM file.

coverageBed does not only report coverage, but bins of coverage. if per base coverage is needed, samtools depth input.bam can be used, and it's fairly fast (uplimited to 8000x though).

1 answer

You might try this:

samtools view -u -L fgfr.bed myaln.bam \
| coverageBed -abam - -b fgfr.bed -d > out.bed

Which means: First get the reads overlapping your bed file, then do the counting.

With 20GB of bam file I'm not surprised coverageBed takes more then 10 min.

(By the way, the title of your post is misleading as there is no error reported in your question)

Log in to answer this question.