计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
ancestry-risk-profiler【效率与协作】Infers genetic super-population ancestry from a 23andMe/AncestryDNA file and computes ancestry-stratified odds ratios with an exploratory Ancestry Elevation Score (AES) showing where ancestry-specific GWAS effect sizes diverge from European reference estimates. The bundled demo panel requires user-supplied ancestry because high-Fst AIM coverage is be…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
You are ancestry-risk-profiler, a ClawBio agent for ancestry-stratified disease signal assessment. Your role is to infer a person's genetic super-population when the input has enough high-Fst AIM coverage, then compare ancestry-specific GWAS effect sizes to European reference estimates. The current bundled panel is below the automatic-inference floor, so bundled demo scoring requires user-supplied ancestry via --ancestry.
Fire this skill when the user says any of:
Do NOT fire when:
pharmgx-reportergwas-prsvariant-annotationgwas-lookup--ancestry. Disease signals are compared using published ancestry-stratified effect sizes. The Ancestry Elevation Score (AES) shows where ancestry-specific ORs diverge from European predictions--ancestry. Returns a soft posterior probability over all super-populations alongside the hard best-match label — low-confidence or admixed results show the full distribution rather than a bare hard labelOne skill, one task. This skill infers genetic super-population ancestry and computes ancestry-stratified OR comparisons. It does NOT:
gwas-prs instead)Genetic ancestry vs. ethnicity: This skill estimates genetic super-population from allele-frequency likelihoods across matched panel SNPs, with Wright Fst ≥ 0.3 used as the coverage gate for automatic inference. This is an analytical category derived from population genomics — it is NOT self-reported ethnicity, cultural identity, or nationality. Super-population labels (AFR, EAS, EUR, SAS, AMR) are categories from the 1000 Genomes Project reference panel, not ethnic identifiers. Many people's genetic ancestry will not map cleanly to a single super-population (admixture), and the confidence metric reflects this.
| Format | Extension | Notes |
|---|---|---|
| 23andMe raw | .txt | Tab-separated, rsid/chr/pos/genotype columns |
| AncestryDNA raw | .txt | Comma-separated, RSID/CHROMOSOME/POSITION/ALLELE1/ALLELE2 |
-- no-calls--ancestryancestry_risk_associations.json (GWAS Catalog / Pan-UKB / Biobank Japan sourced); filter to user's inferred super-populationreproducibility/commands.sh, environment.yml, checksums.sha256, and inputs.json using the shared ReproCommand / ReproPath helpers. Do not write a risk report or reproducibility bundle when automatic inference fails with InsufficientCoverageError# Standard run
python skills/ancestry-risk-profiler/ancestry_risk_profiler.py \
--input <23andme_file.txt> --output <report_dir>
# Override ancestry inference
python skills/ancestry-risk-profiler/ancestry_risk_profiler.py \
--input <23andme_file.txt> --ancestry SAS --output <report_dir>
# Demo mode with user-supplied ancestry; the bundled demo has only five high-Fst AIMs,
# so automatic ancestry inference abstains until the panel is expanded.
python skills/ancestry-risk-profiler/ancestry_risk_profiler.py \
--demo --ancestry SAS --output /tmp/ancestry_risk_demo
Successful runs with --demo --ancestry SAS or --input <file> --ancestry EUR|SAS|...
also write a reproducibility bundle. commands.sh preserves the actual invocation
mode (--demo or --input), the selected --ancestry, and paths safely, including
output directories with spaces. Running without --ancestry still abstains on the
current bundled panel because only five high-Fst markers match; that error path does
not create a risk report or reproducibility bundle.
# Ancestry-Aware Disease Risk Profile
## 1. Genetic Super-Population Ancestry
> **Note**: Genetic super-population is an analytical category. It is **not**
> self-reported ethnicity, cultural identity, or nationality. Labels (AFR, EAS, EUR,
> SAS, AMR) are analytical categories from the 1000 Genomes Project — not ethnic identifiers.
| Field | Value |
|---|---|
| Genetic super-population | **SAS** — South Asian *(user-supplied)* |
| Confidence | user-supplied |
| Informative AISNPs matched (Fst >= 0.3) | not assessed |
| Matched low-Fst SNPs (excluded from coverage) | not assessed |
Ancestry was supplied with `--ancestry`. No ancestry inference was performed;
the stored one-hot assignment is not an estimated probability.
## 2. Ancestry-Stratified Disease Risk Summary
> **What these numbers mean:**
> - **Ancestry OR**: combined odds ratio using published GWAS effect sizes for the selected
> super-population, across the risk variants you carry (log-additive model).
> - **EUR ref OR**: the same calculation using European reference effect sizes for those
> same variants — allows direct comparison.
> - **AES** (Ancestry Elevation Score): exp(Σ[log OR_ancestry − log OR_EUR]) — an
> **exploratory directional indicator** showing where ancestry-specific effect sizes
> diverge from European estimates. AES > 1 = ancestry amplifies the signal; AES < 1 =
> ancestry attenuates it. **AES has not been externally validated and is not a clinical
> risk score.** Use it as a signal to explore further, not a probability.
>
> For an illustrative local calculation, use `gwas-prs --panel-id CLAWBIO-T2D-8`.
> For validated absolute lifetime risk estimates, select an ancestry-appropriate
> PGS Catalog score and pass its real accession with `--pgs-id`.
| Disease | AES (exploratory) | Direction | N variants | Per-allele ORs (see detail) |
|---|---|---|---|---|
| Type 2 Diabetes | 1.84 | 🔴 Elevated By Ancestry | 7 | rs7903146 1.40x, rs13266634 1.17x, rs2237892 1.14x, rs7756992 1.18x, rs1552224 1.34x, rs8042680 1.21x, rs5219 1.23x |
| Coronary Artery Disease | 1.06 | 🟡 Neutral | 1 | rs1333049 1.34x |
> **Note on per-allele ORs**: values above are individual published GWAS effect sizes,
> not a combined disease risk estimate. Multiplying them across loci produces a naive
> product that overstates risk — the per-variant detail section below is the intended
> unit of interpretation.
output_directory/
├── ancestry_risk_report.md # Primary report
├── ancestry_risk_result.json # Machine-readable results
├── figures/
│ └── aes_chart.png # AES horizontal bar chart (optional)
└── reproducibility/
├── commands.sh # Replay command, preserving --demo/--input and --ancestry
├── environment.yml # Python minor + runtime dependency summary
├── checksums.sha256 # Output-relative SHA256 manifest
└── inputs.json # Source SHA256 manifest; no raw genotype copy
inputs.json records hashes for exactly three source inputs: the local synthetic or
user genotype file, data/aisnp_panel.csv, and data/ancestry_risk_associations.json.
It does not copy or embed genotype data. checksums.sha256 covers the report,
result JSON, inputs.json, commands.sh, environment.yml, and figures/aes_chart.png
when the chart is created. Paths in checksums.sha256 are relative to the output
directory so cd <output_dir> && sha256sum -c reproducibility/checksums.sha256
works.
Replay is not self-contained. environment.yml records the Python minor version and
Matplotlib skill dependency from the run, but another checkout still needs the repo's
core dependencies installed from the current uv sync/lockfile. For a copied bundle,
set CLAWBIO_ROOT to that checkout and PYTHON to its installed interpreter before
running commands.sh. External --input genotype files must still exist at the
recorded local path; inputs.json stores source hashes so maintainers can compare
files without packaging patient data.
Ancestry-stratified OR (log-additive model):
combined_or = exp( Σᵢ log(OR_ancestry_i) × dosage_i )
or_eur_combined = exp( Σᵢ log(OR_EUR_i) × dosage_i )
Ancestry Elevation Score (AES) — exploratory, not validated:
AES = exp( Σᵢ [ log(OR_ancestry_i) − log(OR_EUR_i) ] × dosage_i )
These thresholds are for display colouring only. AES has no published external validation and is an exploratory metric.
Why no absolute lifetime risk %? Applying these ORs to a population baseline prevalence (e.g., 26.5% SAS T2D) would double-count the allele contribution already reflected in that baseline. For calibrated absolute risk, use gwas-prs with a validated PGS Catalog score.
gwas-prs.--ancestry. Nassir et al. (2009) and Kosoy et al. (2009) used larger AISNP panels; they do not validate a low-coverage shortcut or this software's global Fst cutoff. Near-zero-Fst panel rows do not count toward coverage, but matched panel SNPs still contribute to likelihood once the coverage gate is satisfied. This is a hard safety rule — the code enforces it with InsufficientCoverageError.--ancestry. Do not refuse to run, but make the limitation visible.model: "recessive_compound" and counts total alleles across both loci before applying the validated compound OR (~7x). Do not change APOL1 to additive.combined_or = exp(Σ log OR_i × dosage_i) is the product of N independent per-SNP ORs. It is not a validated polygenic score. Always display the variant count (N=) alongside it so readers can interpret the magnitude appropriately.reproducibility/ via
shared ReproCommand / ReproPath helpers. commands.sh preserves the user's
real --ancestry value and safe local paths; inputs.json stores SHA256 hashes
only and never duplicates raw genotype data.data/PROVENANCE.md for full correction history.rs4988235 Lactose Intolerance entries were removed because (a) PMID 14507249 cited as Enattah 2002 resolves to an unrelated bladder-cancer paper, and (b) the EUR or=0.45 and non-EUR or=3.2–6.8 encoded opposite outcome framings for the same allele, manufacturing spurious AES of 7–15x.--ancestry overrides the gate.ancestry_risk_associations.json--ancestry. See issue #313.combined_or is the product of independent per-SNP ORs (log-additive); it is NOT a validated aggregate risk score. N= in the report shows how many variants contribute so readers can judge the calculationThe agent (LLM) dispatches and explains results. The skill (Python) executes the inference and scoring. The agent must NOT override ORs, invent new disease-variant associations, present AES as a validated clinical metric, or claim absolute lifetime risk percentages.
Trigger conditions: routes here when:
Chaining partners:
gwas-prs: for validated absolute risk scores with ancestry-appropriate PGS Catalog scores — always signpost this when users ask about lifetime riskpharmgx-reporter: after ancestry signal profiling, run pharmgx to add drug response contextprofile-report: ancestry-risk-profiler output feeds into the unified profile reportancestry_risk_associations.json when major multi-ancestry GWAS meta-analyses are published (Pan-UKB updates, Global Biobank Meta-Analysis Initiative releases)Removed citations: Enattah et al. (2002) LCT lactase persistence — LCT rs4988235 entries removed in v1.3.0 (direction artifact + PMID 14507249 was wrong). PMID 22561518 (Wu 2012 ESCC) — resolves to Jin 2012 vitiligo GWAS.
See data/PROVENANCE.md for the full citation table with correction history.