Skill Tracer
Skills › Scientific Agent Skills › genomic-coordinates › reference-builds.md

reference-builds.md

159 lines · skills/genomic-coordinates/references/reference-builds.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Reference builds, contig naming, and liftover
2
3A coordinate is meaningless without the assembly it was measured against. Two
4files can share contig names, share a coordinate range, join cleanly, and refer
5to different parts of the genome.
6
7All lengths below were read from the UCSC `bigZips` `chrom.sizes` for each
8assembly; all 24 nuclear lengths in the bundled tables were rechecked against
9those downloads on 2026-10-01. GRCh37 mitochondrial context is documented by UCSC. `scripts/check_contigs.py` carries the same table and
10matches files against it.

Reference builds, contig naming, and liftover

A coordinate is meaningless without the assembly it was measured against. Two files can share contig names, share a coordinate range, join cleanly, and refer to different parts of the genome.

All lengths below were read from the UCSC bigZips chrom.sizes for each assembly; all 24 nuclear lengths in the bundled tables were rechecked against those downloads on 2026-10-01. GRCh37 mitochondrial context is documented by UCSC. scripts/check_contigs.py carries the same table and matches files against it.

Raw lines 1 to 11
Runs code scripts/check_contigs.py :9
12## Discriminating lengths
14| Contig | GRCh37 / hg19 | GRCh38 / hg38 | T2T-CHM13v2.0 / hs1 |
15| --- | --- | --- | --- |
16| chr1 | 249,250,621 | 248,956,422 | 248,387,328 |
17| chr2 | 243,199,373 | 242,193,529 | 242,696,752 |
18| chrX | 155,270,560 | 156,040,895 | 154,259,566 |
19| chrY | 59,373,566 | 57,227,415 | 62,460,029 |
20| chrM / MT | 16,571 *(hg19)* / 16,569 *(GRCh37)* | 16,569 | 16,569 |
22```bash
23python3 check_contigs.py --identify unknown.fa.fai
24```

Discriminating lengths

ContigGRCh37 / hg19GRCh38 / hg38T2T-CHM13v2.0 / hs1
chr1249,250,621248,956,422248,387,328
chr2243,199,373242,193,529242,696,752
chrX155,270,560156,040,895154,259,566
chrY59,373,56657,227,41562,460,029
chrM / MT16,571 (hg19) / 16,569 (GRCh37)16,56916,569
python3 check_contigs.py --identify unknown.fa.fai
Raw lines 12 to 25
Runs code python3 check_contigs.py :23
26## GRCh37 is not hg19
28They are the same assembly for every primary chromosome except the
29mitochondrion. UCSC's hg19 kept the older `NC_001807` sequence at **16,571 bp**;
30GRCh37 adopted the revised Cambridge Reference Sequence (rCRS, `NC_012920`) at
31**16,569 bp**. GRCh38 also uses rCRS, so chrM length distinguishes hg19 from
32everything else but does not distinguish GRCh37 from GRCh38.
34Consequences:
36- Mitochondrial coordinates and alleles cannot be compared by renaming alone;
37 some positions agree while others shift or refer to different bases.
38- Use reference-aware sequence mapping and allele checks, or re-call from reads,
39 before comparing mtDNA calls. Re-calling is not the only possible conversion.
41The two also differ in naming and in alternate-haplotype handling:
43| | GRCh37 (Ensembl/NCBI) | hg19 (UCSC) |
44| --- | --- | --- |
45| Autosomes | `1`, `2`, … | `chr1`, `chr2`, … |
46| Mitochondrion | `MT` (16,569) | `chrM` (16,571) |
47| Alt haplotypes | `GL000250.1`-style | 9 `chr6_cox_hap2`-style contigs |
48| Unplaced | `GL000191.1`-style | `chrUn_gl000191` |

GRCh37 is not hg19

