sam to sorted bam code example Example: convert bam to sam samtools samtools view -h -o yourDir/test.sam test.bam