BED is a tab-delimited format for genomic intervals.

TL;DR

  • BED uses 0-based, half-open coordinates: [start, end).
  • Minimum valid BED record is 3 fields: chrom, start, end.
  • BED6 (+ name, score, strand) is a common interoperable subset.
  • BED12 extends BED for exon/block models (for example transcripts).
  • bedtools is the standard toolkit for overlap, merge, subtract, and coverage operations.
  • gxf2bed is useful for converting GTF/GFF annotations into BED coordinates.

Structure

A BED file is plain text, one interval per line, tab-delimited.

Required BED3 fields:

  1. chromosome
  2. start (0-based)
  3. end (half-open)

Simple BED3 example:

chr1	1000	2000
chr1	2500	2600
chr2	150	400

Common BED6 example:

chr1	1000	2000	peak_001	850	+
chr1	2500	2600	peak_002	420	-

BED12 adds block structure (used for transcript/exon-style annotations), including fields like thickStart, thickEnd, itemRgb, blockCount, blockSizes, and blockStarts.

Coordinate model (important)

BED uses 0-based start and end-exclusive coordinates.

  • Interval chr1 100 200 includes bases 101..200 in 1-based closed notation.
  • Length is end - start (here: 100 bp).

Practical Conventions

  • Use tabs, not spaces, between columns.
  • Keep chromosome naming consistent (chr1 vs 1) across all files in a workflow.
  • Ensure start < end for every interval.
  • Use sorted BED for reproducible downstream behavior.
  • Prefer BED6 when strand-aware operations are needed.

Common Pitfalls

  • Mixing coordinate systems (BED 0-based vs GFF/GTF often 1-based).
  • Unsorted BED files causing unexpected merge/intersect results.
  • Inconsistent chromosome naming between BED and reference/alignment files.
  • Invalid intervals (start >= end) or negative starts.
  • Assuming all tools interpret optional columns the same way.

Common Uses

  • Region annotation
  • Peak calls
  • Intersections and interval operations

Useful BED Tools

bedtools sort

Sort BED intervals for stable downstream processing.

bedtools sort -i regions.bed > regions.sorted.bed

bedtools intersect

Find overlaps between two interval sets.

bedtools intersect \
  -a peaks.sorted.bed \
  -b genes.sorted.bed \
  -wa -wb > peaks_in_genes.tsv

bedtools merge

Merge overlapping or adjacent intervals.

bedtools merge -i regions.sorted.bed > regions.merged.bed

bedtools coverage

Compute coverage of features over targets.

bedtools coverage \
  -a targets.sorted.bed \
  -b alignments.bed > target_coverage.tsv

gxf2bed

Convert GTF/GFF-style annotation files to BED.

# convert GTF to BED
gxf2bed annotations.gtf > annotations.bed

# convert GFF3 to BED
gxf2bed annotations.gff3 > annotations.bed