[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CH573RB20KPQDPV5B8EGS1":3,"skill-same:01M7CH573RB20KPQDPV5B8EGS1":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7CH573RB20KPQDPV5B8EGS1","locus-to-gene-mapper-skill",null,"Map GWAS loci to ranked candidate genes using a deterministic multi-skill chain (EFO -> GWAS -> coordinates -> Open Targets L2G\u002Fcoloc -> eQTL -> burden\u002Fcoding context), with reproducible tables and optional figures. Use when a user provides a trait\u002FEFO term and\u002For lead variants and needs locus-to-gene prioritization for downstream biology decisions.","rossboyd\u002Fquickque","rossboyd","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F3195729?v=4","01M7CG99NTNRFV0TWTZX9JY9CQ","rbyd","01M7CG99PH4WEP5P45VTBNPDB0",0,"MIT","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002F.tmp\u002Fplugins\u002Fplugins\u002Flife-science-research\u002Fskills\u002Flocus-to-gene-mapper-skill\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: locus-to-gene-mapper-skill\ndescription: Map GWAS loci to ranked candidate genes using a deterministic multi-skill chain (EFO -> GWAS -> coordinates -> Open Targets L2G\u002Fcoloc -> eQTL -> burden\u002Fcoding context), with reproducible tables and optional figures. Use when a user provides a trait\u002FEFO term and\u002For lead variants and needs locus-to-gene prioritization for downstream biology decisions.\n---\n\n## Locus-to-Gene Mapper\n\nGenerate a reproducible locus-to-gene mapping for one trait (or a seed set of lead variants), with explicit evidence attribution and conservative confidence labels.\n\nThis skill is optimized for bioinformaticians who need executable, traceable mapping from variant signals to plausible causal genes.\n\n## Required Inputs\n\nProvide at least one anchor source:\n\n- `trait_query` (string), for example `chronic obstructive pulmonary disease`\n- `efo_id` (string), for example `EFO_0000341`\n- `seed_rsids` (list[string]), for example `[\"rs1873625\", \"rs7903146\"]`\n\n## Optional Inputs\n\n- `target_gene` (string), optional gene of interest for highlighting in output\n- `show_child_traits` (bool), default `true`\n- `phenotype_terms` (list[string]), optional additional terms to include when finding anchors\n- `max_anchor_associations` (int), default `1200`\n- `max_loci` (int), default `25`\n- `max_genes_per_locus` (int), default `10`\n- `max_coloc_rows_per_locus` (int), default `100`\n- `max_eqtl_rows_per_variant` (int), default `200`\n- `genebass_burden_sets` (list[string]), default `[\"pLoF\", \"missense|LC\"]`\n- `include_clinvar` (bool), default `true`\n- `include_gnomad_context` (bool), default `true`\n- `include_hpa_tissue_context` (bool), default `true`\n- `include_figures` (bool), default `false`\n- `disable_default_seeds` (bool), default `false`; if `false`, common traits automatically get built-in seed rsIDs\n- `figure_output_dir` (string), default `.\u002Foutput\u002Ffigures`\n- `mapping_output_path` (string), default `.\u002Foutput\u002Flocus_to_gene_mapping.json`\n- `summary_output_path` (string), default `.\u002Foutput\u002Flocus_to_gene_summary.md`\n\n## Runtime Requirements\n\n- Python `3.11+`\n- `requests`\n- Optional for figure generation: `matplotlib`, `seaborn`, `pandas`\n\n## Bundled Script (Deterministic Runner)\n\n- Primary entrypoint: `scripts\u002Fmap_locus_to_gene.py`\n- This script:\n  - resolves trait\u002FEFO and anchor variants,\n  - resolves seed and anchor rsID coordinates directly through NCBI RefSNP\u002FdbSNP placements,\n  - gathers locus-to-gene evidence through the chained skills,\n  - writes mapping JSON and summary markdown,\n  - optionally renders figures when plotting deps are available.\n\nRun:\n\n```bash\npython locus-to-gene-mapper-skill\u002Fscripts\u002Fmap_locus_to_gene.py \\\n  --input-json \u002Fpath\u002Fto\u002Finput.json \\\n  --print-result\n```\n\nQuick start (no input JSON file):\n\n```bash\npython locus-to-gene-mapper-skill\u002Fscripts\u002Fmap_locus_to_gene.py \\\n  --trait-query \"type 2 diabetes\" \\\n  --print-result\n```\n\nTrait-only runs default to `include_figures=true` unless explicitly disabled with `--no-include-figures`.\n\nMinimal input JSON:\n\n```json\n{\n  \"trait_query\": \"type 2 diabetes\"\n}\n```\n\nBuilt-in default seeds (when `disable_default_seeds=false`):\n\n- `type 2 diabetes` \u002F `t2d` -> `rs7903146`, `rs13266634`, `rs7756992`, `rs5219`, `rs1801282`, `rs4402960`\n- `coronary artery disease` \u002F `cad` -> `rs1333049`, `rs4977574`, `rs9349379`, `rs6725887`, `rs1746048`, `rs3184504`\n- `body mass index` \u002F `bmi` -> `rs9939609`, `rs17782313`, `rs6548238`, `rs10938397`, `rs7498665`, `rs7138803`\n- `asthma` -> `rs7216389`, `rs2305480`, `rs9273349`\n- `rheumatoid arthritis` -> `rs2476601`, `rs3761847`, `rs660895`\n- `alzheimer disease` -> `rs429358`, `rs7412`, `rs6733839`, `rs11136000`, `rs3851179`\n- `ldl cholesterol` \u002F `total cholesterol` -> `rs7412`, `rs429358`, `rs6511720`, `rs629301`, `rs12740374`, `rs11591147`\n\n## Autonomous Execution Contract (Embedded Behavior)\n\nWhen a user asks for locus-to-gene mapping and gives only a trait (for example, `type 2 diabetes`), do the following automatically:\n\n1. Run the bundled script with `--trait-query \"\u003Cuser_trait>\" --print-result` (no manual JSON required).\n2. If it returns `No anchors remained`, rerun once with a built-in default seed rsID for that trait (unless `disable_default_seeds=true`).\n3. Read the generated `mapping_output_path` and `summary_output_path`.\n4. Return this concise response structure:\n   - `Top 5 cross-locus prioritized genes`\n   - `Per-locus top gene (score, confidence)`\n   - `Visualization artifact` (figure path(s) or Mermaid fallback block)\n   - `Warnings and limitations`\n5. For inline image rendering in chat:\n   - read `inline_image_markdown` from script result\n   - emit those lines exactly as plain markdown (no code fences)\n   - if inline rendering still fails, instruct user to upload PNG files into the chat\n\nDo not ask the user to run python manually unless execution is actually blocked.\n\n## Skill Chaining Order (Mandatory)\n\nUse these skills in order. Skip only when an earlier step is not needed by provided inputs.\n\n1. `efo-ontology-skill`\n   - Resolve `trait_query` to canonical EFO term and synonyms.\n   - Expand descendants when `show_child_traits=true`.\n2. `gwas-catalog-skill`\n   - Discover anchor variants for the trait\u002FEFO scope.\n   - Pull association\u002Fstudy metadata for locus context.\n3. Built-in NCBI RefSNP coordinate resolution\n   - Normalize each anchor rsID to GRCh37\u002FGRCh38 top-level chromosome placements.\n4. `opentargets-skill`\n   - Retrieve credible set context, L2G predictions, and colocalisation evidence per locus.\n5. `gtex-eqtl-skill`\n   - Retrieve single-tissue eQTL support for anchor variants.\n6. `genebass-gene-burden-skill`\n   - Retrieve rare-variant burden support for candidate genes.\n7. `clinvar-variation-skill` (when `include_clinvar=true`)\n   - Add variant clinical\u002Fcoding annotations.\n8. `gnomad-graphql-skill` (when `include_gnomad_context=true`)\n   - Add frequency and gene-level constraint context.\n9. `human-protein-atlas-skill` (when `include_hpa_tissue_context=true`)\n   - Add tissue plausibility context for top genes.\n\nNever perform additional retrieval after final candidate-gene scoring starts.\n\n## Output Contract (Required)\n\nAlways return:\n\n1. `locus_to_gene_mapping.json`\n2. `locus_to_gene_summary.md`\n\n### JSON contract\n\n```json\n{\n  \"meta\": {\n    \"trait_query\": \"...\",\n    \"efo_id\": \"EFO_...\",\n    \"generated_at\": \"ISO-8601\",\n    \"sources_queried\": []\n  },\n  \"anchors\": [\n    {\n      \"rsid\": \"rs...\",\n      \"grch38\": {\"chr\": \"3\", \"pos\": 49629531, \"ref\": \"A\", \"alt\": \"C\"},\n      \"lead_trait\": \"...\",\n      \"p_value\": 2e-11,\n      \"cohort\": \"...\"\n    }\n  ],\n  \"loci\": [\n    {\n      \"locus_id\": \"chr3:49000000-50200000\",\n      \"lead_rsid\": \"rs...\",\n      \"candidate_genes\": [\n        {\n          \"symbol\": \"MST1\",\n          \"ensembl_id\": \"ENSG...\",\n          \"overall_score\": 0.71,\n          \"confidence\": \"High|Medium|Low|VeryLow\",\n          \"evidence\": {\n            \"l2g_max\": 0.83,\n            \"coloc_max_h4\": 0.84,\n            \"eqtl_tissues\": [\"Lung\"],\n            \"rare_variant_support\": \"none|nominal|strong\",\n            \"coding_support\": \"none|noncoding|coding\",\n            \"clinvar_support\": \"none|present\",\n            \"gnomad_context\": \"...\",\n            \"hpa_tissue_support\": [\"lung\"]\n          },\n          \"rationale\": [\n            \"...\"\n          ],\n          \"limitations\": [\n            \"...\"\n          ]\n        }\n      ]\n    }\n  ],\n  \"cross_locus_ranked_genes\": [\n    {\n      \"symbol\": \"...\",\n      \"supporting_loci\": 3,\n      \"mean_score\": 0.62,\n      \"max_score\": 0.81\n    }\n  ],\n  \"warnings\": [],\n  \"limitations\": []\n}\n```\n\n### Markdown summary contract\n\nThe summary must include sections in this exact order:\n\n1. `Objective`\n2. `Inputs and scope`\n3. `Anchor variant summary`\n4. `Per-locus top genes`\n5. `Cross-locus prioritized genes`\n6. `Key caveats`\n7. `Recommended next analyses`\n\n## Optional Figure Contract\n\nOnly produce figures when `include_figures=true`.\n\nIf figures are generated, append this block to JSON:\n\n```json\n{\n  \"figures\": [\n    {\n      \"id\": \"locus_gene_heatmap\",\n      \"path\": \".\u002Foutput\u002Ffigures\u002Flocus_gene_heatmap.png\",\n      \"caption\": \"Top candidate genes by evidence component across loci\"\n    }\n  ]\n}\n```\n\nRecommended figure set:\n\n1. `locus_gene_heatmap.png`\n   - Rows: top genes, columns: evidence components (`L2G`, `coloc`, `eQTL`, `burden`, `coding`).\n2. `locus_score_decomposition.png`\n   - Stacked bars per locus for top 3 genes.\n3. `tissue_support_dotplot.png`\n   - Gene-by-tissue evidence dots from GTEx\u002FHPA context.\n\nIf plotting dependencies are unavailable, skip PNG generation and output Mermaid diagrams in markdown as fallback.\nThe script also returns `inline_image_markdown` and `render_instructions` fields to support inline chat rendering.\n\n## Scoring Rules (Deterministic)\n\nFor each candidate gene per locus, compute:\n\n- `l2g_component`: max L2G score for the gene in locus (`0..1`)\n- `coloc_component`: max `h4` (or `clpp` when only CLPP is available), clipped to `0..1`\n- `eqtl_component`: `min(1, relevant_tissue_hits \u002F 3)`\n- `burden_component`:\n  - `1.0` if burden `p \u003C 2.5e-6`\n  - `0.6` if `2.5e-6 \u003C= p \u003C 0.05`\n  - `0.0` otherwise\n- `coding_component`:\n  - `1.0` for coding consequence in target gene with supportive ClinVar annotation\n  - `0.6` for coding consequence in target gene without supportive ClinVar annotation\n  - `0.3` for noncoding-in-gene support only\n  - `0.0` otherwise\n\nOverall score:\n\n`overall_score = 0.40*l2g + 0.25*coloc + 0.15*eqtl + 0.10*burden + 0.10*coding`\n\nConfidence label:\n\n- `High` if score `>= 0.75`\n- `Medium` if `0.55 \u003C= score \u003C 0.75`\n- `Low` if `0.35 \u003C= score \u003C 0.55`\n- `VeryLow` if score `\u003C 0.35`\n\n## Pipeline Contract\n\n### Phase 0: Validate and normalize input\n\n- Enforce that at least one of `trait_query`, `efo_id`, `seed_rsids` is present.\n- Normalize rsID formatting and deduplicate seed variants.\n- Resolve free-text trait to one canonical EFO term when needed.\n\n### Phase 1: Build anchor set\n\n- If trait\u002FEFO input is provided, pull associations and rank anchors by p-value and effect availability.\n- Merge trait-derived anchors with user-supplied `seed_rsids`.\n- Cap anchors using `max_loci` and log dropped anchors in `warnings`.\n\n### Phase 2: Gather locus-to-gene evidence\n\n- Normalize anchor coordinates (both builds when possible).\n- Pull Open Targets locus evidence (credible set\u002FL2G\u002Fcoloc).\n- Pull GTEx variant-level eQTL rows.\n- Pull gene-level burden results for mapped candidate genes.\n- Pull ClinVar and gnomAD context when enabled.\n\n### Phase 3: Harmonize and score\n\n- Build a per-locus candidate-gene table.\n- Compute deterministic component scores and overall score.\n- Create cross-locus aggregate rankings.\n\n### Phase 4: Synthesize outputs\n\n- Write JSON mapping file.\n- Write markdown summary in exact section order.\n- Optionally generate figures and append `figures` metadata.\n\n### Phase 5: QC gates\n\nFail the run when any of the following occurs:\n\n- No anchors after normalization.\n- Unresolved GRCh38 coordinates should be surfaced as `status=degraded`, not treated as an analytically clean pass.\n- Any locus has candidate genes without score fields.\n- `overall_score` outside `0..1`.\n- Summary section order mismatch.\n- Claim of causality without explicit evidence support in rationale text.\n\n## Public Interface\n\n```python\ndef map_locus_to_gene(input_json: dict) -> dict:\n    ...\n```\n\nReturn:\n\n```json\n{\n  \"status\": \"ok\",\n  \"mapping_output_path\": \".\u002Foutput\u002Flocus_to_gene_mapping.json\",\n  \"summary_output_path\": \".\u002Foutput\u002Flocus_to_gene_summary.md\",\n  \"figure_paths\": [],\n  \"warnings\": [],\n  \"limitations\": []\n}\n```\n\n## Non-Invention Rules\n\n- Never invent rsIDs, p-values, scores, cohort labels, tissues, or gene links.\n- Never silently impute missing evidence as positive support.\n- When evidence is missing, record it as a limitation and reduce confidence.\n- Keep evidence provenance explicit (`source skill` + endpoint family) in rationale lines.\n\n## Non-Goals\n\n- Do not claim definitive causal genes from association evidence alone.\n- Do not run fine-mapping methods not directly provided by upstream sources.\n- Do not collapse multiple independent signals into one without stating assumptions.\n","## Locus-to-Gene Mapper\n\nGenerate a reproducible locus-to-gene mapping for one trait (or a seed set of lead variants), with explicit evidence attribution and conservative confidence labels.\n\nThis skill is optimized for bioinformaticians who need executable, traceable mapping from variant signals to plausible causal genes.\n\n## Required Inputs\n\nProvide at least one anchor source:\n\n- `trait_query` (string), for example `chronic obstructive pulmonary disease`\n- `efo_id` (string), for example `EFO_0000341`\n- `seed_rsids` (list[string]), for example `[\"rs1873625\", \"rs7903146\"]`\n\n## Optional Inputs\n\n- `target_gene` (string), optional gene of interest for highlighting in output\n- `show_child_traits` (bool), default `true`\n- `phenotype_terms` (list[string]), optional additional terms to include when finding anchors\n- `max_anchor_associations` (int), default `1200`\n- `max_loci` (int), default `25`\n- `max_genes_per_locus` (int), default `10`\n- `max_coloc_rows_per_locus` (int), default `100`\n- `max_eqtl_rows_per_variant` (int), default `200`\n- `genebass_burden_sets` (list[string]), default `[\"pLoF\", \"missense|LC\"]`\n- `include_clinvar` (bool), default `true`\n- `include_gnomad_context` (bool), default `true`\n- `include_hpa_tissue_context` (bool), default `true`\n- `include_figures` (bool), default `false`\n- `disable_default_seeds` (bool), default `false`; if `false`, common traits automatically get built-in seed rsIDs\n- `figure_output_dir` (string), default `.\u002Foutput\u002Ffigures`\n- `mapping_output_path` (string), default `.\u002Foutput\u002Flocus_to_gene_mapping.json`\n- `summary_output_path` (string), default `.\u002Foutput\u002Flocus_to_gene_summary.md`\n\n## Runtime Requirements\n\n- Python `3.11+`\n- `requests`\n- Optional for figure generation: `matplotlib`, `seaborn`, `pandas`\n\n## Bundled Script (Deterministic Runner)\n\n- Primary entrypoint: `scripts\u002Fmap_locus_to_gene.py`\n- This script:\n  - resolves trait\u002FEFO and anchor variants,\n  - resolves seed and anchor rsID coordinates directly through NCBI RefSNP\u002FdbSNP placements,\n  - gathers locus-to-gene evidence through the chained skills,\n  - writes mapping JSON and summary markdown,\n  - optionally renders figures when plotting deps are available.\n\nRun:\n\n```bash\npython locus-to-gene-mapper-skill\u002Fscripts\u002Fmap_locus_to_gene.py \\\n  --input-json \u002Fpath\u002Fto\u002Finput.json \\\n  --print-result\n```\n\nQuick start (no input JSON file):\n\n```bash\npython locus-to-gene-mapper-skill\u002Fscripts\u002Fmap_locus_to_gene.py \\\n  --trait-query \"type 2 diabetes\" \\\n  --print-result\n```\n\nTrait-only runs default to `include_figures=true` unless explicitly disabled with `--no-include-figures`.\n\nMinimal input JSON:\n\n```json\n{\n  \"trait_query\": \"type 2 diabetes\"\n}\n```\n\nBuilt-in default seeds (when `disable_default_seeds=false`):\n\n- `type 2 diabetes` \u002F `t2d` -> `rs7903146`, `rs13266634`, `rs7756992`, `rs5219`, `rs1801282`, `rs4402960`\n- `coronary artery disease` \u002F `cad` -> `rs1333049`, `rs4977574`, `rs9349379`, `rs6725887`, `rs1746048`, `rs3184504`\n- `body mass index` \u002F `bmi` -> `rs9939609`, `rs17782313`, `rs6548238`, `rs10938397`, `rs7498665`, `rs7138803`\n- `asthma` -> `rs7216389`, `rs2305480`, `rs9273349`\n- `rheumatoid arthritis` -> `rs2476601`, `rs3761847`, `rs660895`\n- `alzheimer disease` -> `rs429358`, `rs7412`, `rs6733839`, `rs11136000`, `rs3851179`\n- `ldl cholesterol` \u002F `total cholesterol` -> `rs7412`, `rs429358`, `rs6511720`, `rs629301`, `rs12740374`, `rs11591147`\n\n## Autonomous Execution Contract (Embedded Behavior)\n\nWhen a user asks for locus-to-gene mapping and gives only a trait (for example, `type 2 diabetes`), do the following automatically:\n\n1. Run the bundled script with `--trait-query \"\u003Cuser_trait>\" --print-result` (no manual JSON required).\n2. If it returns `No anchors remained`, rerun once with a built-in default seed rsID for that trait (unless `disable_default_seeds=true`).\n3. Read the generated `mapping_output_path` and `summary_output_path`.\n4. Return this concise response structure:\n   - `Top 5 cross-locus prioritized genes`\n   - `Per-locus top gene (score, confidence)`\n   - `Visualization artifact` (figure path(s) or Mermaid fallback block)\n   - `Warnings and limitations`\n5. For inline image rendering in chat:\n   - read `inline_image_markdown` from script result\n   - emit those lines exactly as plain markdown (no code fences)\n   - if inline rendering still fails, instruct user to upload PNG files into the chat\n\nDo not ask the user to run python manually unless execution is actually blocked.\n\n## Skill Chaining Order (Mandatory)\n\nUse these skills in order. Skip only when an earlier step is not needed by provided inputs.\n\n1. `efo-ontology-skill`\n   - Resolve `trait_query` to canonical EFO term and synonyms.\n   - Expand descendants when `show_child_traits=true`.\n2. `gwas-catalog-skill`\n   - Discover anchor variants for the trait\u002FEFO scope.\n   - Pull association\u002Fstudy metadata for locus context.\n3. Built-in NCBI RefSNP coordinate resolution\n   - Normalize each anchor rsID to GRCh37\u002FGRCh38 top-level chromosome placements.\n4. `opentargets-skill`\n   - Retrieve credible set context, L2G predictions, and colocalisation evidence per locus.\n5. `gtex-eqtl-skill`\n   - Retrieve single-tissue eQTL support for anchor variants.\n6. `genebass-gene-burden-skill`\n   - Retrieve rare-variant burden support for candidate genes.\n7. `clinvar-variation-skill` (when `include_clinvar=true`)\n   - Add variant clinical\u002Fcoding annotations.\n8. `gnomad-graphql-skill` (when `include_gnomad_context=true`)\n   - Add frequency and gene-level constraint context.\n9. `human-protein-atlas-skill` (when `include_hpa_tissue_context=true`)\n   - Add tissue plausibility context for top genes.\n\nNever perform additional retrieval after final candidate-gene scoring starts.\n\n## Output Contract (Required)\n\nAlways return:\n\n1. `locus_to_gene_mapping.json`\n2. `locus_to_gene_summary.md`\n\n### JSON contract\n\n```json\n{\n  \"meta\": {\n    \"trait_query\": \"...\",\n    \"efo_id\": \"EFO_...\",\n    \"generated_at\": \"ISO-8601\",\n    \"sources_queried\": []\n  },\n  \"anchors\": [\n    {\n      \"rsid\": \"rs...\",\n      \"grch38\": {\"chr\": \"3\", \"pos\": 49629531, \"ref\": \"A\", \"alt\": \"C\"},\n      \"lead_trait\": \"...\",\n      \"p_value\": 2e-11,\n      \"cohort\": \"...\"\n    }\n  ],\n  \"loci\": [\n    {\n      \"locus_id\": \"chr3:49000000-50200000\",\n      \"lead_rsid\": \"rs...\",\n      \"candidate_genes\": [\n        {\n          \"symbol\": \"MST1\",\n          \"ensembl_id\": \"ENSG...\",\n          \"overall_score\": 0.71,\n          \"confidence\": \"High|Medium|Low|VeryLow\",\n          \"evidence\": {\n            \"l2g_max\": 0.83,\n            \"coloc_max_h4\": 0.84,\n            \"eqtl_tissues\": [\"Lung\"],\n            \"rare_variant_support\": \"none|nominal|strong\",\n            \"coding_support\": \"none|noncoding|coding\",\n            \"clinvar_support\": \"none|present\",\n            \"gnomad_context\": \"...\",\n            \"hpa_tissue_support\": [\"lung\"]\n          },\n          \"rationale\": [\n            \"...\"\n          ],\n          \"limitations\": [\n            \"...\"\n          ]\n        }\n      ]\n    }\n  ],\n  \"cross_locus_ranked_genes\": [\n    {\n      \"symbol\": \"...\",\n      \"supporting_loci\": 3,\n      \"mean_score\": 0.62,\n      \"max_score\": 0.81\n    }\n  ],\n  \"warnings\": [],\n  \"limitations\": []\n}\n```\n\n### Markdown summary contract\n\nThe summary must include sections in this exact order:\n\n1. `Objective`\n2. `Inputs and scope`\n3. `Anchor variant summary`\n4. `Per-locus top genes`\n5. `Cross-locus prioritized genes`\n6. `Key caveats`\n7. `Recommended next analyses`\n\n## Optional Figure Contract\n\nOnly produce figures when `include_figures=true`.\n\nIf figures are generated, append this block to JSON:\n\n```json\n{\n  \"figures\": [\n    {\n      \"id\": \"locus_gene_heatmap\",\n      \"path\": \".\u002Foutput\u002Ffigures\u002Flocus_gene_heatmap.png\",\n      \"caption\": \"Top candidate genes by evidence component across loci\"\n    }\n  ]\n}\n```\n\nRecommended figure set:\n\n1. `locus_gene_heatmap.png`\n   - Rows: top genes, columns: evidence components (`L2G`, `coloc`, `eQTL`, `burden`, `coding`).\n2. `locus_score_decomposition.png`\n   - Stacked bars per locus for top 3 genes.\n3. `tissue_support_dotplot.png`\n   - Gene-by-tissue evidence dots from GTEx\u002FHPA context.\n\nIf plotting dependencies are unavailable, skip PNG generation and output Mermaid diagrams in markdown as fallback.\nThe script also returns `inline_image_markdown` and `render_instructions` fields to support inline chat rendering.\n\n## Scoring Rules (Deterministic)\n\nFor each candidate gene per locus, compute:\n\n- `l2g_component`: max L2G score for the gene in locus (`0..1`)\n- `coloc_component`: max `h4` (or `clpp` when only CLPP is available), clipped to `0..1`\n- `eqtl_component`: `min(1, relevant_tissue_hits \u002F 3)`\n- `burden_component`:\n  - `1.0` if burden `p \u003C 2.5e-6`\n  - `0.6` if `2.5e-6 \u003C= p \u003C 0.05`\n  - `0.0` otherwise\n- `coding_component`:\n  - `1.0` for coding consequence in target gene with supportive ClinVar annotation\n  - `0.6` for coding consequence in target gene without supportive ClinVar annotation\n  - `0.3` for noncoding-in-gene support only\n  - `0.0` otherwise\n\nOverall score:\n\n`overall_score = 0.40*l2g + 0.25*coloc + 0.15*eqtl + 0.10*burden + 0.10*coding`\n\nConfidence label:\n\n- `High` if score `>= 0.75`\n- `Medium` if `0.55 \u003C= score \u003C 0.75`\n- `Low` if `0.35 \u003C= score \u003C 0.55`\n- `VeryLow` if score `\u003C 0.35`\n\n## Pipeline Contract\n\n### Phase 0: Validate and normalize input\n\n- Enforce that at least one of `trait_query`, `efo_id`, `seed_rsids` is present.\n- Normalize rsID formatting and deduplicate seed variants.\n- Resolve free-text trait to one canonical EFO term when needed.\n\n### Phase 1: Build anchor set\n\n- If trait\u002FEFO input is provided, pull associations and rank anchors by p-value and effect availability.\n- Merge trait-derived anchors with user-supplied `seed_rsids`.\n- Cap anchors using `max_loci` and log dropped anchors in `warnings`.\n\n### Phase 2: Gather locus-to-gene evidence\n\n- Normalize anchor coordinates (both builds when possible).\n- Pull Open Targets locus evidence (credible set\u002FL2G\u002Fcoloc).\n- Pull GTEx variant-level eQTL rows.\n- Pull gene-level burden results for mapped candidate genes.\n- Pull ClinVar and gnomAD context when enabled.\n\n### Phase 3: Harmonize and score\n\n- Build a per-locus candidate-gene table.\n- Compute deterministic component scores and overall score.\n- Create cross-locus aggregate rankings.\n\n### Phase 4: Synthesize outputs\n\n- Write JSON mapping file.\n- Write markdown summary in exact section order.\n- Optionally generate figures and append `figures` metadata.\n\n### Phase 5: QC gates\n\nFail the run when any of the following occurs:\n\n- No anchors after normalization.\n- Unresolved GRCh38 coordinates should be surfaced as `status=degraded`, not treated as an analytically clean pass.\n- Any locus has candidate genes without score fields.\n- `overall_score` outside `0..1`.\n- Summary section order mismatch.\n- Claim of causality without explicit evidence support in rationale text.\n\n## Public Interface\n\n```python\ndef map_locus_to_gene(input_json: dict) -> dict:\n    ...\n```\n\nReturn:\n\n```json\n{\n  \"status\": \"ok\",\n  \"mapping_output_path\": \".\u002Foutput\u002Flocus_to_gene_mapping.json\",\n  \"summary_output_path\": \".\u002Foutput\u002Flocus_to_gene_summary.md\",\n  \"figure_paths\": [],\n  \"warnings\": [],\n  \"limitations\": []\n}\n```\n\n## Non-Invention Rules\n\n- Never invent rsIDs, p-values, scores, cohort labels, tissues, or gene links.\n- Never silently impute missing evidence as positive support.\n- When evidence is missing, record it as a limitation and reduce confidence.\n- Keep evidence provenance explicit (`source skill` + endpoint family) in rationale lines.\n\n## Non-Goals\n\n- Do not claim definitive causal genes from association evidence alone.\n- Do not run fine-mapping methods not directly provided by upstream sources.\n- Do not collapse multiple independent signals into one without stating assumptions.\n",{"name":5,"description":7},"main","907b1d897cc6743f7f133f8ea2021e1331b0b020",".codex\u002F.tmp\u002Fplugins\u002Fplugins\u002Flife-science-research\u002Fskills\u002Flocus-to-gene-mapper-skill","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque","https:\u002F\u002Fgithub.com\u002Frossboyd","www.bigideasgroup.co.uk","2026-09-22 02:03:50",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add rossboyd\u002Fquickque --skill locus-to-gene-mapper-skill",{"tool":37,"command":38},"bunx","bunx skills add rossboyd\u002Fquickque --skill locus-to-gene-mapper-skill",{"tool":40,"command":41},"pnpm","pnpm dlx skills add rossboyd\u002Fquickque --skill locus-to-gene-mapper-skill","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002F.tmp\u002Fplugins\u002Fplugins\u002Flife-science-research\u002Fskills\u002Flocus-to-gene-mapper-skill\u002FSKILL.md",true,[45,51,57],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"agents\u002Fopenai.yaml","REFERENCE","参考文档",113,"https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002F.tmp\u002Fplugins\u002Fplugins\u002Flife-science-research\u002Fskills\u002Flocus-to-gene-mapper-skill\u002Fagents\u002Fopenai.yaml",{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"scripts\u002Fmap_locus_to_gene.py","SCRIPT","脚本",79824,"https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002F.tmp\u002Fplugins\u002Fplugins\u002Flife-science-research\u002Fskills\u002Flocus-to-gene-mapper-skill\u002Fscripts\u002Fmap_locus_to_gene.py",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"scripts\u002Ftest_map_locus_to_gene.py",5903,"https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002F.tmp\u002Fplugins\u002Fplugins\u002Flife-science-research\u002Fskills\u002Flocus-to-gene-mapper-skill\u002Fscripts\u002Ftest_map_locus_to_gene.py",[62,71,79,86,93,101],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":66,"licenseFileUrl":67,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7CJSS21K09H3ZQZMPFR4ZAG","skill-installer","Install Codex skills into $CODEX_HOME\u002Fskills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fskill-installer\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fskill-installer\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":66,"licenseFileUrl":75,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7CJSM1F4E7RBXCS3C18EFBY","skill-creator","Create or update a Codex skill with appropriately scoped instructions and any needed supporting resources.","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fskill-creator\u002Flicense.txt","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fskill-creator\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7CJSGF2PJM504Q6TZCNT27C","review-agent","Perform a read-only, defect-first review of a specified code change and return every actionable finding. Use when another agent delegates review of uncommitted changes, a base-branch diff, a commit, or custom review instructions.","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Freview-agent\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7CJSBQTPFEQYZF4VWS7QZ3N","plugin-creator","Create and scaffold plugin directories for Codex with a required `.codex-plugin\u002Fplugin.json`, optional plugin folders\u002Ffiles, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries for plugin ordering and availability metadata, or update an existing local plugin during development with the CLI-driven cachebuster and reinstall flow.","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fplugin-creator\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":66,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7CJS5BHJZKA16353PVZGC50","openai-docs","Use for Codex models\u002Fpricing, scheduled tasks, skills, settings, setup, troubleshooting, customization, automations, and self-knowledge—including 'you,' 'your,' 'this app,' or 'this coding agent' when they refer to Codex—and for OpenAI APIs\u002Fproducts and ChatGPT Work. Also use for model choice\u002Fmigration, prompting, SDKs, Responses, Realtime, agents, evals, and Chat\u002FWork\u002FCodex comparisons. Do not use for generic app\u002Fsoftware tasks that merely mention Codex.","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fopenai-docs\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fopenai-docs\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":66,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M7CJRY1FC048P3RF4YQZ6J8B","imagegen","Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG\u002Fvector\u002Fcode-native assets, extending an established icon or logo system, or building the visual directly in HTML\u002FCSS\u002Fcanvas.","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fimagegen\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Frossboyd\u002Fquickque\u002Fblob\u002Fmain\u002F.codex\u002Fskills\u002F.system\u002Fimagegen\u002FSKILL.md",[],[]]