Question: Errors with samtools depth on merged bam file
gravatar for rbronste
4 months ago by
rbronste230 wrote:

After merging 6 bam files (samtools merge) I attempted to look at the read depth within a specific set of intervals and got the following error, not sure exactly why expect maybe the merge tool takes a sam and not a bam file?

samtools depth -b --bed /sonas-hs/tollkuhn/hpc_norepl/home/rbronste/refGene/promoter_example.bed /sonas-hs/hpc_norepl/home/rbronste/h_merged.bam /sonas-hs/hpc_norepl/home/rbronste/B_merged.bam

 [bam_header_read] EOF marker is absent. The input is probably truncated.
    [bam_header_read] invalid BAM binary header (this is not a BAM file).
    Segmentation fault (core dumped)
sam samtools bam • 184 views
ADD COMMENTlink modified 4 months ago by bioExplorer3.7k • written 4 months ago by rbronste230

Something is wrong with your BAM file. If you copied it somewhere, it may have been corrupted. Merge can be used on BAM files just fine, so somewhere along the line (whether before or after merging), one of your BAM files was messed up.

ADD REPLYlink written 4 months ago by jared.andrews071.9k
gravatar for bioExplorer
4 months ago by
bioExplorer3.7k wrote:

"EOF marker is absent" refers to the absence of a special empty BGZF block of 28 bytes, which samtools looks for at the end of the data to indicate the BAM file is complete.

If you see that error, either:

(a) Your file is somehow truncated or incomplete (Chances are more that this is the issue) (b) Your file is from a tool not writing this EOF marker (perhaps a very old samtools?)

Please share the command to generate this BAM file and the software name (samtools?) + it's version

Latest version of samtools provides utility to check for consistency of BAM file


$ samtools quickcheck -v -v -v *.bam


verbosity set to 3
checking out.bam
opened out.bam
out.bam is sequence data
out.bam has 194406 targets in header.
out.bam has good EOF block.

If your file is complete, you should see a message as shown above.

ADD COMMENTlink written 4 months ago by bioExplorer3.7k
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: 1894 users visited in the last hour