Skip to content

Annotate the rCRS mitochondrion in t2t-chm13 as contig NC_012920.1 (0.52.0) - #206

Merged
iskandr merged 1 commit into
mainfrom
t2t-rcrs-mitochondrion
Nov 9, 2026
Merged

iskandr merged 1 commit into
mainfrom
t2t-rcrs-mitochondrion

Conversation

@iskandr

@iskandr iskandr commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Part of openvax/varcode#722. Bumps to 0.52.0.

Why

Most T2T VCFs come from the T2T Consortium's chm13v2.0_maskedY_rCRS analysis set, which its README recommends for short-read variant calling. That set's chrM is the rCRS (NC_012920.1), not CHM13's own mitochondrion (CP068254.1), and Ensembl's rapid-release T2T annotation has no mitochondrial genes. So chrM variants from those files could not be annotated.

The rCRS is GRCh38's MT (J01415.2 = NC_012920.1 in GRCh38's assembly report), so Ensembl GRCh38's MT annotation describes that chrM exactly.

Change

t2t-chm13 now includes Ensembl GRCh38 release 115's MT annotation: 37 genes, of which 13 are protein coding, 22 are tRNAs and 2 are rRNAs.

Contig name. The genes are on a contig named NC_012920.1. It can't be confused with MT, Ensembl's name for CHM13's own mitochondrion. CHM13's own begins at what the rCRS numbers 577, and both are 16,569 bp.

Files. The three files (GTF, cDNA+ncRNA and protein FASTAs, 12 KB in all) are packaged in orfdata/data/genomes/. They are pinned by SHA-256 under a new mitochondria entry of the pin. PinnedGenome.mitochondria is generic, so another assembly's alternative mitochondrion would be a registry entry.

Builder. tools/build_rcrs_mitochondrion.py rebuilds the files from the five Ensembl 115 source files, each pinned by SHA-256 and checked against Ensembl's CHECKSUMS. It checks:

  • that Ensembl's MT DNA is NC_012920.1's sequence;
  • that every transcript's exons spell its cDNA or ncRNA record;
  • that every CDS, translated with table 2, gives its protein.

Opening the genome. The GTF that PyEnsembl indexes is the downloaded Ensembl GTF with the MT GTF's gzip stream appended; gzip readers read the two as one file. The packaged FASTAs are copied beside the index, so the genome still opens and unpickles after ORFdata is upgraded. NC_012920.1 is declared mitochondrial in reference_metadata, so its transcripts translate with table 2.

Contig table. contig_aliases("chm13v2.0_maskedY_rCRS") maps chrM to NC_012920.1 (GenBank J01415.2). Files with CHM13's own mitochondrion keep chrM → MT, which stays unannotated.

Reinstalling. Downloaded files are reused because the store digest is unchanged. The index digest changes, so the next load_genome rebuilds the index once (about 1.1 GB). The CHANGELOG says the old index can be deleted.

Validated on the real genome

I installed t2t-chm13 from Ensembl into a scratch cache: 3m37s, 236,688 transcripts.

  • The real genome has 37 genes on NC_012920.1, 13 of them protein coding, and no MT or chrM contig.
  • MT-ND1 has translation_table == 2, compartment == "mitochondrial", and the expected protein. The table survives pickling.
  • 22:21798486 still lies in RIMBP3B and RIMBP3C.
  • Proteome.build(genome) gives 104,970 reference proteins, the documented 104,957 plus the 13 MT proteins; the docs are updated.

Tests

tests/test_genomes.py:

  • The packaged files against NCBI's NC_012920.1 (vendored in tests/data/t2t/), offline: all 37 transcripts spell their cDNA, all 13 CDSs translate to their proteins with table 2 (and differently with table 1), and the gene count and names are as expected.
  • The _rCRS names' contig table maps chrM to NC_012920.1; no CHM13-own name lists it.
  • A slice genome carrying the packaged mitochondrion puts MT-ND1 on NC_012920.1 with table 2 after install, load and pickling. The FASTAs are copied beside the index, the merged GTF's size is checked, and force=True rebuilds.
  • Adding a mitochondrion to an installed pin opens offline with a new index.

Verification

  • ./lint.sh: passes.
  • pytest tests -n 8: 1531 passed, 6 skipped.
  • mkdocs build --strict: passes.

https://claude.ai/code/session_01JHJhwfx4um52Nczrv3G814

….52.0)

The chm13v2.0_maskedY_rCRS analysis set carries the rCRS as chrM, and
Ensembl's rapid-release T2T annotation has no mitochondrial genes. The rCRS
is GRCh38's MT, so t2t-chm13 now includes Ensembl GRCh38 release 115's 37 MT
genes on a contig named NC_012920.1, which can't be read as CHM13's own MT.

The three files (about 12 KB) are packaged, pinned under the pin's new
mitochondria entry and rebuilt by tools/build_rcrs_mitochondrion.py, which
checks the MT DNA against NC_012920.1, exons against cDNA and table 2
translations against proteins. The GTF the index reads is the downloaded GTF
with the MT records appended, written beside the index; downloaded files
are reused, and the index is rebuilt once. contig_aliases maps the _rCRS
set's chrM to NC_012920.1, and PyEnsembl is told the contig is
mitochondrial so it translates with table 2.

Part of openvax/varcode#722.

Claude-Session: https://claude.ai/code/session_01JHJhwfx4um52Nczrv3G814
@iskandr
iskandr merged commit 500c1e5 into main Nov 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant