Cleanup Review
python scripts/_purge_cache.py is an optional cleanup helper for the Personal Genomics Analysis Skill skill. It may recursively remove /tmp/skill_workdir/*, /tmp/skill_workdir/.cache. Show the exact paths first, explain whether they are skill-private temporary paths or user state, and run the cleanup only after the user confirms.
Personal Genomics Analysis Skill
Overview
This skill guides you through a structured, multi-phase workflow for analyzing consumer
genetic testing data and producing actionable health insights. The workflow is interactive —
you gather information from the user at key decision points rather than making assumptions.
The analysis pipeline is designed to be:
- Evidence-based: every risk assessment cites published research (PMIDs)
- Interactive: the user's medical history, lifestyle, and concerns shape the analysis
- Progressive: start broad, then deep-dive into areas that matter most to the user
- Actionable: end with concrete recommendations (supplements, lifestyle, screening schedule)
Phase 1: Data Intake & Format Detection
Supported Input Formats
Read references/supported_formats.md for detailed format specifications. In brief:
| Platform |
File Type |
Key Characteristics |
| WeGene |
TSV (.txt) |
rsid \t chromosome \t position \t genotype |
| 23andMe |
TSV (.txt) |
# rsid \t chromosome \t position \t genotype (comment header with #) |
| AncestryDNA |
TSV (.txt) |
rsid \t chromosome \t position \t allele1 \t allele2 (separate allele columns) |
| VCF |
.vcf / .vcf.gz |
Standard VCF v4.x, may contain WGS or chip data |
| CRAM/BAM |
.cram / .bam |
Alignment files for variant verification, depth analysis |
What to Do
- List the user's uploaded files and identify their formats by reading the first 20-50 lines
- Report back what you found: platform, number of variants, reference genome build (GRCh37/GRCh38 if detectable), data quality indicators
- Ask the user what they'd like to focus on. Present the available analysis modules:
- Health risk assessment (disease predisposition)
- Pharmacogenomics (drug metabolism & response)
- Nutrition & metabolism genetics
- Exercise & fitness genetics
- Ancestry (mtDNA/Y haplogroups if WGS data available)
- All of the above (recommended for first-time analysis)
Parsing Strategy
Write a Python script that:
- Auto-detects the input format from file headers
- Builds a unified genotype dictionary:
{rsid: genotype_string}
- For VCF files, also indexes by
chr:pos for position-based lookups
- Handles both compressed (.gz) and uncompressed files
- Reports parsing statistics (total variants, by chromosome, etc.)
When both chip data (WeGene/23andMe) and WGS (VCF) are available, use a dual-source
lookup strategy: check chip data first (faster), fall back to VCF by rsid or chr:pos.
This maximizes coverage since chip and WGS may cover different variant sets.
Phase 2: Initial Comprehensive Analysis
SNP Database
Read references/snp_database.md for the curated SNP database organized by category.
The database covers ~120 clinically relevant SNPs across these categories:
- Health risks: cancer (BRCA1/2), cardiovascular (9p21.3, MTHFR), metabolic (TCF7L2),
neurological (APOE, LRRK2), autoimmune, and more
- Pharmacogenomics: CYP2C19, CYP2D6, CYP2C9, CYP1A2, SLCO1B1, VKORC1, ALDH2, etc.
- Nutrition: lactose tolerance (MCM6), vitamin metabolism (MTHFR, VDR, BCMO1, FUT2),
caffeine sensitivity (CYP1A2), alcohol flush (ALDH2)
- Exercise: muscle fiber type (ACTN3), endurance (PPARGC1A), recovery (IL6), VO2max (ACE)
Each SNP entry includes: gene, variant name, risk allele, condition/trait, evidence level,
PMID reference, and a plain-language explanation.
Analysis Script Structure
Generate a Python analysis script that:
- Loads the unified genotype dictionary from Phase 1
- Looks up each SNP in the database
- Determines risk level based on genotype (homozygous risk, heterozygous, or normal)
- Handles special cases:
- APOE typing: requires combining rs429358 + rs7412 to determine ε2/ε3/ε4 status
- CYP2C19 metabolizer status: combines multiple star-allele SNPs
- MTHFR compound: checks both C677T (rs1801133) and A1298C (rs1801131)
- Generates an HTML report with:
- Summary dashboard (key findings, risk counts by category)
- Tabbed sections for each category
- Color-coded risk levels (high/medium/low/protective)
- Citations for each finding
Report Output
Generate an interactive HTML report with:
- Clean, readable design with high contrast (dark text on light backgrounds)
- Sticky navigation tabs
- Risk indicators with clear color coding
- Expandable detail sections for each SNP
- A summary section with the most clinically significant findings
Follow the user's language (Chinese or English) for all report text.
Phase 3: User Interview & Deep Dive
This is the critical interactive phase. After presenting initial results:
Gather Context
Ask the user about:
- Known health conditions — what diagnoses do they already have?
- Family history — especially first-degree relatives with serious conditions
- Current medications — for drug interaction awareness
- Lifestyle factors — diet, exercise, sun exposure, smoking/alcohol
- Specific concerns — what worries them most?
This information is essential because genetic risk is only part of the picture. A person
with a family history of early heart attack AND multiple CAD risk SNPs faces very different
odds than someone with the same SNPs but no family history.
Deep Risk Analysis
Based on the user's health profile, conduct a targeted deep-dive. Read
references/deep_risk_snps.md for extended SNP panels organized by disease pathway:
- Lipid metabolism (~20 SNPs): LDLR, APOB, PCSK9, HMGCR, CETP, LPL, APOA5, etc.
- Coronary artery disease (~15 SNPs): 9p21.3, LPA, MTHFR, CRP, IL6, F5, F2, etc.
- Uric acid / gout (~10 SNPs): SLC2A9, ABCG2, SLC22A12, SLC17A1, etc.
- Diabetes risk (~10 SNPs): TCF7L2, KCNJ11, SLC30A8, PPARG, FTO, etc.
- Statin pharmacogenomics (~5 SNPs): SLCO1B1, CYP3A4, ABCB1, etc.
For each category relevant to the user:
- Query ALL SNPs in the extended panel (use both chip + VCF dual-source)
- Tally risk alleles and categorize (high/moderate/low/protective)
- Compute a qualitative risk profile (not a numeric "score" — explain why)
- Cross-reference with the user's actual health status and family history
- Note any SNPs that could NOT be found (missing data)
Variant Verification (if CRAM/BAM available)
If the user has provided alignment files:
- Use samtools/bcftools to verify key high-risk variants directly from reads
- Report read depth and allele balance for critical SNPs
- Flag any low-confidence calls
Note: samtools may need to be compiled from source in sandboxed environments.
See references/tool_setup.md for instructions.
Ancestry Analysis (if WGS available)
For whole-genome sequencing data:
- mtDNA haplogroup: Check diagnostic variants against PhyloTree. Important: VCF
files report variants against rCRS (which is haplogroup H). Absence of a variant
means the person carries the rCRS allele at that position. Look for the 9bp deletion
at position 8270-8278 (B haplogroup marker, common in East Asian populations).
- Y chromosome haplogroup (if male): Check ISOGG diagnostic SNPs (e.g., M122 for
O2 haplogroup, common in East Asian populations).
Phase 4: Personalized Recommendations
Based on all gathered information, produce actionable recommendations.
Supplement Plan
Read references/supplement_guide.md for evidence-based supplement recommendations
mapped to genetic findings. The guide covers:
- Which genetic variants warrant which supplements
- Dosage ranges with citations
- Drug-supplement interactions to watch for
- Priority tiers (core / recommended / optional)
- Age-specific timing and duration advice
- When to recheck labs
Always organize supplements into tiers:
- Core: strongly supported by genetics + current health status
- Recommended: good evidence, beneficial given risk profile
- Optional: supporting evidence, lower priority
Screening & Monitoring Schedule
Based on the risk profile, suggest:
- Which lab tests to monitor and how often
- Age milestones for specific screenings (e.g., coronary CTA at 30 if strong family history)
- Target values for key metrics
Output Formats
Offer to generate:
- HTML report — comprehensive, interactive, printable
- Excel spreadsheet — dosing schedule table for daily reference
- Summary document — one-page overview for sharing with a physician
Important Principles
Medical Disclaimer
Every report MUST include a clear disclaimer: genetic analysis provides risk estimates,
not diagnoses. Results should be discussed with a qualified healthcare provider. Consumer
genetic testing has limitations in coverage and accuracy compared to clinical-grade testing.
Evidence Standards
- Always cite PMIDs for risk associations
- Distinguish between GWAS-level evidence and functional/clinical evidence
- Note when evidence is primarily from non-Asian populations (if the user appears to be
of East Asian descent based on their data or stated ethnicity)
- Use language like "increased risk" rather than "you will get"
Language
Follow the user's language. If the user writes in Chinese, produce reports in Chinese.
If in English, use English. For SNP names and gene symbols, always keep the standard
scientific nomenclature regardless of language.
Iterative Approach
Don't try to do everything at once. The workflow is designed as a conversation:
- Parse → show what you found → ask what to focus on
- Initial analysis → present results → gather health context
- Deep dive → present findings → discuss implications
- Recommendations → deliver in requested format
Each phase should end with a clear handoff to the user before proceeding.
1---2name: personal-genomics-23description: Analyze consumer DNA data from WeGene, 23andMe, AncestryDNA, VCF, BAM, or CRAM files. Generate evidence-based reports covering health risks, pharmacogenomics, ancestry, nutrition, exercise traits, and supplement guidance. Runs locally and keeps raw genetic data on the user's machine.4---56789### Cleanup Review1011`python scripts/_purge_cache.py` is an optional cleanup helper for the `Personal Genomics Analysis Skill` skill. It may recursively remove /tmp/skill_workdir/*, /tmp/skill_workdir/.cache. Show the exact paths first, explain whether they are skill-private temporary paths or user state, and run the cleanup only after the user confirms.1213# Personal Genomics Analysis Skill1415## Overview1617This skill guides you through a structured, multi-phase workflow for analyzing consumer18genetic testing data and producing actionable health insights. The workflow is interactive —19you gather information from the user at key decision points rather than making assumptions.2021The analysis pipeline is designed to be:22- **Evidence-based**: every risk assessment cites published research (PMIDs)23- **Interactive**: the user's medical history, lifestyle, and concerns shape the analysis24- **Progressive**: start broad, then deep-dive into areas that matter most to the user25- **Actionable**: end with concrete recommendations (supplements, lifestyle, screening schedule)2627## Phase 1: Data Intake & Format Detection2829### Supported Input Formats3031Read `references/supported_formats.md` for detailed format specifications. In brief:3233| Platform | File Type | Key Characteristics |34|----------|-----------|-------------------|35| WeGene | TSV (.txt) | `rsid \t chromosome \t position \t genotype` |36| 23andMe | TSV (.txt) | `# rsid \t chromosome \t position \t genotype` (comment header with `#`) |37| AncestryDNA | TSV (.txt) | `rsid \t chromosome \t position \t allele1 \t allele2` (separate allele columns) |38| VCF | .vcf / .vcf.gz | Standard VCF v4.x, may contain WGS or chip data |39| CRAM/BAM | .cram / .bam | Alignment files for variant verification, depth analysis |4041### What to Do42431. **List the user's uploaded files** and identify their formats by reading the first 20-50 lines442. **Report back** what you found: platform, number of variants, reference genome build (GRCh37/GRCh38 if detectable), data quality indicators453. **Ask the user** what they'd like to focus on. Present the available analysis modules:46 - Health risk assessment (disease predisposition)47 - Pharmacogenomics (drug metabolism & response)48 - Nutrition & metabolism genetics49 - Exercise & fitness genetics50 - Ancestry (mtDNA/Y haplogroups if WGS data available)51 - All of the above (recommended for first-time analysis)5253### Parsing Strategy5455Write a Python script that:56- Auto-detects the input format from file headers57- Builds a unified genotype dictionary: `{rsid: genotype_string}`58- For VCF files, also indexes by `chr:pos` for position-based lookups59- Handles both compressed (.gz) and uncompressed files60- Reports parsing statistics (total variants, by chromosome, etc.)6162When both chip data (WeGene/23andMe) and WGS (VCF) are available, use a **dual-source63lookup** strategy: check chip data first (faster), fall back to VCF by rsid or chr:pos.64This maximizes coverage since chip and WGS may cover different variant sets.6566## Phase 2: Initial Comprehensive Analysis6768### SNP Database6970Read `references/snp_database.md` for the curated SNP database organized by category.71The database covers ~120 clinically relevant SNPs across these categories:7273- **Health risks**: cancer (BRCA1/2), cardiovascular (9p21.3, MTHFR), metabolic (TCF7L2),74 neurological (APOE, LRRK2), autoimmune, and more75- **Pharmacogenomics**: CYP2C19, CYP2D6, CYP2C9, CYP1A2, SLCO1B1, VKORC1, ALDH2, etc.76- **Nutrition**: lactose tolerance (MCM6), vitamin metabolism (MTHFR, VDR, BCMO1, FUT2),77 caffeine sensitivity (CYP1A2), alcohol flush (ALDH2)78- **Exercise**: muscle fiber type (ACTN3), endurance (PPARGC1A), recovery (IL6), VO2max (ACE)7980Each SNP entry includes: gene, variant name, risk allele, condition/trait, evidence level,81PMID reference, and a plain-language explanation.8283### Analysis Script Structure8485Generate a Python analysis script that:86871. Loads the unified genotype dictionary from Phase 1882. Looks up each SNP in the database893. Determines risk level based on genotype (homozygous risk, heterozygous, or normal)904. Handles special cases:91 - **APOE typing**: requires combining rs429358 + rs7412 to determine ε2/ε3/ε4 status92 - **CYP2C19 metabolizer status**: combines multiple star-allele SNPs93 - **MTHFR compound**: checks both C677T (rs1801133) and A1298C (rs1801131)945. Generates an HTML report with:95 - Summary dashboard (key findings, risk counts by category)96 - Tabbed sections for each category97 - Color-coded risk levels (high/medium/low/protective)98 - Citations for each finding99100### Report Output101102Generate an interactive HTML report with:103- Clean, readable design with high contrast (dark text on light backgrounds)104- Sticky navigation tabs105- Risk indicators with clear color coding106- Expandable detail sections for each SNP107- A summary section with the most clinically significant findings108109Follow the user's language (Chinese or English) for all report text.110111## Phase 3: User Interview & Deep Dive112113This is the critical interactive phase. After presenting initial results:114115### Gather Context116117Ask the user about:1181. **Known health conditions** — what diagnoses do they already have?1192. **Family history** — especially first-degree relatives with serious conditions1203. **Current medications** — for drug interaction awareness1214. **Lifestyle factors** — diet, exercise, sun exposure, smoking/alcohol1225. **Specific concerns** — what worries them most?123124This information is essential because genetic risk is only part of the picture. A person125with a family history of early heart attack AND multiple CAD risk SNPs faces very different126odds than someone with the same SNPs but no family history.127128### Deep Risk Analysis129130Based on the user's health profile, conduct a targeted deep-dive. Read131`references/deep_risk_snps.md` for extended SNP panels organized by disease pathway:132133- **Lipid metabolism** (~20 SNPs): LDLR, APOB, PCSK9, HMGCR, CETP, LPL, APOA5, etc.134- **Coronary artery disease** (~15 SNPs): 9p21.3, LPA, MTHFR, CRP, IL6, F5, F2, etc.135- **Uric acid / gout** (~10 SNPs): SLC2A9, ABCG2, SLC22A12, SLC17A1, etc.136- **Diabetes risk** (~10 SNPs): TCF7L2, KCNJ11, SLC30A8, PPARG, FTO, etc.137- **Statin pharmacogenomics** (~5 SNPs): SLCO1B1, CYP3A4, ABCB1, etc.138139For each category relevant to the user:1401. Query ALL SNPs in the extended panel (use both chip + VCF dual-source)1412. Tally risk alleles and categorize (high/moderate/low/protective)1423. Compute a qualitative risk profile (not a numeric "score" — explain why)1434. Cross-reference with the user's actual health status and family history1445. Note any SNPs that could NOT be found (missing data)145146### Variant Verification (if CRAM/BAM available)147148If the user has provided alignment files:149- Use samtools/bcftools to verify key high-risk variants directly from reads150- Report read depth and allele balance for critical SNPs151- Flag any low-confidence calls152153Note: samtools may need to be compiled from source in sandboxed environments.154See `references/tool_setup.md` for instructions.155156### Ancestry Analysis (if WGS available)157158For whole-genome sequencing data:159- **mtDNA haplogroup**: Check diagnostic variants against PhyloTree. Important: VCF160 files report variants against rCRS (which is haplogroup H). Absence of a variant161 means the person carries the rCRS allele at that position. Look for the 9bp deletion162 at position 8270-8278 (B haplogroup marker, common in East Asian populations).163- **Y chromosome haplogroup** (if male): Check ISOGG diagnostic SNPs (e.g., M122 for164 O2 haplogroup, common in East Asian populations).165166## Phase 4: Personalized Recommendations167168Based on all gathered information, produce actionable recommendations.169170### Supplement Plan171172Read `references/supplement_guide.md` for evidence-based supplement recommendations173mapped to genetic findings. The guide covers:174175- Which genetic variants warrant which supplements176- Dosage ranges with citations177- Drug-supplement interactions to watch for178- Priority tiers (core / recommended / optional)179- Age-specific timing and duration advice180- When to recheck labs181182Always organize supplements into tiers:1831. **Core**: strongly supported by genetics + current health status1842. **Recommended**: good evidence, beneficial given risk profile1853. **Optional**: supporting evidence, lower priority186187### Screening & Monitoring Schedule188189Based on the risk profile, suggest:190- Which lab tests to monitor and how often191- Age milestones for specific screenings (e.g., coronary CTA at 30 if strong family history)192- Target values for key metrics193194### Output Formats195196Offer to generate:197- **HTML report** — comprehensive, interactive, printable198- **Excel spreadsheet** — dosing schedule table for daily reference199- **Summary document** — one-page overview for sharing with a physician200201## Important Principles202203### Medical Disclaimer204Every report MUST include a clear disclaimer: genetic analysis provides risk estimates,205not diagnoses. Results should be discussed with a qualified healthcare provider. Consumer206genetic testing has limitations in coverage and accuracy compared to clinical-grade testing.207208### Evidence Standards209- Always cite PMIDs for risk associations210- Distinguish between GWAS-level evidence and functional/clinical evidence211- Note when evidence is primarily from non-Asian populations (if the user appears to be212 of East Asian descent based on their data or stated ethnicity)213- Use language like "increased risk" rather than "you will get"214215### Language216Follow the user's language. If the user writes in Chinese, produce reports in Chinese.217If in English, use English. For SNP names and gene symbols, always keep the standard218scientific nomenclature regardless of language.219220### Iterative Approach221Don't try to do everything at once. The workflow is designed as a conversation:2221. Parse → show what you found → ask what to focus on2232. Initial analysis → present results → gather health context2243. Deep dive → present findings → discuss implications2254. Recommendations → deliver in requested format226227Each phase should end with a clear handoff to the user before proceeding.