gene stringlengths 3 7 | gene_id int64 135 255k | clinical_significance stringclasses 5
values | review_status stringclasses 3
values | variant_type stringclasses 1
value | consequence stringclasses 3
values | protein_change stringclasses 8
values | allele_freq_gnomad float64 0.07 0.68 | rsid stringlengths 6 9 | genotype stringclasses 8
values | chromosome int64 1 22 | position int64 8.8M 113M | zygosity stringclasses 2
values | conditions stringlengths 4 46 | pubmed_ids float64 1.3M 20.7M β |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MTHFR | 4,524 | Pathogenic/Likely pathogenic | criteria provided multiple submitters | SNV | missense | p.Ala222Val | 0.337 | rs1801133 | GG | 1 | 11,856,378 | homozygous | Homocystinuria | 9,042,909 |
MTHFR | 4,524 | Pathogenic/Likely pathogenic | criteria provided multiple submitters | SNV | missense | p.Ala222Val | 0.337 | rs1801133 | GG | 1 | 11,856,378 | homozygous | Neural tube defects | 10,215,325 |
MTHFR | 4,524 | Pathogenic/Likely pathogenic | criteria provided multiple submitters | SNV | missense | p.Ala222Val | 0.337 | rs1801133 | GG | 1 | 11,856,378 | homozygous | Methylenetetrahydrofolate reductase deficiency | 15,565,111 |
OXTR | 5,021 | Benign | criteria provided single submitter | SNV | intron_variant | null | 0.378 | rs53576 | AG | 3 | 8,804,371 | heterozygous | Social behavior | 19,934,046 |
OXTR | 5,021 | Benign | criteria provided single submitter | SNV | intron_variant | null | 0.378 | rs53576 | AG | 3 | 8,804,371 | heterozygous | Autism spectrum disorder | 20,724,662 |
PPARG | 5,468 | Benign | criteria provided single submitter | SNV | missense | p.Pro12Ala | 0.122 | rs1801282 | CG | 3 | 12,393,125 | heterozygous | Type 2 diabetes | 9,333,238 |
PPARG | 5,468 | Benign | criteria provided single submitter | SNV | missense | p.Pro12Ala | 0.122 | rs1801282 | CG | 3 | 12,393,125 | heterozygous | Obesity | 10,581,039 |
PPARG | 5,468 | Benign | criteria provided single submitter | SNV | missense | p.Pro12Ala | 0.122 | rs1801282 | CG | 3 | 12,393,125 | heterozygous | Metabolic syndrome | null |
HFE | 3,077 | Benign | reviewed by expert panel | SNV | missense | p.His63Asp | 0.136 | rs1799945 | CC | 6 | 26,091,179 | homozygous | Hereditary hemochromatosis | 9,110,990 |
HFE | 3,077 | Benign | reviewed by expert panel | SNV | missense | p.His63Asp | 0.136 | rs1799945 | CC | 6 | 26,091,179 | homozygous | Iron overload | null |
BDNF | 627 | Benign/Likely benign | criteria provided multiple submitters | SNV | missense | p.Val66Met | 0.196 | rs6265 | CC | 11 | 27,679,916 | homozygous | Major depressive disorder | 11,174,898 |
BDNF | 627 | Benign/Likely benign | criteria provided multiple submitters | SNV | missense | p.Val66Met | 0.196 | rs6265 | CC | 11 | 27,679,916 | homozygous | Episodic memory | 14,671,180 |
BDNF | 627 | Benign/Likely benign | criteria provided multiple submitters | SNV | missense | p.Val66Met | 0.196 | rs6265 | CC | 11 | 27,679,916 | homozygous | Bipolar disorder susceptibility | null |
ANKK1 | 255,239 | risk factor | criteria provided single submitter | SNV | missense | p.Glu713Lys | 0.192 | rs1800497 | GG | 11 | 113,270,828 | homozygous | Alcohol dependence | 1,301,956 |
ANKK1 | 255,239 | risk factor | criteria provided single submitter | SNV | missense | p.Glu713Lys | 0.192 | rs1800497 | GG | 11 | 113,270,828 | homozygous | ADHD | 11,349,230 |
ANKK1 | 255,239 | risk factor | criteria provided single submitter | SNV | missense | p.Glu713Lys | 0.192 | rs1800497 | GG | 11 | 113,270,828 | homozygous | Reward deficiency syndrome | null |
CYP1A2 | 1,544 | drug response | criteria provided single submitter | SNV | intron_variant | null | 0.681 | rs762551 | AC | 15 | 75,041,917 | heterozygous | Caffeine metabolism | 10,022,961 |
CYP1A2 | 1,544 | drug response | criteria provided single submitter | SNV | intron_variant | null | 0.681 | rs762551 | AC | 15 | 75,041,917 | heterozygous | Drug metabolism β clozapine | 15,364,890 |
CYP1A2 | 1,544 | drug response | criteria provided single submitter | SNV | intron_variant | null | 0.681 | rs762551 | AC | 15 | 75,041,917 | heterozygous | PharmGKB β caffeine | null |
FTO | 79,068 | risk factor | criteria provided multiple submitters | SNV | intron_variant | null | 0.404 | rs9939609 | AT | 16 | 53,820,527 | heterozygous | Obesity | 17,293,877 |
FTO | 79,068 | risk factor | criteria provided multiple submitters | SNV | intron_variant | null | 0.404 | rs9939609 | AT | 16 | 53,820,527 | heterozygous | Type 2 diabetes | 17,468,765 |
FTO | 79,068 | risk factor | criteria provided multiple submitters | SNV | intron_variant | null | 0.404 | rs9939609 | AT | 16 | 53,820,527 | heterozygous | Body mass index quantitative trait locus 8 | null |
APOE | 348 | risk factor | reviewed by expert panel | SNV | missense | p.Cys130Arg | 0.154 | rs429358 | TT | 19 | 45,411,941 | homozygous | Alzheimer disease | 8,446,170 |
APOE | 348 | risk factor | reviewed by expert panel | SNV | missense | p.Cys130Arg | 0.154 | rs429358 | TT | 19 | 45,411,941 | homozygous | Cardiovascular disease | 1,303,239 |
APOE | 348 | risk factor | reviewed by expert panel | SNV | missense | p.Cys130Arg | 0.154 | rs429358 | TT | 19 | 45,411,941 | homozygous | Hyperlipoproteinemia type III | null |
APOE | 348 | risk factor | reviewed by expert panel | SNV | missense | p.Arg176Cys | 0.073 | rs7412 | CC | 19 | 45,412,079 | homozygous | Alzheimer disease | 8,446,170 |
APOE | 348 | risk factor | reviewed by expert panel | SNV | missense | p.Arg176Cys | 0.073 | rs7412 | CC | 19 | 45,412,079 | homozygous | Cardiovascular disease | 1,303,239 |
COMT | 1,312 | Benign/Likely benign | criteria provided single submitter | SNV | missense | p.Val158Met | 0.502 | rs4680 | GG | 22 | 19,951,271 | homozygous | Pain sensitivity | 9,632,102 |
COMT | 1,312 | Benign/Likely benign | criteria provided single submitter | SNV | missense | p.Val158Met | 0.502 | rs4680 | GG | 22 | 19,951,271 | homozygous | Schizophrenia susceptibility | 12,142,688 |
COMT | 1,312 | Benign/Likely benign | criteria provided single submitter | SNV | missense | p.Val158Met | 0.502 | rs4680 | GG | 22 | 19,951,271 | homozygous | Catechol-O-methyltransferase deficiency | null |
ADORA2A | 135 | Benign | criteria provided single submitter | SNV | synonymous_variant | null | 0.463 | rs5751876 | CT | 22 | 24,837,301 | heterozygous | Caffeine-induced anxiety | 17,074,977 |
ADORA2A | 135 | Benign | criteria provided single submitter | SNV | synonymous_variant | null | 0.463 | rs5751876 | CT | 22 | 24,837,301 | heterozygous | Sleep sensitivity to caffeine | null |
part of
𧬠Genomic Reasoning Agent
LLM-driven agentic system for personal genomic variant interpretation
Overview
This project builds a multi-step reasoning agent that interprets personal genomic data from 23andMe against biomedical knowledge databases (ClinVar, GWAS Catalog, gnomAD). The agent is trained with GRPO (Group Relative Policy Optimization) using fully verifiable reward signals β no human labelers needed.
The core insight mirrors DeepSeek-R1's approach to mathematics: genomic variant interpretation has verifiable ground truth (ClinVar classifications, GWAS p-values, population frequencies), making it ideal for RL-based reasoning training.
23andMe SNPs (631K)
β
ClinVar Annotation β rs1801133 β MTHFR β Pathogenic
β
Tool-Using LLM Agent β 5 tools: lookup / scan / haplotype / stats / reward
β
GRPO Training Loop β verifiable reward from ClinVar ground truth
β
Reasoning Model β factual Β· calibrated Β· evidence-grounded
β
HF Spaces Demo β upload 23andMe β ask questions β reasoning trace
Motivation
Standard LLMs hallucinate on genomic questions. This project trains a model that:
- Cites sources (ClinVar review status, GWAS p-values, PubMed IDs)
- Shows reasoning chains (mechanism β evidence β conclusion)
- Calibrates uncertainty (risk factor β diagnosis)
- Uses tools to look up live databases rather than relying on memorised weights
The training signal is 100% verifiable β reward is computed by checking responses against ClinVar annotations, not scored by humans.
Repository Structure
genomic-reasoning-agent/
βββ genomic_pipeline.py # Step 1: Parse 23andMe .txt β DataFrame
βββ clinvar_pipeline_full.py # Step 2: Annotate variants via ClinVar API
βββ genomic_agent_huggingface.py # Step 3: smolagents tool-using agent (5 tools)
βββ train_grpo.py # Step 4: GRPO training with TRL
βββ app.py # HF Spaces Gradio UI
βββ data/
β βββ clinvar_annotations.json # 12 variants with full ClinVar metadata
β βββ genomic_qa_dataset.json # 36 Q&A pairs (3 task types Γ 12 variants)
βββ README.md
Pipeline: Step by Step
Step 1 β Parse 23andMe
Reads the raw .txt export (Build GRCh37) into a DataFrame of 631,455 SNPs.
from genomic_pipeline import parse_23andme
df = parse_23andme("genome_23andme.txt")
# β 631,455 SNPs across chromosomes 1β22, X, Y, MT
# β 104,617 heterozygous (16.6%) | 522,909 homozygous (82.8%)
Step 2 β ClinVar Annotation
Queries NCBI E-utilities and GWAS Catalog for each rsID. Builds a Q&A dataset with verifiable answers.
from clinvar_pipeline_full import query_clinvar_batch, build_qa_dataset
annotations = query_clinvar_batch(rsids, email="your@email.com")
qa_dataset = build_qa_dataset(annotations, genome_df)
# β 12 variants annotated
# β 36 Q&A pairs: variant_interpretation / genotype_interpretation / pathway_reasoning
Sample annotation:
| rsID | Gene | Genotype | Significance | Condition |
|---|---|---|---|---|
| rs1801133 | MTHFR | GG | Pathogenic/Likely pathogenic | Homocystinuria |
| rs429358 + rs7412 | APOE | TT / CC | risk factor | Alzheimer disease |
| rs9939609 | FTO | AT | risk factor | Obesity |
| rs762551 | CYP1A2 | AC | drug response | Caffeine metabolism |
Step 3 β Tool-Using Agent (smolagents)
A ToolCallingAgent with 5 tools that plans multi-step queries across databases.
from smolagents import ToolCallingAgent, InferenceClientModel
from genomic_agent_huggingface import (
VariantLookupTool, # rsID β ClinVar + genotype
GeneScannerTool, # gene/trait β all patient variants
HaplotypeCallerTool, # APOE Ξ΅2/Ξ΅3/Ξ΅4 from two SNPs
GenomeStatsTool, # 631K SNPs overview
RewardEvaluatorTool, # GRPO reward score (used during training)
)
model = InferenceClientModel("meta-llama/Llama-3.1-8B-Instruct")
agent = ToolCallingAgent(tools=[...], model=model, max_steps=10)
answer = agent.run("What is my APOE haplotype and what does it mean?")
6-step reasoning trace for "Give me a genomic health summary":
Step 1 [genome_stats] β 631,455 SNPs | 16.6% heterozygous
Step 2 [variant_lookup] β rs1801133 | MTHFR | GG | Pathogenic
Step 3 [call_haplotype] β APOE Ξ΅3/Ξ΅3 | Neutral Alzheimer's risk
Step 4 [scan_gene_variants] β dopamine: ANKK1 GG (risk), COMT GG (Val/Val)
Step 5 [scan_gene_variants] β caffeine: CYP1A2 AC (intermediate), ADORA2A CT
Step 6 [evaluate_reasoning] β reward: 0.93 / 1.00 (excellent)
Step 4 β GRPO Training
Trains the base LLM to reason better about genomic questions using reinforcement learning with verifiable rewards β no human annotation required.
from train_grpo import train, TrainingConfig
config = TrainingConfig(
model_name="meta-llama/Llama-3.1-8B-Instruct",
num_epochs=3,
num_generations=4, # G: completions per question
beta=0.04, # KL penalty
use_lora=True,
)
trainer = train(config)
Reward function β 6 verifiable components:
| Component | Weight | Verifiable against |
|---|---|---|
| Factual accuracy | 0.35 | ClinVar clinical significance |
| Condition coverage | 0.25 | ClinVar associated conditions |
| Gene mention | 0.15 | ClinVar gene annotation |
| Reasoning chain | 0.15 | Presence of causal language |
| Uncertainty calibration | 0.05 | Hedging language |
| Response completeness | 0.05 | Word count |
Training progression (simulated):
untrained reward=0.06 |ββββββββββββββββββββββββββββββ|
epoch_1 reward=0.56 |ββββββββββββββββββββββββββββββ|
epoch_3 reward=0.71 |ββββββββββββββββββββββββββββββ|
epoch_5 reward=0.93 |ββββββββββββββββββββββββββββββ|
epoch_10 reward=1.00 |ββββββββββββββββββββββββββββββ|
GRPO advantage formula:
advantage_i = (reward_i β mean(rewards)) / std(rewards)
No critic network. No value function. No human labeler.
Just relative comparison within each group of G=4 completions.
Key Results from Real Genome Data
Running the full pipeline on a real 23andMe export (Zalina Dezhina, v5 chip):
| Variant | Gene | Genotype | Clinical Note |
|---|---|---|---|
| π΄ rs1801133 | MTHFR | GG | Pathogenic β folate metabolism (p.Ala222Val) |
| π‘ rs9939609 | FTO | AT | Risk factor β obesity, 1 risk allele (40.4% population) |
| π§ APOE | β | Ξ΅3/Ξ΅3 | Neutral β most common haplotype, no elevated AD risk |
| π rs762551 | CYP1A2 | AC | Drug response β intermediate caffeine metabolizer |
| π‘ rs1800497 | ANKK1 | GG | Risk factor β reward pathway / DRD2 association |
| π’ rs6265 | BDNF | CC | Benign (Val/Val) β better episodic memory |
β οΈ This is a research and portfolio project, not medical advice. All interpretations are for educational purposes only.
Tech Stack
| Layer | Technology |
|---|---|
| Genome parsing | pandas, Python |
| Variant annotation | NCBI E-utilities (ClinVar), EBI GWAS Catalog |
| Agentic framework | smolagents (HuggingFace) |
| RL training | TRL GRPOTrainer |
| Fine-tuning | LoRA (PEFT) + 4-bit quantization (bitsandbytes) |
| Base model | meta-llama/Llama-3.1-8B-Instruct |
| Demo UI | Gradio (HF Spaces) |
| Evaluation | Per-task reward breakdown, 3 task types |
HuggingFace Deployment
Spaces (interactive demo):
1. Create new Space β Gradio SDK
2. Upload: genomic_agent_huggingface.py, app.py, data/
3. Add secret: HF_TOKEN
4. Upload your 23andMe .txt β ask questions in chat
Model Hub (trained weights):
trainer.push_to_hub("mioulin/genomic-reasoning-llm")
Dataset Hub:
from datasets import Dataset
Dataset.from_list(qa_dataset).push_to_hub("mioulin/genomic-reasoning-qa")
Connection to ML Scientist Role
This project was built to demonstrate the exact skills required for ML Scientist roles in AIΓbiology:
- Agentic systems β 5-tool ToolCallingAgent with multi-step planning
- RL/RLHF training β GRPO with verifiable reward, no human labelers
- Biomedical data integration β ClinVar, GWAS Catalog, gnomAD, PubMed
- Evaluation framework β 6-component reward breakdown across 3 task types
- Real scientific domain β 631,455 SNPs from real 23andMe genome
- Reasoning over evidence β multi-hop: SNP β gene β pathway β phenotype
Running Locally
git clone https://huggingface.co/spaces/mioulin/genomic-reasoning-agent
cd genomic-reasoning-agent
pip install smolagents trl transformers accelerate peft datasets gradio
# Annotate your genome
python clinvar_pipeline_full.py \
--genome your_23andme.txt \
--output data/clinvar_annotations.json \
--email your@email.com
# Run agent (requires HF token for model inference)
export HF_TOKEN=hf_...
python genomic_agent_huggingface.py
# Train with GRPO (requires GPU)
python train_grpo.py \
--model meta-llama/Llama-3.1-8B-Instruct \
--epochs 3 --lora --G 4
Author
Citation
@misc{dezhina2026genomic,
title = {Genomic Reasoning Agent: GRPO Training on Personal SNP Data},
author = {Dezhina, Zalina},
year = {2026},
url = {https://huggingface.co/spaces/mioulin/genomic-reasoning-agent}
}
License
MIT β research and educational use only. Not intended for clinical or medical decision-making.
Built with 𧬠smolagents · TRL · HuggingFace · ClinVar · 23andMe
- Downloads last month
- -