They are the same assembly for every primary chromosome except the mitochondrion. UCSC's hg19 kept the older NC_001807 sequence at 16,571 bp; GRCh37 adopted the revised Cambridge Reference Sequence (rCRS, NC_012920) at 16,569 bp. GRCh38 also uses rCRS, so chrM length distinguishes hg19 from everything else but does not distinguish GRCh37 from GRCh38.

Consequences:

  • Mitochondrial coordinates and alleles cannot be compared by renaming alone; some positions agree while others shift or refer to different bases.
  • Use reference-aware sequence mapping and allele checks, or re-call from reads, before comparing mtDNA calls. Re-calling is not the only possible conversion.

The two also differ in naming and in alternate-haplotype handling:

GRCh37 (Ensembl/NCBI)hg19 (UCSC)
Autosomes1, 2, …chr1, chr2, …
MitochondrionMT (16,569)chrM (16,571)
Alt haplotypesGL000250.1-style9 chr6_cox_hap2-style contigs
UnplacedGL000191.1-stylechrUn_gl000191
Raw lines 26 to 49
50### The b37 family
52`b37` (Broad) is GRCh37 with plain naming and rCRS `MT`. `hs37d5` (1000 Genomes
53phase 2) is b37 plus a decoy contig (`hs37d5`) and the EBV genome. Shared primary
54sequences can use an audited name map without liftover. Whole files are not
55equivalent: decoy/EBV records have no counterpart in a smaller reference, and
56reads may map elsewhere or remain unmapped when decoys are removed.

The b37 family

b37 (Broad) is GRCh37 with plain naming and rCRS MT. hs37d5 (1000 Genomes phase 2) is b37 plus a decoy contig (hs37d5) and the EBV genome. Shared primary sequences can use an audited name map without liftover. Whole files are not equivalent: decoy/EBV records have no counterpart in a smaller reference, and reads may map elsewhere or remain unmapped when decoys are removed.

Raw lines 50 to 57
58## GRCh38 and its ALT contigs
60The base UCSC `hg38.chrom.sizes` download checked in this review has 455
61sequences: 25 primary/mitochondrial, **261 `_alt`**, 42 `_random`, and 127 `chrUn_`.
62These counts describe that download, not every GRCh38 patch or analysis set. The ALT contigs are alternate representations of
63regions that are genuinely polymorphic — mostly MHC, and the HLA haplotypes.
65ALT sequence can affect multi-mapping, MAPQ and downstream coverage. The
66outcome depends on the aligner and its ALT handling; equal alignments do not
67universally receive MAPQ 0. Use the reference bundle and ALT-aware alignment
68procedure documented for the chosen pipeline. A no-ALT set is a distinct
69analysis choice, not a universal default.
71Some analysis sets mask duplicated regions such as chrY PARs. Contig lengths
72cannot reveal masking or same-length substitutions. Record the exact FASTA
73checksum and sequence dictionary, not just a build label.
75Patch releases (`GRCh38.p13`, `p14`) add `_fix` and new `_alt` contigs but never
76move a coordinate on a primary chromosome. Shared unchanged sequences keep their coordinates; patch-contig availability differs.

GRCh38 and its ALT contigs

The base UCSC hg38.chrom.sizes download checked in this review has 455 sequences: 25 primary/mitochondrial, **261 _alt**, 42 _random, and 127 chrUn_. These counts describe that download, not every GRCh38 patch or analysis set. The ALT contigs are alternate representations of regions that are genuinely polymorphic — mostly MHC, and the HLA haplotypes.

ALT sequence can affect multi-mapping, MAPQ and downstream coverage. The outcome depends on the aligner and its ALT handling; equal alignments do not universally receive MAPQ 0. Use the reference bundle and ALT-aware alignment procedure documented for the chosen pipeline. A no-ALT set is a distinct analysis choice, not a universal default.

Some analysis sets mask duplicated regions such as chrY PARs. Contig lengths cannot reveal masking or same-length substitutions. Record the exact FASTA checksum and sequence dictionary, not just a build label.

