Samtools
Convert SAM to BAM:
samtools view -bS Mapped_and_unmapped_Solanaceae.sam > S28_mapped_and_unmapped.bam
Sort BAM file:
samtools sort S28_mapped_and_unmapped.bam -o S28_sorted.bam
Create BAM index:
samtools index S28_sorted.bam S28_sorted.bai