ArticleslgStudy

computer science

BAM (file format)

BAM (file format) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand BAM (file format) rather than just read about it. In short: The BAM file format (which stands for Binary Alignment Map) is the lossless, compressed binary representation of a Sequence Alignment Map file. It is compressed by BGZF library and supports fast, random access.

BAM (file format) — main illustration
BAM (file format) — illustration

Key takeaways

  • BAM (file format) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect BAM (file format) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of BAM (file format) from memory before moving on to harder problems.

Reference excerpt

The BAM file format (which stands for Binary Alignment Map) is the lossless, compressed binary representation of a Sequence Alignment Map file. It is compressed by BGZF library and supports fast, random access. BAM is one of the most common file formats for raw genome sequencing data.

Schema BAM is the compressed binary representation of SAM (Sequence Alignment Map), a compact and index-able representation of nucleotide sequence alignments. The goal of indexing is to retrieve alignments that overlap a specific location quickly without having to go through all of them. Before indexing, BAM must be sorted by reference ID and then leftmost coordinate. BAM is in compressed BGZF format.

The structure of BAM files include a header section and an alignment section:

Header—The sample name, sample length, and alignment method are all included in this section. The alignments section contains alignments that are linked to specific information in the header section. Alignments—The read name, read sequence, read quality, alignment information, and custom tags are all included in this file. The chromosome, start coordinate, alignment quality, and match descriptor string are all included in the read name. Alignment Section includes the following: Read Group (RG) Barcode Tag (BC) Single-end alignment quality (SM) Paired-end alignment quality (AS) Edit distance tag (NM) Amplicon name tag (XN) BAM format uses 0-based coordinate system, where as SAM uses 1-based coordinate system. BAM can represent values in the range [−2^31 , 2^32).

Tools To view a list of sequencing and analysis tools that work with SAM/BAM click here.

See also FASTQ format SAM format SAMtools CRAM format List of file formats for molecular biology Compression of Genomic Sequencing Data

External links SAM format specification

References

Worked examples

Example 1 — a first encounter with BAM (file format)

Start with the simplest possible case. Write down what BAM (file format) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to BAM (file format) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about BAM (file format) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of BAM (file format)

In research
BAM (file format) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses BAM (file format) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
BAM (file format) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer file formats, Genomics, so understanding it makes those chapters shorter.
In everyday life
Look for BAM (file format) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “BAM (file format)” →

How to study BAM (file format) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what BAM (file format) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain BAM (file format) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is BAM (file format) in simple terms?

The BAM file format (which stands for Binary Alignment Map) is the lossless, compressed binary representation of a Sequence Alignment Map file. It is compressed by BGZF library and supports fast, random access.

Why does BAM (file format) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study BAM (file format)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on BAM (file format).

Tags

  • Computer file formats
  • Genomics

Keep exploring