This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Genomecov 0 or 1 based results?

Hi all,

From what I understand BED and BAM format are 0-based (but BED is exclusive on the stop).

I have to process precisely results from 'bedtools genomecov' and I don't agree with the results I found (if the previous statement is correct). To check this I created a 1 line BAM file (with the appropriate header):

read1    0       Chr3    5130    255     51M     *       0       0       ATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATG     CCCFFFFFHHHHHCGIJJJJJJJJJJJJJHIJJJJJJJJJJJJJIJJIJJJ

And I now try that:

bedtools genomecov -bg -split -strand + -ibam read1.bam

And get that:

Chr3    5129    5180    1

From what I understand, I should get:

Chr3    5130    5181    1

because the BAM is supposed to be already 0-based and the stop should be 5181 (5130+51).

Am I wrong somewhere?

Cheers,
Mathieu

bedtools

1 answer

Ok sorry, I think I understood why. I'm looking at the BAM file but in the SAM format which 1-based.

Yes this can be very confusing, the 0 based BAM applies only internally when you look at it with samtools it has already been converted. Thanks for following up with an answer.

Log in to answer this question.