Entering edit mode
2.4 years ago
Elizabeth Alice
•
0
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.
Can you run
samtools quickcheck -v your.bam
?and
file file.bam
I get:
when I run
samtools -v quickcheck
What does this mean?
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.