bam

.bamBinary Alignment Map

SAMtools and BCFtools development team · 2009

Developer
SAMtools and BCFtools development team
Category
GIS & Maps
MIME Type
application/octet-stream
First Released
2009
Open Format
Yes
File Signature
null
At a Glance
.bam
Binary Alignment Map

BAM is a compressed binary file format used to store large DNA sequencing alignment data for genomic analysis.

Reviewed on July 25, 2026
Compression
Compressed (BGZF)
Transparency
No
Editability
Low (requires specific tools)
Best for
Genomic alignment data

Key Features

  • Compressed binary representation of SAM
  • Efficient storage and faster I/O
  • Supports random access for targeted analysis
  • Widely adopted standard in bioinformatics

Best For

  • Storing and sharing large volumes of genomic alignment data
  • Enabling rapid querying and analysis of specific genomic regions
  • Reducing storage requirements compared to SAM files

Less Ideal For

  • Storing raw DNA sequencing reads before alignment
  • Human-readable text-based descriptions of alignments
  • General-purpose data storage outside of bioinformatics

Common Use Cases

  • Storing results from DNA sequencing experiments
  • Analyzing gene expression levels
  • Identifying genetic mutations and variations
  • Mapping short reads to a reference genome

How to Open It

  1. Use specialized bioinformatics software like IGV (Integrative Genomics Viewer) or Tablet.
  2. Open BAM files within command-line tools such as SAMtools, which is designed for manipulating these files.
  3. Load BAM files into web-based genome browsers like the UCSC Genome Browser or Ensembl.
  4. Utilize programming libraries in R (e.g., Rsamtools) or Python (e.g., pysam) for programmatic access.

What is a .bam file?

The Binary Alignment Map (BAM) format is a crucial component in modern genomics and bioinformatics. It serves as a compressed, binary version of the Sequence Alignment Map (SAM) format, making it significantly smaller and more efficient for storage and processing. BAM files store sequence alignment data, which details how short DNA sequences, generated by sequencing machines, map to a reference genome. This format is essential for analyzing genetic variations, gene expression, and other complex genomic data, forming the backbone of many research pipelines.

Programs That Open .bam Files

PlatformProgram
WindowsIGV (Integrative Genomics Viewer)Free
macOSIGV (Integrative Genomics Viewer)Free
LinuxSAMtoolsFreeOfficial
Web BrowserUCSC Genome BrowserFree

How to Convert .bam Files

FormatMethod
.SAMSAMtools, IGV
.WIGSAMtools (bedgraph), custom scripts

Common Problems with .bam Files

⚠️ File is too large.
Ensure BGZF compression is used and consider the CRAM format for further compression if appropriate.
⚠️ Cannot open file directly.
Use dedicated bioinformatics viewers or command-line tools that understand the BAM format, as it's not a standard document.

Frequently Asked Questions

What is the main advantage of BAM over SAM?

BAM is significantly smaller and faster to process due to its compressed binary nature, making it ideal for large genomic datasets.

Can I edit a BAM file with a text editor?

No, BAM files are binary and cannot be directly edited with standard text editors. You need specialized bioinformatics software or command-line tools.

What kind of data is stored in a BAM file?

BAM files store sequence alignment data, detailing how DNA sequencing reads map to a reference genome.

Technical Details

BAM is a binary encoding of the SAM format, designed for efficient storage and random access. It utilizes the BGZF (Blocked GNU Zip Format) compression algorithm, which allows for both compression and the ability to seek to specific regions within the file. Each record within a BAM file represents a single DNA sequence read and its alignment details against a reference.

Did You Know?

The BAM format is a binary compression of the SAM (Sequence Alignment Map) format, developed to overcome SAM's size and speed limitations.
BAM files are designed to be indexable, allowing quick access to specific genomic regions without reading the entire file.

Security Information

BAM files are data containers and do not typically pose a security risk themselves, but always download them from trusted bioinformatics sources to ensure data integrity.