File size: 5,060 Bytes
9cb7cc6 ffa8f57 9cb7cc6 ffa8f57 9cb7cc6 ffa8f57 9cb7cc6 ffa8f57 9cb7cc6 13ff8b0 9cb7cc6 13ff8b0 9cb7cc6 13ff8b0 9cb7cc6 13ff8b0 9cb7cc6 13ff8b0 ffa8f57 13ff8b0 ffa8f57 13ff8b0 ffa8f57 13ff8b0 ffa8f57 13ff8b0 ffa8f57 13ff8b0 ffa8f57 13ff8b0 ffa8f57 13ff8b0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | ---
license: mit
tags:
- genomics
- bioinformatics
- benchmark
- grading
- synonyms
- databases
- ncbi-gene
- ncbi-taxonomy
- mirbase
- hmdb
- card
pretty_name: OmicsBench Grader Databases
size_categories:
- 100M<n<1B
---
# OmicsBench Grader Databases
Synonym databases for deterministic grading in [OmicsBench](https://github.com/AfterQuery/OmicsBench), a realism-first benchmark for AI coding agents in computational biology.
OmicsBench ships with dozens of prebuilt graders for highly specific biological outputs. This dataset powers the synonym-aware matching behind those graders, so that *TP53* and *tumor protein p53* are recognized as the same gene, *hsa-miR-21-5p* and *MIMAT0000076* as the same miRNA, and *E. coli* and *Escherichia coli* as the same organism.
## Format
One read-only SQLite file, `grader_databases.sqlite` (~22 GB), with five tables -- one per source database. Lookup columns are pre-lowercased at build time (full Unicode `str.lower()`) and covered by composite indexes, so runtime queries are direct indexed seeks and process memory is O(query result) rather than O(database size).
| Table | Columns | Rows | Source | Description |
|---|---|---|---|---|
| `ncbi_gene` | `organism_lower name_lower gene_id` | ~219M | [NCBI Gene](https://www.ncbi.nlm.nih.gov/gene/) | Gene symbol, synonym, description, Entrez GeneID, and Ensembl ID resolution scoped by organism |
| `ncbi_taxonomy` | `name_lower canonical_name` | ~3.2M | [NCBI Taxonomy](https://www.ncbi.nlm.nih.gov/taxonomy) | Scientific name, common name, abbreviation, and synonym resolution for all taxa |
| `hmdb` | `name_lower accession` | ~1.5M | [HMDB](https://hmdb.ca/) | Metabolite name, synonym, IUPAC name, and HMDB accession resolution |
| `mirbase` | `name_lower accession` | ~157K | [miRBase](https://mirbase.org/) | miRNA precursor and mature name/accession resolution, including deprecated entries folded into live replacements |
| `card` | `name_lower aro_accession` | ~19K | [CARD](https://card.mcmaster.ca/) | Antimicrobial resistance gene name, synonym, and ARO accession resolution |
Three of the tables (`ncbi_taxonomy`, `hmdb`, `mirbase`) use `WITHOUT ROWID` with `PRIMARY KEY(name_lower)` and are built via `INSERT OR IGNORE` so the first occurrence of any lowercased name wins. The other two (`ncbi_gene`, `card`) are 1:N and allow multiple rows per lookup key -- `gene_match` and `amr_match` do set-intersection at query time.
## Usage
Install OmicsBench and call the match functions directly; downloading and caching happens on first use.
```python
from omicsbench.grading import (
gene_match,
taxonomy_match,
mirna_match,
metabolite_match,
amr_match,
)
gene_match("TP53", "tumor protein p53", organism="Homo sapiens") # True
taxonomy_match("E. coli", "Escherichia coli") # True
mirna_match("hsa-miR-21-5p", "MIMAT0000076") # True
metabolite_match("Dextrose", "D-Glucose") # True
amr_match("mecA", "PBP2A") # True
```
Each match function is a thin wrapper over one indexed SQL query plus a case-insensitive string-equality fallback (used when either side is absent from the database, so misses don't crash on out-of-distribution inputs). The public API signatures, return types, and fallback semantics are unchanged from the previous TSV-backed release -- consumers upgrade by bumping their `omicsbench` package version.
Each lookup module opens a thread-local read-only connection on first use with read-tuning PRAGMAs (`query_only=1`, `cache_size=-20000`, `temp_store=MEMORY`, `mmap_size=268435456`), so the dataset works correctly under multi-threaded consumers like the OmicsBench async orchestrator. SQLite supports unlimited concurrent readers via shared file locks.
## Direct access
If you want to query the tables yourself without installing OmicsBench, open the file read-only:
```python
import sqlite3
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="AfterQuery/OmicsBench-grader-databases",
filename="grader_databases.sqlite",
repo_type="dataset",
)
conn = sqlite3.connect(f"file:{path}?mode=ro", uri=True)
rows = conn.execute(
"SELECT gene_id FROM ncbi_gene "
"WHERE organism_lower = ? AND name_lower = ?",
("homo sapiens", "tp53"),
).fetchall()
```
All lookup columns are pre-lowercased; lowercase your query inputs in Python before binding. The table schemas are stable across releases: any schema change is a breaking revision of this dataset.
## Provenance and licensing
The five source databases retain their upstream licenses. OmicsBench packages them into a single SQLite file for efficient runtime access; see the [OmicsBench GitHub repository](https://github.com/AfterQuery/OmicsBench) for the full ETL pipeline under `scripts/databases/` and its step-by-step runbook in `scripts/databases/README.md`.
Rebuilds ship as new revisions on this dataset whenever an upstream source publishes a new release.
|