heard'emsay

反省してます

bam_header_read EOF marker is absent. The input is probably truncated.

これも海外から見る人が多そうなので英語も書いておこう。

$ samtools index foo.sorted.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 dump)

.bamファイルが壊れているらしい。
.samはまともなはずなのにいつからこうなったか。

What broke foo.sorted.bam?
I compared the bam files before and after sorting.

$samtools  flagstat foo.bam
8000000 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
7910957 + 0 mapped (98.89%:-nan%)
8000000 + 0 paired in sequencing
4000000 + 0 read1
4000000 + 0 read2
7859822 + 0 properly paired (98.25%:-nan%)
7899729 + 0 with itself and mate mapped
11228 + 0 singletons (0.14%:-nan%)
15109 + 0 with mate mapped to a different chr
14075 + 0 with mate mapped to a different chr (mapQ>=5)


$samtools  flagstat foo.sorted.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).
[bam_flagstat_core] Truncated file? Continue anyway.
0 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
0 + 0 mapped (-nan%:-nan%)
0 + 0 paired in sequencing
0 + 0 read1
0 + 0 read2
0 + 0 properly paired (-nan%:-nan%)
0 + 0 with itself and mate mapped
0 + 0 singletons (-nan%:-nan%)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)

Sorting process would have had trouble.

Although the cause of this phenomenon is still unclear, resorting bam fixed this trouble.

どうもsortのときに問題が起きているらしいな。sortのログを見ても特におかしなことは起きていないのだけれども。

結局sortをかけ直したらなおった。

$samtools sort foo.bam foo.sorted
$ samtools  flagstat  foo.sorted.bam 
8000000 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 duplicates
7910957 + 0 mapped (98.89%:-nan%)
8000000 + 0 paired in sequencing
4000000 + 0 read1
4000000 + 0 read2
7859822 + 0 properly paired (98.25%:-nan%)
7899729 + 0 with itself and mate mapped
11228 + 0 singletons (0.14%:-nan%)
15109 + 0 with mate mapped to a different chr
14075 + 0 with mate mapped to a different chr (mapQ>=5)