Genome Builds and liftOver

The reference genome is not a single fixed thing: it comes in versions called builds. The same gene sits at different coordinates in hg19 and hg38, so a position without its build is half a sentence. Here is how to keep them straight and convert safely.

🟢 Beginner ⏱️ ~28 min 🌐 Just reading

Before you start

Learning objectives

By the end of this lesson you will be able to: explain what a genome build is, name the common human builds (GRCh37/hg19, GRCh38/hg38, T2T-CHM13), understand why a coordinate is meaningless without its build, convert coordinates between builds with liftOver or CrossMap, and spot the chr-prefix naming mismatch.

A reference genome has versions

A reference genome is one agreed-upon sequence that everyone aligns their reads against, so results are comparable. But the reference is improved over time as sequencing gets better and gaps are filled. Each released version is a build (also called an assembly). For human, the two you will meet constantly are GRCh37 (UCSC calls it hg19) and the newer GRCh38 (hg38). The very newest, gapless build is T2T-CHM13 (telomere-to-telomere).

The crucial consequence: when the assembly changes, sequence is added, removed, and shifted, so the same base of DNA gets a different coordinate in each build. A position like chr7:55,249,071 means one thing in hg19 and a different thing in hg38.

1The same gene, different numbers

Consider the gene EGFR. It is the same gene in every build, but its coordinates differ because the surrounding assembly shifted. This is exactly why you must always record which build your coordinates use.

BuildUCSC nameEGFR start (chr7, approx.)
GRCh37hg19chr7:55,086,725
GRCh38hg38chr7:55,019,017
T2T-CHM13chm13v2.0different again (newest, gapless)
hg19 hg38 EGFR EGFR ~55,086,725 ~55,019,017 Same gene, shifted coordinate. liftOver follows the dashed line.
EGFR is the same gene in both builds, but its coordinate differs. Converting between builds is called lifting over.

2Converting between builds: liftOver and CrossMap

You cannot just subtract a fixed number to go from hg19 to hg38; the offset varies along the genome. Instead you use a chain file, which records how each region maps from one build to the other, together with a tool that applies it. The two common tools are UCSC liftOver and CrossMap.

# UCSC liftOver: input.bed -> hg38, plus an unmapped file for regions that don't lift
liftOver input.bed hg19ToHg38.over.chain.gz output.bed unmapped.bed

# CrossMap does the same job and also handles BAM, VCF, GFF
CrossMap bed hg19ToHg38.over.chain.gz input.bed output.bed

Why some regions do not lift

If a stretch of DNA was rearranged or is missing in the target build, it has no clean mapping, so liftOver drops it into the unmapped file instead of guessing. Always check that file; silently losing features is a common mistake.

3The chr-prefix naming trap

Builds also differ in how chromosomes are named. UCSC writes chr1, chrX; Ensembl writes 1, X with no "chr". The underlying sequence can be identical, but a tool comparing chr1 to 1 finds zero matches because the strings differ. If your overlaps mysteriously come back empty, check the chromosome names first.

# strip the chr prefix to match Ensembl-style names
sed 's/^chr//' ucsc_style.bed > ensembl_style.bed

# or add it to go the other way
sed 's/^/chr/' ensembl_style.bed > ucsc_style.bed

Check your understanding

Which UCSC name corresponds to the GRCh38 human build?
Right. GRCh38 is hg38; GRCh37 is hg19. T2T-CHM13 is the newer, gapless assembly.
Why does the same DNA position have a different coordinate in hg19 vs hg38?
Correct. Each build is a revised assembly; insertions, deletions and rearrangements move coordinates, which is why you must record the build.
What do you need, besides a tool, to convert coordinates between two builds?
Exactly. liftOver and CrossMap both apply a chain file, because the offset between builds varies along the genome.
Your overlaps between a UCSC file and an Ensembl file come back empty. What should you check first?
Right. UCSC uses a chr prefix, Ensembl does not. The strings differ, so no chromosome matches. Normalise the names first.
After a liftOver, why should you inspect the unmapped output file?
Correct. Regions that were rearranged or are missing in the target build cannot be lifted, so they go to the unmapped file. Ignoring it silently loses features.
Next in Track 1

Reference genomes and indexing →