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