Errors with samtools depth on merged bam file
1
0
Entering edit mode
6.1 years ago
rbronste ▴ 420

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)
bam samtools sam • 1.6k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode
6.1 years ago

"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

command

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

output

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 COMMENT

Login before adding your answer.

Traffic: 2603 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