samtools convert sam to bam code example
Example 1: samtools convert bam to sam
# Basic syntax:
samtools view -S -b sample.sam > sample.bam
# Where
# -S specifies that the input is a sam file
# -b specified that the output should be written in bam format
Example 2: convert bam to sam samtools
samtools view -h -o yourDir/test.sam test.bam