SkillJavaScriptv0.2.2

Nutrigenomics

Nutrigenomics

0 downloads
drdaviddelorenzo
Updated Mar 1, 2026

Nutrigenomics β€” Personalised Nutrition from Genetic Data

Skill ID: nutrigenomics
Version: 0.1.0
Status: MVP
Author: David de Lorenzo Requires: Python 3.11+, pandas, numpy, matplotlib, seaborn, reportlab (optional)


What This Skill Does

The Nutrigenomics generates a personalised nutrition report from consumer genetic data (23andMe, AncestryDNA raw files or VCF). It interrogates a curated set of nutritionally-relevant SNPs drawn from GWAS Catalog, ClinVar, and peer-reviewed nutrigenomics literature, then translates genotype calls into actionable dietary and supplementation guidance β€” all computed locally.

Key outputs

  • Markdown nutrition report with risk scores and recommendations
  • Radar chart of nutrient risk profile
  • Gene Γ— nutrient heatmap
  • Reproducibility bundle (commands.sh, environment.yml, SHA-256 checksums)

Trigger Phrases

The Bio Orchestrator should route to this skill when the user says anything like:

  • "personalised nutrition", "nutrigenomics", "diet genetics"
  • "what should I eat based on my DNA"
  • "nutrient metabolism", "vitamin absorption genetics"
  • "MTHFR", "APOE", "FTO", "BCMO1", "VDR", "FADS1/2"
  • "folate", "omega-3", "vitamin D", "caffeine metabolism", "lactose", "gluten"
  • Input files: .txt or .csv (23andMe), .csv (AncestryDNA), .vcf

Curated SNP Panel

Macronutrient Metabolism

GeneSNPNutrient ImpactEvidence
FTOrs9939609Energy balance, fat mass, carb sensitivityStrong (GWAS)
PPARGrs1801282Fat metabolism, insulin sensitivityModerate
APOA5rs662799Triglyceride response to dietary fatStrong
TCF7L2rs7903146Carbohydrate metabolism, T2D riskStrong
ADRB2rs1042713Fat oxidation, exercise Γ— diet interactionModerate

Micronutrient Metabolism

GeneSNPNutrientEffect of risk allele
MTHFRrs1801133Folate / B12↓ 5-MTHF conversion (~70%)
MTHFRrs1801131Folate / B12↓ enzyme activity (~30%)
MTRrs1805087B12 / homocysteine↑ homocysteine risk
BCMO1rs7501331Beta-carotene β†’ Vitamin A↓ conversion (~50%)
BCMO1rs12934922Beta-carotene β†’ Vitamin A↓ conversion (compound het)
VDRrs2228570Vitamin D absorption↓ VDR function
VDRrs731236Vitamin D↓ bone mineral density response
GCrs4588Vitamin D binding↑ deficiency risk
SLC23A1rs33972313Vitamin C transport↓ renal reabsorption
ALPLrs1256335Vitamin B6↓ alkaline phosphatase activity

Omega-3 / Fatty Acid Metabolism

GeneSNPNutrientEffect
FADS1rs174546LC-PUFA synthesis↑/↓ EPA/DHA from ALA
FADS2rs1535LC-PUFA synthesisModulates omega-6:omega-3 ratio
ELOVL2rs953413DHA synthesis↓ elongation of EPAβ†’DHA
APOErs429358Saturated fat responseΞ΅4 β†’ ↑ LDL-C on high SFA diet
APOErs7412Saturated fat responseCombined with rs429358 for Ξ΅ typing

Caffeine & Alcohol

GeneSNPCompoundEffect
CYP1A2rs762551CaffeineSlow/Fast metaboliser
AHRrs4410790CaffeineModulates CYP1A2 induction
ADH1Brs1229984AlcoholAcetaldehyde accumulation risk
ALDH2rs671AlcoholAsian flush / toxicity risk

Food Sensitivities

GeneSNPSensitivityEffect
MCM6rs4988235Lactose intoleranceNon-persistence of lactase
HLA-DQ2Proxy SNPsCoeliac / glutenHLA-DQA1/DQB1 risk haplotypes

Antioxidant & Detoxification

GeneSNPPathwayEffect
SOD2rs4880Manganese SOD↓ mitochondrial antioxidant
GPX1rs1050450Selenium / GSH-Px↓ glutathione peroxidase
GSTT1DeletionGlutathione-S-transNull genotype β†’ ↑ oxidative risk
NQO1rs1800566Coenzyme Q10↓ CoQ10 regeneration
COMTrs4680Catechol / B vitaminsMet/Val β†’ methylation load

Algorithm

1. Input Parsing (parse_input.py)

Accepts:

  • 23andMe .txt or .csv (tab-separated: rsid, chromosome, position, genotype)
  • AncestryDNA .csv
  • Standard VCF (extracts GT field)

Auto-detects format from header lines. Normalises alleles to forward strand using a hard-coded reference table (avoids requiring external databases).

2. Genotype Extraction (extract_genotypes.py)

For each SNP in the panel:

  1. Look up rsid in parsed data
  2. Return genotype string (e.g. "AT", "TT", "AA")
  3. Flag as "NOT_TESTED" if absent (common for chip-to-chip variation)

3. Risk Scoring (score_variants.py)

