convert sam <> bam

samtools view -bS my_file.sam > my_file.bam
bam is the compressed equivalent to sam. bam is around 4x smaller than sam and can be converted back by typing
samtools view -h my_file.bam > my_file.sam
  1. -b: output BAM
  2. -S: input is SAM
  3. -h: print header for the SAM output
Share itShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *