Contig_embeddings / README.md
spacemorrissey's picture
Dataset card; drop internal fasta_path column from manifests
1a97f33 verified
|
Raw History Blame Contribute Delete
4.55 kB
metadata
license: cc-by-4.0
pretty_name: IMAGINE-AI contig-level Evo 2 embeddings
tags:
  - biology
  - genomics
  - microbiology
  - embeddings
  - dna-language-model
  - evo2
size_categories:
  - 10K<n<100K
viewer: false

IMAGINE-AI contig-level Evo 2 embeddings

Per-contig Evo 2 (7B base) embeddings, all 32 layers, for 11,862 bacterial and archaeal genomes (public NCBI assemblies), computed on ALCF Polaris (A100) in October 2026. Built for genotype→phenotype modelling in IMAGINE-AI (DOE DE-FOA-0003612, Topic 2-B; PI Ember Morrissey, West Virginia University).

The genome-level vectors (Evo 2 and MicroGlot, one small file per layer) are in the companion dataset ImagineG2P/genome-embeddings. Use this dataset when you need one vector per contig, e.g. to re-pool genomes by contig length, drop plasmids or short contigs, or study contig-level signal.

What is in it

Path Contents
contigs/evo2/<ddd>/<accession>.npz one file per genome (11,862 files, ~465 GB in total; 1 MB to 2.6 GB, median 15 MB)
manifests/genomes.csv one row per listed genome (11,868; 6 have status = rejected and no .npz)
manifests/pilot_genomes.csv selection checks for the 12 pilot genomes
manifests/labels.csv phenotype labels for the pilot genomes only (Madin, BacDive, Bergey's)

<ddd> is digits 4–6 of the accession number: GCF_000007365.1 → contigs/evo2/007/ (in Python, acc[7:10]). This keeps every folder well under 10,000 files.

Each .npz

Key dtype, shape Meaning
embedding float32 [32, 4096] genome vector, all layers (identical to the row in genome-embeddings/evo2/)
contig_means float32 [n_contigs, 32, 4096] one vector per contig, all layers
contig_ids str [n_contigs] FASTA record IDs, same order as contig_means
meta JSON string per-genome provenance: model revision, layers, pooling policy, fasta_sha256, n_contigs, n_windows, total_bp, IUPAC cleaning per contig, runtime and software environment

Layer i is blocks.i: the residual stream after Evo 2 block i, before the final norm.

from huggingface_hub import hf_hub_download
import numpy as np, json

acc = "GCF_000007365.1"
p = hf_hub_download("ImagineG2P/Contig_embeddings", f"contigs/evo2/{acc[7:10]}/{acc}.npz",
                    repo_type="dataset")
z = np.load(p)
contigs = z["contig_means"][:, 24]   # [n_contigs, 4096], layer blocks.24
ids = z["contig_ids"]
meta = json.loads(str(z["meta"]))

To fetch a subset without downloading everything, use snapshot_download(..., allow_patterns=[...]) or hf download ImagineG2P/Contig_embeddings --repo-type dataset --include "contigs/evo2/007/*".

Model and pooling

Model arcinstitute/evo2_7b_base @ 074097e9
Tokens one byte per base (CharLevelTokenizer)
Window 8,192 bp, forward strand only
Precision bf16 inference, float32 pooling

Pooling. Mean over tokens within each 8,192-bp window, then an equal-weight mean over the windows of a contig (the short last window counts as much as a full one) → contig_means. The genome vector embedding is an equal-weight mean over contigs, so a 1-kb contig counts as much as a 5-Mb chromosome. For a length-weighted genome vector, weight contig_means by contig length (from the assembly FASTA; the total is total_bp in meta). Non-ACGT IUPAC codes were set to N before embedding (counts in meta).

Genomes

All public NCBI assemblies (GCF_/GCA_), each with a priority from the IMAGINE-AI master list: 0 pilot genomes (11), 1 reference genomes for the WVU isolates' species (80), 2 QC-passed genomes from the growth-rate master table (283), 3 other genomes in that table (554), 4 ImagineG2P/fasta (10,940). fna_sha256 in manifests/genomes.csv is the hash of the exact FASTA embedded.

Notes and limits

  • Frozen-model features, not fine-tuned. MicroGlot contig vectors are not included.
  • Draft assemblies vary widely in contig count (n_contigs in manifests/genomes.csv); see the pooling note.
  • Code: Hackathon/pilot/ in the IMAGINE-AI repository (embed_evo2.py, export_genome_embeddings.py).

License and citation

CC-BY-4.0. Please cite IMAGINE-AI (DOE DE-FOA-0003612), Evo 2 (Brixi et al., Nature 2026; weights Apache-2.0, Arc Institute) and NCBI for the assemblies.