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 alignment (usually one per read; unmapped reads are kept too) showing which chromosome and position it matched.

# one read's row, heavily simplified (real SAM has 11 fixed columns:
# QNAME FLAG RNAME POS MAPQ CIGAR RNEXT PNEXT TLEN SEQ QUAL)
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  FILTER  INFO
chr11   5227002   .     T    A    99    PASS    .
chr7    117559590 .     G    C    87    PASS    .
# GRCh38 coordinates; the first row is the sickle-cell change in HBB (rs334),
# the second is illustrative. Real VCFs then add FORMAT and one column per sample.

That first row reads: on chromosome 11, position 5,227,002, the reference has a T and an A was observed instead (the per-sample columns, left out here, say which samples carry it). 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 (Generic 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 close relative of the older GFF2, required to carry gene_id and transcript_id for every feature, and is used a lot in RNA-seq; GFF3 is the current GFF version.

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(0-based)  end  name   (no header line in a real BED file)
chr7   55019016  55211628  EGFR
chr11  5225463   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: compare the EGFR start in the GFF (55019017) with the BED (55019016). BED ends are not shifted, because BED intervals are half-open (the end base is not included). It catches everyone once; BAM and Python also count from 0, but among the text files you read by eye, BED is the odd one out.

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.
You want to give a tool a simple list of genome regions to look at (for example, a set of target genes). Which format is built for that?
Right. BED is a plain list of regions: chromosome, start and end, plus optional extras like a name. VCF lists variants and FASTQ holds reads.

Sources & further reading

  1. Li H, Handsaker B, Wysoker A, et al. The Sequence Alignment/Map format and SAMtools. Bioinformatics 25: 2078-2079, 2009. doi:10.1093/bioinformatics/btp352
  2. Danecek P, Auton A, Abecasis G, et al. The variant call format and VCFtools. Bioinformatics 27: 2156-2158, 2011. doi:10.1093/bioinformatics/btr330
  3. Danecek P, Bonfield JK, Liddle J, et al. Twelve years of SAMtools and BCFtools. GigaScience 10: giab008, 2021. doi:10.1093/gigascience/giab008

Official specifications and documentation:
SAM, VCF and BED specifications (hts-specs): samtools.github.io.
UCSC Genome Browser data file formats (BED, GFF/GTF): genome.ucsc.edu.
GFF3 specification, Sequence Ontology: github.com.
Last reviewed: October 2026.

Next in Track 1

Biopython basics: parse, manipulate, write →