[Forge] Metabolic pathway flux pipeline - gene KO to COBRApy FBA/FVA to flux-shift artifact open

← Forge
Composes cobrapy + Recon3D + E-Flux scaling into FBA/FVA flux-shift artifacts with Escher maps.
Spec File

Effort: thorough

Goal

Build a metabolic-pathway flux pipeline using cobrapy that takes
a gene knock-out (or knock-down expression change), simulates the
resulting metabolic flux in a context-specific genome-scale model
(Recon3D for human or species-appropriate alternative), runs FBA
(Flux Balance Analysis) and FVA (Flux Variability Analysis), and
persists the per-reaction flux shift as an interpretable artifact.
Used by metabolic-vertical debates ("does GLP-1R agonism shift hepatic
gluconeogenesis fluxes?") to provide quantitative answers, not just
literature claims.

Why this matters

The metabolic vertical needs more than DEG analysis to be credible —
fluxes through the metabolic network are what physiologically matter,
and constraint-based modeling is the only tractable way to estimate
them at scale. cobrapy is bundled but no pipeline composes it. With
this pipeline, a metabolic Theorist can argue from simulated fluxes,
the Skeptic can rerun with alternative constraints, and the resulting
artifact is reproducible.

Acceptance Criteria

☐ New module scidex/forge/pathway_flux.py (≤700 LoC):
- load_model(name='Recon3D') — caches Recon3D SBML and
returns a cobra.Model; supports iJO1366 (E. coli) and
iCHOv1 (CHO) as alternatives.
- apply_knockout(model, gene_symbol) — translates gene to
reactions via the model's GPR; sets bounds to 0; returns
modified copy.
- apply_expression(model, gene_to_fold_change) — bulk-applies
a fold-change dict via E-Flux scaling (constraint = baseline
× log1p(fold_change)).
- run_fba(model) — solves; returns objective value + fluxes.
- run_fva(model, fraction_of_optimum=0.95) — solves FVA;
returns per-reaction min/max bounds.
- compare(baseline, perturbed) — computes per-reaction
flux shift, ranks by absolute change, identifies subsystems
with concentrated effect.
- pipeline(gene_or_expression, model='Recon3D') — composes
and commits artifact under
data/scidex-artifacts/flux/<run_id>/ with the SBML
snapshot, flux JSON, and an Escher map highlighting the
top-shifted subsystem.
☐ Migration flux_run(run_id PRIMARY KEY, model_name,
perturbation_kind TEXT CHECK IN ('knockout','expression'),
perturbation_spec_json, baseline_objective, perturbed_objective,
n_reactions_changed, top_subsystem, pipeline_version,
started_at, finished_at, artifact_id)
.
tools.py registers pathway_flux_pipeline(...) with
@log_tool_call.
/artifacts/<id> renders the Escher map (existing image
generator infrastructure can produce SVG); ranked-reaction
table next to it.
☐ Metabolic-vertical Domain Expert prompt
(q-vert-vertical-personas-pack) receives a flux_block when
a hypothesis names a gene with a recent flux run.
☐ Acceptance: python -m scidex.forge.pathway_flux --gene G6PD
on Recon3D completes <2 min; reports altered glycolysis +
pentose-phosphate fluxes (sanity check); artifact registered.
☐ Tests: KO of an essential reaction lethal-by-construction
drops growth objective to ~0; non-essential KO leaves
objective unchanged.

Approach

  • Recon3D pulled from BiGG (http://bigg.ucsd.edu/static/models/Recon3D.xml)
  • — cache under data/cobra/Recon3D.xml.
  • E-Flux is a simple constraint scaling — implement once.
  • Escher map rendering uses escher Python lib if installable,
  • else SVG via cobra's basic plotter.
  • The pipeline composes well with q-tool-singlecell-trajectory-
  • pipeline — single-cell DEG output can drive a per-cell-type
    E-Flux run.
  • Persona injection mirrors the DepMap pattern.
  • Dependencies

    • cobrapy skill.
    • Recon3D model (one-time download).
    • q-vert-vertical-personas-pack — metabolic-expert persona consumes
    the flux_block.

    Work Log

    Sibling Tasks in Quest (Forge) ↗