BAM

To load a set of BAM files merged into a single track see Merged BAM File.

A BAM file (.bam) is the binary version of a SAM file.  A SAM file (.sam) is a tab-delimited text file that contains sequence alignment data.   These formats are described on the SAM Tools web site: http://www.htslib.org. 

BAM, rather than SAM, is the recommended format for IGV. Starting with IGV 2.0.11, IUPAC ambiguity codes in BAM files are supported.

Indexing:  IGV requires that both SAM and BAM files be sorted by position and indexed, and that the index files follow a specific naming convention. Specifically,  a BAM index file should be named by appending .BAI to the bam file name. A SAM index filename is created by appending .SAI.  

  • The index files must have the same base file name and must reside in the same directory as the file that it indexes.
    • For example, the index file for test-xyz.bam would be named test-xyz.bam.bai or test-xyz.bai.
  • Multiple tools are available for sorting and indexing BAM files, including the igvtools package, at the SAM Tools website referenced above, and on GenePattern.  The GenePattern module for sorting and indexing is Picard.SortSam.
  • SAM files can be sorted and indexed using the igvtools package. Note: The .SAI index is an IGV format, and it does not work with samtools or any other application.

Chromosome names: Chromosome names must be consistent between the selected reference genome and the SAM/BAM data files. For convenience, IGV equates chromosome numbers and names of the form chr# (e.g., 1 and chr1 are equivalent).

One-based index: Start and end positions are identified using a one-based index. The end position is included. For example, setting start-end to 1-2 describes two bases, the first and second in the sequence.