Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
The flux-analyzer skill transforms raw FBA output into actionable biological
knowledge. It operates on FBA result files and the COBRApy model to produce
gene essentiality maps, phenotypic phase planes (PPP), flux sampling
distributions, pathway-level summaries, and product secretion profiles.
This skill is the metabolic-modelling analogue of event reconstruction and
phenomenology summary stage in the ColliderAgent pipeline: it turns numbers
into biology.
Workflow
Step 1 — Load Model and FBA Results
import cobra
import cobra.io
import cobra.flux_analysis
import cobra.sampling
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
model = cobra.io.load_json_model()
fba_fluxes = pd.read_csv(, index_col=)[]
wt_growth = model.optimize().objective_value
()
"my_model.json"
"fba_fluxes.csv"
0
"flux_mmol_gDW_h"
print
f"Wild-type growth: {wt_growth:.4f} h^-1"
Step 2 — Gene Essentiality Analysis
Essential genes are those whose deletion reduces growth to below 5% of
wild-type — a widely used lethality criterion.
The PPP maps growth rate over a 2D grid of two nutrient uptake rates, revealing
metabolic phase transitions (aerobic growth, mixed-acid fermentation, etc.).
Identify exchange reactions carrying positive flux (secretion) at optimal
growth — these are by-products and potential products of interest.
secretion = {}
for rxn in model.exchanges:
flux = fba_fluxes.get(rxn.id, 0.0)
if flux > 1e-6: # positive = secretion
met = list(rxn.metabolites)[0]
secretion[rxn.id] = {
"metabolite": met.name,
"formula": met.formula,
"flux_mmol_gDW_h": flux,
}
sec_df = pd.DataFrame(secretion).T.sort_values("flux_mmol_gDW_h",
ascending=False)
print("\nSecreted products:")
print(sec_df.to_string())
sec_df.to_csv("secretion_profile.csv")
Key Conventions
Analysis
Lethality Threshold
Standard Reference
Single gene deletion
growth < 5% WT
Joyce & Palsson, 2006
Double gene deletion (synthetic lethal)
growth < 5% WT
Deutscher et al., 2008
Reaction deletion
growth < 5% WT
Consistent with gene deletion
PPP nutrient grid
0–20 mmol/gDW/h, 50 steps
COBRApy default
Flux sampling (OptGP)
n = 1000, thinning = 100
Megchelenbrink et al., 2014
Output File Conventions
File
Content
gene_essentiality.csv
Per-gene growth fraction and essentiality flag
double_gene_essentiality.csv
Pairwise synthetic lethality matrix
reaction_essentiality.csv
Per-reaction growth fraction and essentiality flag
phenotypic_phase_plane.pdf
2D heatmap of growth vs. two nutrients
flux_samples.csv
Raw 1000-sample flux matrix
flux_sampling_violin.pdf
Violin plot of key reaction distributions
pathway_flux_summary.csv
Total absolute flux per metabolic subsystem
pathway_activity.pdf
Bar chart of top 15 active pathways
secretion_profile.csv
All secreted by-products at optimal growth
Common Failure Modes
PPP returns all zeros: objective reaction ID does not match model; check
model.objective.expression for correct reaction ID.
Flux sampling ACHR crashes: optgp (default) is more stable for large
models; for models with >5000 reactions use processes=1 to debug.
No secretion products: model may be forced to be strictly aerobic with
all carbon converted to CO2; verify exchange bounds allow secretion
(ub = 1000 on exchange reactions).