The SAM/BAM format is a standard format for short read alignments. While SAM is the plain-text version of the alignments, BAM is compressed, binary format of the alignments that is used for space-saving. BamTools is a toolkit for handling BAM files. BamTools provides a powerful suite of command-lines programs for manipulating and querying BAM files for data.

The basic usage of BamTools is:

$ bamtools COMMAND [options]
where COMMAND is one of the following BamTools commands:

  • convert: Converts between BAM and a number of other formats
  • count: Prints number of alignments in BAM file(s)
  • coverage: Prints coverage statistics from the input BAM file
  • filter: Filters BAM file(s) by user-specified criteria
  • header: Prints BAM header information
  • index: Generates index for BAM file
  • merge: Merge multiple BAM files into single file
  • random: Select random alignments from existing BAM file(s), intended more as a testing tool
  • resolve: Resolves paired-end reads (marking the IsProperPair flag as needed)
  • revert: Removes duplicate marks and restores original base qualities
  • sort: Sorts the BAM file according to some criteria
  • split: Splits a BAM file on user-specified property, creating a new BAM output file for each value found
  • stats: Prints some basic statistics from input BAM file(s)

For detailed description and more information on a specific command, just type:

$ bamtools help COMMAND
or check the BamTools web,

The page Running BamTools Commands shows how to run BamTools on HCC.