EOF marker problem with bam-readcount
Entering edit mode
4.8 years ago
Jokhe ▴ 120


I am trying to run VarScan2 with 'somatic' command to investigate somatic mutations in our normal-tumour pairs. As presented by the authors of VarScan2, false-positive filtering is recommended after variant calling by using additional fpfilter.pl tool. This tool, in turn, requires read counts generated by bam-readcount tool. This is the step where I'm having a frustrating problem.

I have paired-end sequencing data in FASTQ format and I have aligned it by using BWA-MEM without any errors, Generated SAM file is then converted into BAM format by using Samtools (v. 1.3.1.) with following commands;

# Convert SAM into sorted BAM
$SAMTOOLS view -b -S -@ 4 $SAMPLE.sam | $SAMTOOLS sort -o $SAMPLE.bam -@ 4
rm $SAMPLE.sam

# Index BAM file by using Samtools.

This BAM file should be later used in bam-readcount. However, when I try to run this tool I get the following error message.


./bin/bamreadcount: line 18: 31700 Segmentation fault $BAM_READCOUNT -q 1 -b 20 -f $REFERENCE $VARIANTS $SAMPLE.bam > $SAMPLE.readcounts
Minimum mapping quality is set to 1
[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).

On the basis of post published in SEQanswers I have checked the presence of EOF marker in my BAM file;

tail $SAMPLE.bam | hexdump -C

00000000  fe 28 76 1a 46 4b 49 3a  cb f8 5c 55 1a 40 6a db  |.(v.FKI:..\U.@j.|
00000010  24 09 c3 32 c9 c3 0c cb  d4 8b 4a a9 03 ac dd ad  |$..2......J.....|
00000020  8c fb 39 09 8f b2 4d 83  ad ce 7d 66 0b d6 f0 ba  |..9...M...}f....|
00000030  5a f7 59 06 01 3e 7f 79  f9 7c 03 53 05 93 c6 84  |Z.Y..>.y.|.S....|
00000040  b8 05 83 9d 92 2e c6 da  4d 64 4c 08 d6 64 92 8c  |........MdL..d..|

As far as I understand, the EOF marker is present but it slightly different than EOF marker presented in SEQanswers post. My BAM file is working just fine in all other tools I'm using so this seems to be strange phenomena. Is my EOF marker somehow malformed or should I do something differently? I am aware that there are some previous answers to this kind of problem but none of them has helped me so far. So please, I am grateful for all suggestions. Thank you in advance.

bam-readcount Samtools EOF-marker • 2.0k views
Entering edit mode
4.8 years ago

The EOF is completely absent, your file got either truncated or corrupted at some point. You cannot fully recover from this error.

Entering edit mode

I see, thanks Devon. I have tried to generate files from the beginning with same problems. I'm now trying to troubleshoot if this could be caused by memory issues as it seems to be one the most common issues with EOF and Samtools. I will give it a try and see how it works.


Login before adding your answer.

Traffic: 2243 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6