The File-Format Alphabet Soup

SAM, BAM, VCF, GFF, GTF, BED… the acronyms are intimidating until you know the one question each format answers. After this, they'll never confuse you again.

🟢 Beginner ⏱️ ~40 min 🌐 Just reading

Before you start

Learning objectives

By the end of this lesson you will be able to: tell apart the common bioinformatics file formats including FASTA, FASTQ, SAM, BAM, VCF, BED, and GFF or GTF, and know at a glance what kind of data each one holds.

Beyond FASTA and FASTQ, a handful of other text formats show up constantly in genomics. Each one exists to answer a single, specific question. Learn the question, and the format makes sense. Here's the whole family.

How the formats fit together FASTQ raw reads SAM / BAM where reads mapped VCF the differences align call variants Reference genome (FASTA) + GFF / GTF annotation · BED regions maps reads to positions
A typical pipeline: reads → align against a reference → variants. Annotation (GFF/GTF, BED) says where the genes and regions are.

SAM / BAM Where did each read map?

After you sequence a sample, you have millions of short reads. The next step is figuring out where in the genome each read came from - that's alignment. The result is stored as SAM (Sequence Alignment/Map), a text table with one row per read showing which chromosome and position it matched.

# one read's row (simplified): name, position, sequence...
read1   chr7   55019021   ATGCGTACGT...   60

BAM is simply the compressed, binary version of SAM - same information, far smaller and faster for computers to read. You'll almost always store BAM and convert to readable SAM only when you need to look.

Why two versions?

A human sequencing run produces hundreds of millions of alignments. As plain-text SAM that's enormous; BAM squeezes it down. Rule of thumb: SAM = readable, BAM = efficient. The samtools program converts between them.

VCF How does this genome differ?

Once reads are aligned, you can ask: where does this individual's DNA differ from the reference? Each difference is a variant, and they're stored in a VCF (Variant Call Format) file - one row per variant, giving its position and what changed.

#CHROM  POS       ID    REF  ALT  QUAL
chr11   5227002   .     T    A    99
chr7    117559590 .     G    C    87

That first row reads: on chromosome 11, position 5,227,002, the reference has a T but this sample has an A. VCF is how genetic differences - including disease-causing mutations - are recorded and shared.

GFF / GTF Where are the genes?

A genome is just a long string of letters; GFF (General Feature Format) and its close cousin GTF are the annotation - the map that says "a gene starts here, an exon is there." Each row describes one feature: its type, chromosome, and start/end coordinates.

chr7  havana  gene  55019017  55211628  +  ...EGFR
chr7  havana  exon  55019017  55019365  +  ...

This is what lets a tool say "this variant falls inside the EGFR gene." GTF is a slightly stricter flavor of GFF used a lot in RNA-seq.

BED Which regions am I interested in?

BED is the simplest of all: a plain list of genomic intervals - chromosome, start, end - often with a name. It's the universal way to say "look at just these stretches of the genome."

chrom  start     end       name
chr7   55019017  55211628  EGFR
chr11  5225464   5227071   HBB

Decode the jargon: 0-based vs 1-based

A famous trap: BED counts positions from 0, while VCF and GFF count from 1. So the same base can have two different numbers depending on the format. It catches everyone once; just remember BED is the zero-based oddball.

Your quick reference

FASTASequences (genes, genomes, proteins) - header + sequence.
FASTQRaw sequencing reads with quality scores.
SAM / BAMWhere each read aligned to the genome (BAM = compressed).
VCFVariants - how a genome differs from the reference.
GFF / GTFAnnotation - where genes, exons, and other features are.
BEDA simple list of genomic regions of interest.

You don't need to memorize the exact columns - you'll look those up forever, and that's normal. What matters is recognizing each format on sight and knowing the question it answers. That alone puts you ahead of most beginners.

Check your understanding

You have aligned reads and want to find mutations. Which format holds the result?
VCF - it records variants (differences from the reference). The alignments themselves live in SAM/BAM; calling variants from them produces the VCF.
What's the difference between SAM and BAM?
None in content - BAM is just the compressed binary version of SAM. SAM is human-readable; BAM is smaller and faster for tools.
Which format tells a tool where a gene is located?
GFF or GTF - the annotation formats that map features (genes, exons) onto genome coordinates.
Which format is the 0-based oddball, counting positions from 0 instead of 1?
BED counts positions from 0, while VCF and GFF count from 1. It is the classic trap that catches everyone once.
What is the relationship between SAM and BAM?
BAM is simply the compressed, binary form of SAM, holding the same alignment information far more efficiently. The samtools program converts between them.
Next in Track 1

Biopython basics: parse, manipulate, write →