Patch releases (GRCh38.p13, p14) add _fix and new _alt contigs but never move a coordinate on a primary chromosome. Shared unchanged sequences keep their coordinates; patch-contig availability differs.

Raw lines 58 to 77
78## T2T-CHM13
80CHM13v2.0/hs1 is a different assembly, not a GRCh38 patch. Many coordinates
81shift and newly resolved sequence may lack a GRCh38 counterpart. The v2.0
82bundle includes chromosome Y from HG002, not the CHM13 cell line. Choose
83annotations explicitly released for the target assembly and treat unresolved
84or multi-mapped liftover regions as such.

T2T-CHM13

CHM13v2.0/hs1 is a different assembly, not a GRCh38 patch. Many coordinates shift and newly resolved sequence may lack a GRCh38 counterpart. The v2.0 bundle includes chromosome Y from HG002, not the CHM13 cell line. Choose annotations explicitly released for the target assembly and treat unresolved or multi-mapped liftover regions as such.

Raw lines 78 to 85
86## Contig naming
88Four naming schemes are in circulation for the same chromosome:
90```
91chr1 UCSC
921 Ensembl, NCBI, GATK b37
93NC_000001.11 RefSeq accession (GRCh38); NC_000001.10 is GRCh37
94CM000663.2 GenBank accession (GRCh38); CM000663.1 is GRCh37
95```
97Note that the accession's version suffix, not the base accession, carries the
98build. `NC_000001.10` and `NC_000001.11` differ only in the last character and
99are different assemblies.
101When sequences are proven identical, renaming is the fix; `bcftools annotate --rename-chrs`, `samtools reheader`,
102and a two-column mapping file all do it. Two rules:
104- Rename the **smaller, cheaper** file, and rename it to match the reference —
105 never rename the reference.
106- `chrM` ↔ `MT` is safe only after confirming the mitochondrial sequences match.
107 GRCh37/GRCh38 commonly use rCRS, while hg19 uses a different chrM. This says
108 nothing about nuclear compatibility between GRCh37 and GRCh38.
110An ordinary text join across naming schemes may not error. It returns the rows that happen to
111match — often zero, sometimes a misleading subset when one file is partly
112renamed. `check_contigs.py` reports style and exact-name conflicts, but alias folding
113is diagnostic only. The normalizer requires exact FASTA names and does not
114silently map `chrM` to `MT` or a case variant.

Contig naming

Four naming schemes are in circulation for the same chromosome:

chr1            UCSC
1               Ensembl, NCBI, GATK b37
NC_000001.11    RefSeq accession (GRCh38); NC_000001.10 is GRCh37
CM000663.2      GenBank accession (GRCh38); CM000663.1 is GRCh37

Note that the accession's version suffix, not the base accession, carries the build. NC_000001.10 and NC_000001.11 differ only in the last character and are different assemblies.

When sequences are proven identical, renaming is the fix; bcftools annotate --rename-chrs, samtools reheader, and a two-column mapping file all do it. Two rules:

  • Rename the smaller, cheaper file, and rename it to match the reference — never rename the reference.
  • chrM ↔ MT is safe only after confirming the mitochondrial sequences match. GRCh37/GRCh38 commonly use rCRS, while hg19 uses a different chrM. This says nothing about nuclear compatibility between GRCh37 and GRCh38.

An ordinary text join across naming schemes may not error. It returns the rows that happen to match — often zero, sometimes a misleading subset when one file is partly renamed. check_contigs.py reports style and exact-name conflicts, but alias folding is diagnostic only. The normalizer requires exact FASTA names and does not silently map chrM to MT or a case variant.

