$ samtools view -b -S file.sam > file.bam $ samtools sort file.bam file-sorted $ samtools index file-sorted.bam