I made a complete genome assembly and then tried to generate a bai using this command (with the file path):
samtools index /home/ims.santos06/bam/SRR062634.bam/home/ims.santos06/bam/SRR062634.bam.bai
but it did not work because of this error:
[E :: hts_idx_push] Unsorted positions on sequence # 6: 68538456 followed by 68538386 samtools index: failed to create index for "/home/ims.santos06/bam/SRR062634.bam".
Was it a mistake in the assembly? How do I solve this problem?