Raw lines 86 to 115
116## Liftover
118`liftOver` (UCSC, with a `.chain` file) and `CrossMap` (which also handles BAM,
119VCF, and BigWig) are the working tools. Both depend on a specific source-to-target chain and supported format semantics:
121- **Coordinates can vanish.** A region deleted from the newer assembly has no
122 target. liftOver writes these to its unmapped file, which is easy to ignore and
123 should be counted every time.
124- **Mappings can be one-to-many.** A region duplicated in the target maps to
125 several places; taking the first is a silent choice.
126- **Strand can flip.** Inverted segments between builds mean a plus-strand
127 feature lifts to the minus strand. Interval files carry this fine; anything
128 where sequence orientation matters (primer sites, guide RNAs, motif hits) does
129 not.
130- **Interval endpoints can lift independently.** A long feature can lift to a
131 different length, or split.
132- **Variants need more than coordinates.** After lifting a VCF, `REF` may no
133 longer match the new reference, and if the segment inverted, `REF` and `ALT`
134 need reverse-complementing. CrossMap has VCF-specific handling and rejected-record output; inspect both
135 mapped and unmapped files. Support varies by variant type, and a successful
136 coordinate mapping alone does not establish allele or genotype correctness. Always re-run `normalize_variant.py` against the *target* reference
137 afterwards and count the `MISMATCH` rows.
139Lifting twice — 37 → 38 → 37 — does not reliably return the original
140coordinates. Reprocessing reads against the target build can avoid some liftover losses,
141but accuracy still depends on the pipeline; it is not a universal guarantee.

Liftover

liftOver (UCSC, with a .chain file) and CrossMap (which also handles BAM, VCF, and BigWig) are the working tools. Both depend on a specific source-to-target chain and supported format semantics:

  • Coordinates can vanish. A region deleted from the newer assembly has no target. liftOver writes these to its unmapped file, which is easy to ignore and should be counted every time.
  • Mappings can be one-to-many. A region duplicated in the target maps to several places; taking the first is a silent choice.
  • Strand can flip. Inverted segments between builds mean a plus-strand feature lifts to the minus strand. Interval files carry this fine; anything where sequence orientation matters (primer sites, guide RNAs, motif hits) does not.
  • Interval endpoints can lift independently. A long feature can lift to a different length, or split.
  • Variants need more than coordinates. After lifting a VCF, REF may no longer match the new reference, and if the segment inverted, REF and ALT need reverse-complementing. CrossMap has VCF-specific handling and rejected-record output; inspect both mapped and unmapped files. Support varies by variant type, and a successful coordinate mapping alone does not establish allele or genotype correctness. Always re-run normalize_variant.py against the target reference afterwards and count the MISMATCH rows.

Lifting twice — 37 → 38 → 37 — does not reliably return the original coordinates. Reprocessing reads against the target build can avoid some liftover losses, but accuracy still depends on the pipeline; it is not a universal guarantee.

Raw lines 116 to 142
143## A note on what to record
145Coordinates in a results table, a figure, or a supplementary file should say
146which build they are in, next to the numbers. "chr7:5,530,601-5,530,625" is not a
147location. "chr7:5,530,601-5,530,625 (GRCh38)" is.

A note on what to record

Coordinates in a results table, a figure, or a supplementary file should say which build they are in, next to the numbers. "chr7:5,530,601-5,530,625" is not a location. "chr7:5,530,601-5,530,625 (GRCh38)" is.

Raw lines 143 to 149
150## Official sources reviewed 2026-10-01
152- UCSC size tables: [hg19](https://hgdownload.soe.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes),
153 [hg38](https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.chrom.sizes),
154 [hs1](https://hgdownload.soe.ucsc.edu/goldenPath/hs1/bigZips/hs1.chrom.sizes).
155- [UCSC assembly FAQ](https://genome.ucsc.edu/FAQ/FAQreleases.html): mitochondrial
156 reference and naming differences. Sizes are signatures, not sequence checksums.
157- [T2T CHM13 release notes](https://github.com/marbl/CHM13): v2.0 and HG002 Y.
158- [CrossMap documentation](https://crossmap.readthedocs.io/en/latest/): format-specific
159 mapping and VCF limitations. No whole-genome liftover was executed in this review.

Official sources reviewed 2026-10-01

Raw lines 150 to 159