I am trying to index a bam file that was generated by bwa mem from a PacBio run (fastq) that did not contain any read names.
I don't want to run the alignment again. Of course, Edit: if the purpose of the index is to find reads by name (Edit: which is not the case), so this undertaking is somewhat silly but some tools require the bam file to be indexed. Also, I cannot just number the rows in the bam file because some may come from the same read. Is it possible?


    $ samtools index -@50 SMRT1_Crogercresseyi.bam
    [E::hts_idx_push] NO_COOR reads not in a single block at the end 7 -1
    samtools index: failed to create index for "SMRT1_Crogercresseyi.bam"
I don't understand this.  The purpose of the BAM index is to find reads when queried by location, not by name.  Read names should have no impact on indexing.

Is your data aligned, and sorted by chromosome/position order?