Error in indexing .bam files from STAR alignment using SAMtools
0
0
Entering edit mode
5 weeks 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.

files STAR indexing SAMtools BAM • 325 views
0
Entering edit mode

Can you run samtools quickcheck -v your.bam?

0
Entering edit mode

and file file.bam

0
Entering edit mode

I get:

"file.bam was not identified as sequence data"

when I run samtools -v quickcheck

What does this mean?

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.