You've almost certainly identified the problem. The error message is a complaint that the unaligned reads are not at the end of his BAM.
Hello
I've created an alignment (SAM and subsequently BAM file) using samtools. However, when I'm trying to create an index out of the BAM file I get the following message:
$ samtools index alignment.new.bam
[E::hts_idx_push] NO_COOR reads not in a single block at the end 15 -1
I have no clue what that means so any help would be much appreciated
Thanks
2 answers
I cannot tell from the post if you have sorted you bam file. You need to sort bam files before indexing them.
Thanks. That solved the problem :)
So, I am encountering a similar problem.
The message I receive is
[E::hts_idx_push] NO_COOR reads not in a single block at the end 0 -1
However I am not receiving this message for all samples. The script is a loop so all my samples are being treated the same, yet 3 made it through without error and three did not.
Here are my commands for reference.
samtools view -bS -T REFGENOME.fa SAMPLE1.sam > Sample1.bam
samtools sort SAMPLE1.bam SAMPLE1.sorted
samtools index SAMPLE1.sorted.bam
From here the data is passed to picard/GATK
Also just a note, my reference is E. coli so the problem isn't chromosome size limit.
Also, the sorted file needs to be coordinate sorted, not by feature name (don't include the -n parameter).
Log in to answer this question.
Can you paste the commands used for alignment and sam --> bam ?
For the alignment:
For Sam -> Bam