This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Segmentation fault (core dumped) with Samtools index sorted.bam

I am trying to create an index file for the sorted bam. But I am getting the error "Segmentation fault (core dumped)".

Samtools sort command was successful.

Samtools flagstat command shows up the following:

17882888 + 1 in total (QC-passed reads + QC-failed reads)  
0 + 0 duplicates  
17882888 + 1 mapped (100.00%:100.00%)
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)

...

I do not understand why the index command fails. Is the bam file I am working with is corrupted? How can I make sure of it? Samtools version I am using is "Version: 0.1.18 (r982:295)".

I was wondering if anyone can help me out.

Thank you!

samtools index bam

1 answer

Version 0.1.18 is truly ancient, please upgrade. If you still get a segfault with a recent version then something is wrong with you BAM file. I would then samtools view -h original.bam | samtools view -bo new.bam - to generate a new copy of the file and then index that.

Original.bam in the sense sorted.bam?

Yes, whatever it's called.

Log in to answer this question.