Manipulating SAM output

SAM files are rather big and when dealing with a high volume of HTS data, storage space can become an issue. Using samtools we can convert SAM files to BAM files (their binary equivalent files that are not human readable) that occupy much less space.

To convert your SAM file to a BAM file, you have to instruct samtools that the input is in SAM format (-S), the output should be in BAM format (-b) and that you want the output to be stored in the file specified by the -o option.

If you are not in there already, change into the data directory.


In [ ]:
cd data

Convert SAM to BAM using samtools and store the output in the file PAX5.bam:


In [ ]:
samtools view -bSo PAX5.bam PAX5.sam

What's next?

For a quick recap of what the tutorial covers head back to the introduction.

If you want a reintroduction to the tutorial dataset, head back to aligning the PAX5 sample to the genome.

Otherwise, let's continue on to visualising alignments in IGV.