Each SNP is scored on a 0 / 0.5 / 1.0 scale:

  • 0.0 β€” homozygous reference (lowest risk)
  • 0.5 β€” heterozygous
  • 1.0 β€” homozygous risk allele

Composite Nutrient Risk Scores (0–10) are computed per nutrient domain by summing weighted SNP scores. Weights are derived from reported effect sizes (beta coefficients or OR) in the primary literature.

Risk categories:

  • 0–3: Low risk β€” standard dietary advice applies
  • 3–6: Moderate risk β€” dietary optimisation recommended
  • 6–10: Elevated risk β€” consider testing and targeted supplementation

Important caveat: These are polygenic risk indicators based on common variants. They are not diagnostic. Rare pathogenic variants (e.g. MTHFR compound heterozygosity with high homocysteine) require clinical confirmation.

4. Report Generation (generate_report.py)

Outputs a structured Markdown report with:

  • Executive summary (top 3 personalised findings)
  • Per-nutrient sections: genotype table β†’ interpretation β†’ recommendation
  • Radar chart (matplotlib) of nutrient risk scores
  • Gene Γ— nutrient heatmap (seaborn)
  • Supplement interactions table
  • Disclaimer section
  • Reproducibility block

5. Reproducibility Bundle (repro_bundle.py)

Exports to the output directory (not committed to the repo):

  • commands.sh β€” full CLI to reproduce analysis
  • environment.yml β€” pinned conda environment
  • checksums.txt β€” SHA-256 checksums of input and output files
  • provenance.json β€” timestamp and version information

Usage

# From 23andMe raw data
openclaw "Generate my personalised nutrition report from genome.csv"

# From VCF
openclaw "Run Nutrigenomics analysis on variants.vcf and flag any folate pathway risks"

# Targeted query
openclaw "What does my APOE status mean for my saturated fat intake?"

# Generate a random demo patient and run the report
python examples/generate_patient.py --run

File Structure

skills/nutrigenomics/
β”œβ”€β”€ SKILL.md                      ← this file (agent instructions)
β”œβ”€β”€ nutrigenomics.py            ← main entry point
β”œβ”€β”€ parse_input.py                ← multi-format parser
β”œβ”€β”€ extract_genotypes.py          ← SNP lookup engine
β”œβ”€β”€ score_variants.py             ← risk scoring algorithm
β”œβ”€β”€ generate_report.py            ← Markdown + figures
β”œβ”€β”€ repro_bundle.py               ← reproducibility export
β”œβ”€β”€ .gitignore
β”œβ”€β”€ data/
β”‚   └── snp_panel.json            ← curated SNP definitions
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ synthetic_patient.csv     ← fixed 23andMe-format test data (for pytest)
β”‚   └── test_nutrigenomics.py           ← pytest suite
└── examples/
    β”œβ”€β”€ generate_patient.py       ← random patient generator (demo use)
    β”œβ”€β”€ data/                     ← generated patient files land here (gitignored)
    └── output/
        β”œβ”€β”€ nutrigenomics_report.md     ← pre-rendered demo report
        β”œβ”€β”€ nutrigenomics_radar.png     ← demo radar chart (nutrient risk profile)
        └── nutrigenomics_heatmap.png   ← demo gene Γ— nutrient heatmap

Note: Runtime output directories and randomly generated patient files are excluded from version control via .gitignore. Only the pre-rendered demo report in examples/output/ is committed.


Privacy

All computation runs locally. No genetic data is transmitted. Input files are read-only; no raw genotype data appears in any output file (reports contain only gene names, SNP IDs, and risk categories).


Limitations & Disclaimer

  1. Not a medical device. This skill provides educational, research-oriented nutrigenomics analysis. It does not constitute medical advice.
  2. Common variants only. The panel covers SNPs with MAF > 1% in at least one major population. Rare pathogenic variants are out of scope.
  3. Population context. Effect sizes are predominantly derived from European GWAS cohorts. Risk estimates may not generalise equally across all ancestries.
  4. Gene–environment interaction. Genetic risk scores interact with baseline diet, lifestyle, microbiome, and epigenetic state. A "high risk" score does not mean a nutrient deficiency is present β€” it means the individual may benefit from monitoring.
  5. Simpson's Paradox note. Population-level associations used to derive weights may not reflect individual trajectories (see Corpas 2025, Nutrigenomics and the Ecological Fallacy).

Roadmap

  • v0.2: Microbiome Γ— genotype interaction module (16S rRNA input)
  • v0.3: Longitudinal tracking β€” compare reports across time
  • v0.4: HLA typing for immune-mediated food reactions (coeliac, gluten sensitivity)
  • v1.0: Multi-omics integration (metabolomics + genomics + dietary recall)

References

This skill's SNP panel and methodology are informed by peer-reviewed nutrigenomics research. For verification and additional details, consult:

Users are encouraged to verify specific claims through these authoritative sources and with qualified healthcare providers.


Contributing

The SNP panel (data/snp_panel.json) is maintained by the skill author. To suggest additions or corrections, contact David de Lorenzo directly via GitHub (@drdaviddelorenzo) or open an issue on GitHub.

Free
Installation
Reviews

Sign in to leave a review.

No reviews yet. Be the first.