{
  "version": 3,
  "created_at": "2026-07-08T19:54:04.777Z",
  "task_summary": "Celiac antigen-epitope/pMHC pipeline with TG2 deamidation and ground-truth benchmark",
  "agents": [],
  "phases": [
    {
      "name": "Plan",
      "delegations": [
        {
          "steps": [
            {
              "title": "Build gluten antigen set",
              "description": "Assemble the celiac trigger-antigen family and fetch sequences from UniProt via the pipeline's fetch_uniprot_fasta helper: alpha/beta-gliadin, gamma-gliadin, omega-gliadin, LMW- and HMW-glutenin subunits (wheat), plus the cross-reactive homologs hordein (barley) and secalin (rye). Represent each source by its full clinically-relevant family (the EoE casein lesson — no token proteins). Save celiac_gluten_antigen_set.csv (accession, source grain, protein family, length) and celiac_gluten_antigens.fasta."
            },
            {
              "title": "Assemble ground-truth epitope reference",
              "description": "Build celiac_known_epitopes.csv from the established Sollid nomenclature of HLA-DQ-restricted immunodominant gluten T-cell epitopes (DQ2.5-glia-alpha1a/alpha2/omega1/omega2, DQ2.5-glia-gamma set, DQ2.5-glut-L1/L2, DQ8-glia-alpha1, DQ8-glia-gamma1, hordein/secalin epitopes), with the 9-mer core, restricting HLA, source protein, and native (non-deamidated) counterpart. Ground the list with a literature-review check of the Sollid nomenclature papers so entries are citeable. This is the benchmark truth set for step 6."
            },
            {
              "title": "Model TG2 deamidation",
              "description": "Implement transglutaminase-2 deamidation using the QXP sequence rule (Gln->Glu at Q when a proline sits at +2 and not immediately at +1; Dorum/Fleckenstein specificity), applied across each antigen sequence. Produce a deamidation map (position, motif context, native Q -> deamidated E) and generate paired native and deamidated 15-mer sliding windows via the pipeline's sliding_windows helper. Save celiac_deamidation_map.csv and a figure showing per-antigen deamidation-site density with the immunodominant regions highlighted."
            },
            {
              "title": "Predict HLA-DQ binding (native vs deamidated)",
              "description": "Predict class-II binding for the three celiac-defining heterodimers — DQ2.5 (DQA1*05:01/DQB1*02:01), DQ8 (DQA1*03:01/DQB1*03:02), DQ2.2 (DQA1*02:01/DQB1*02:02) — over the native and deamidated 15-mer grid, using netMHCIIpan via the IEDB API as primary predictor (background cell over the antigen x allele grid; longer per-request timeout with retry), with local mhcnuggets as fallback if IEDB is unreachable. Collect flat rows {allele, antigen, peptide, core, ic50, form(native/deamidated)}. Save celiac_epitope_panel.csv. Flag DQ predictions as less-benchmarked (approximate magnitudes)."
            },
            {
              "title": "Aggregate burden and quantify the deamidation shift",
              "description": "Using summarize_binders and unique_core_count (dedup cores across alleles — avoid the double-counting bug), compute per-antigen and per-HLA strong-binder burden (IC50<500 nM) for native vs deamidated forms. Quantify the deamidation-driven affinity gain (paired native->deamidated IC50 shift per core; fraction of cores that cross the strong-binder threshold only after deamidation). Save celiac_epitope_burden.csv and a figure: per-antigen burden bars (native vs deamidated) + a paired shift plot."
            },
            {
              "title": "Benchmark predictions against known epitopes",
              "description": "The validation unique to celiac. Map predicted strong binders back to the ground-truth epitope cores from step 2 (exact-core and overlapping-window matching). Compute recall of known immunodominant epitopes, the IC50-rank enrichment of true epitopes vs background windows (e.g. AUROC / rank-sum), and whether deamidation modeling improves recovery of the known (deamidated) epitopes over native. Save celiac_epitope_benchmark.csv and a figure: predicted-rank distribution of known vs background cores per HLA, with recall annotated."
            },
            {
              "title": "Build HLA-resolved epitope panel + figures",
              "description": "Consolidate into a personalized-ready panel: per-HLA epitope heatmap (antigen x core, IC50-colored, deamidated set) and per-antigen epitope-load bar, using figure-style. Produce celiac_epitope_map.png and celiac_epitope_load.png. Tag each panel entry with whether it matches a known immunodominant epitope (validated) or is a novel predicted binder (hypothesis)."
            },
            {
              "title": "Write consolidated report",
              "description": "Write celiac_pmhc_stream_report.md: antigen set + HLA panel rationale, deamidation modeling, prediction method, the benchmark result (does the method recover known epitopes?), the deamidation-shift finding, and the ranked panel. State the presentation-vs-pathology guardrail explicitly (binding/burden is a PRIOR; specificity is defined by functional tetramer/AIM T-cell readouts) and the DQ-prediction caveat. Bundle all CSVs/figures. Note the named-investigator prior-art consideration for any translation-bound claim."
            }
          ]
        }
      ],
      "id": "phase-0"
    }
  ],
  "desired_outputs": [
    "celiac_gluten_antigen_set.csv + FASTA",
    "celiac_known_epitopes.csv (ground-truth reference)",
    "TG2 deamidation map (native vs deamidated peptides)",
    "celiac_epitope_panel.csv (DQ2.5/DQ8/DQ2.2 predictions, native + deamidated)",
    "benchmark figure + recall/enrichment metrics vs known epitopes",
    "per-antigen/per-HLA burden CSV + figures",
    "consolidated report with presentation-vs-pathology guardrail"
  ],
  "feasibility": {
    "rationale": "Directly re-runs the existing antigen-epitope-pipeline skill with a well-scoped mechanistic extension (TG2 deamidation) and — uniquely for celiac — a ground-truth benchmark against experimentally-mapped immunodominant epitopes. Antigen sequences (UniProt), HLA-DQ definitions, and the netMHCIIpan/mhcnuggets predictors are all available; the known-epitope reference is well-established (Sollid nomenclature). Main uncertainty is DQ-heterodimer prediction accuracy, which the benchmark step directly measures.",
    "confidence": "high"
  }
}