First of all your samtools in ancient, almost 10 years old. Also, one would need to see the alignment command. Did you somehow modify the sam?
I'm aware of it but conda doesn't seem to want to upgrade it more, maybe I should install it manually.
Here's my alignment command with BWA:
bwa mem reference/ncbi-genomes-2023-05-16/mm39bwaidx RNA-Exo-Mouse-[...]_R1_001.fastq.gz RNA-Exo-Mouse-[...]_R2_001.fastq.gz > sam_files/aln-pe_RNA-Exo-Mouse-[...].sam
I have 12 fastq files, they're paired end. I didn't modified the sam at all, it's how it was generated by bwa.
I confess I only used bwa and samtools once during a course but it's been a while, I probably messed up somewhere.
These days one should use pipes, for example as below, and never store sams as they're big and useless as not compressed. bam is the format to use downstream. You could replace view by sort right away, too.
Okay, thank you for your recommendations!