Error in indexing .bam files from STAR alignment using SAMtools
1
0
Entering edit mode
21 months ago

I have created sorted .bam files using STAR. I am trying to create .bai files using SAMtools1.14 I am able to index all but one of the files (generated at the same time with the same STAR command), but I get the following error:

samtools index: "file.bam" is in a format that cannot be usefully indexed

I am unclear as to why this is happening and what to do to fix the file so I can proceed.

SAMtools BAM STAR • 2.0k views
ADD COMMENT
0
Entering edit mode

Can you run samtools quickcheck -v your.bam?

ADD REPLY
0
Entering edit mode

and file file.bam

ADD REPLY
0
Entering edit mode

I get:

file.bam was not identified as sequence data

when I run samtools -v quickcheck

What does this mean?

ADD REPLY
0
Entering edit mode

This error is given when you try to index a non-SAM, non-BAM and non-CRAM file, but it's a file that is a recognised data type. So maybe it's not actually a bam file?

Using "htsfile file.bam" will give you some clues as to what htslib believes the file contents to be. You can also try "samtools view file.bam" to see if it can even be displayed. If both check out then this is more interesting and pointing to an indexing issue, but I suspect you'll find something amiss before that.

You could also try doing "less file.bam" (or "zless file.bam" if it's gzipped) to visually inspect it incase something obvious leaps out.

ADD REPLY
0
Entering edit mode
18 months ago
iamjli ▴ 10

I am encountering the same error. The bam file is empty which is what causes samtools index to fail.

I'm not sure why the alignment bam file is empty though.

Edit: I got it to work. Make sure not to overload your resources. Try some of the suggestions here.

ADD COMMENT

Login before adding your answer.

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