I have received a couple of bam files processed by CASAVA pipeline (CASAVA-1.9.0) from a collaborator. I would like to create index files for them using samtools index. All but one seem to behave as expected. However, there is this one bam file which results in Segmentation Fault. The error can be reproduced in samtools releases 0.1.18 and 0.1.19 .
Please do not suggest running samtools sort first, as I have tried it and it results in the same segfault error.
I was wondering if anyone can help me out.
P.S. Following dpryan79's suggestion, here is the output of bt when I tried running index inside gdb:
#0 0x000000371a88ede3 in __memcpy_sse2 () from /lib64/libc.so.6 #1 0x0000000000426686 in bgzf_read (fp=fp@entry=0x6620a0, data=<optimized out>, length=1597059097) at bgzf.c:358 #2 0x000000000042d170 in bam_read1 (fp=fp@entry=0x6620a0, b=b@entry=0x682ba0) at bam.c:218 #3 0x000000000043192f in bam_index_core (fp=fp@entry=0x6620a0) at bam_index.c:182 #4 0x000000000043392e in bam_index_build2 (fn=0x7fffffffe3c1 "../../data/BAMS/SS6004353.bam", _fnidx=_fnidx@entry=0x0) at bam_index.c:484 #5 0x0000000000433a89 in bam_index_build (fn=<optimized out>) at bam_index.c:510 #6 bam_index (argc=<optimized out>, argv=<optimized out>) at bam_index.c:520 #7 0x000000371a821b75 in __libc_start_main () from /lib64/libc.so.6 #8 0x000000000040337d in _start ()