Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Perform flux balance analysis (FBA) and flux variability analysis (FVA) on genome-scale metabolic models using COBRApy. Predict growth rates, metabolic fluxes, and optimal resource utilization. Use when predicting metabolic phenotypes or optimizing flux distributions.
.claude/skills/bio-systems-biology-flux-balance-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 57% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 110% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 37% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 44% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 1% | 0% |
<!--
#
#
-->
pythonimport cobra # Load built-in test models model = cobra.io.load_model('textbook') # E. coli core (95 reactions) model = cobra.io.load_model('iJO1366') # Full E. coli (2583 reactions) # Load from file model = cobra.io.read_sbml_model('model.xml') model = cobra.io.load_json_model('model.json') # BiGG models available at: http://bigg.ucsd.edu/models
pythonimport cobra model = cobra.io.load_model('textbook') # Run FBA (maximizes objective function, usually biomass) solution = model.optimize() # Growth rate interpretation: # >0.8 h^-1: Fast growth (rich media) # 0.3-0.8 h^-1: Moderate growth # <0.3 h^-1: Slow growth or stress # 0: No growth (lethal condition or missing nutrients) print(f'Growth rate: {solution.objective_value:.4f} h^-1') print(f'Status: {solution.status}') # Access flux values for rxn in model.reactions[:5]: print(f'{rxn.id}: {solution.fluxes[rxn.id]:.4f}')
pythondef set_minimal_media(model, carbon_source='EX_glc__D_e', carbon_uptake=10): '''Configure minimal media conditions Args: carbon_source: Exchange reaction ID for carbon source carbon_uptake: Maximum uptake rate (mmol/gDW/h) Typical glucose uptake: 10-20 mmol/gDW/h ''' # Close all exchange reactions for rxn in model.exchanges: rxn.lower_bound = 0 # No uptake # Open essential exchanges essential = ['EX_o2_e', 'EX_h2o_e', 'EX_h_e', 'EX_nh4_e', 'EX_pi_e', 'EX_so4_e', 'EX_k_e', 'EX_mg2_e'] for ex_id in essential: if ex_id in model.reactions: model.reactions.get_by_id(ex_id).lower_bound = -1000 # Set carbon source if carbon_source in model.reactions: model.reactions.get_by_id(carbon_source).lower_bound = -carbon_uptake return model # Example: Compare growth on different carbon sources carbon_sources = ['EX_glc__D_e', 'EX_ac_e', 'EX_succ_e'] for cs in carbon_sources: with model: set_minimal_media(model, carbon_source=cs) sol = model.optimize() print(f'{cs}: Growth = {sol.objective_value:.4f}')
pythonfrom cobra.flux_analysis import flux_variability_analysis # FVA finds the range of flux values for each reaction # while maintaining optimal (or near-optimal) growth # Standard FVA (at 100% optimum) fva = flux_variability_analysis(model) # FVA at 90% of optimal growth # fraction_of_optimum=0.9: allows 10% suboptimal solutions # This reveals alternative optimal flux distributions fva = flux_variability_analysis(model, fraction_of_optimum=0.9) # FVA for specific reactions rxns_of_interest = ['PFK', 'PGI', 'GAPD'] fva = flux_variability_analysis(model, reaction_list=rxns_of_interest) # Identify essential vs flexible reactions fva['essential'] = (fva['minimum'] > 0) | (fva['maximum'] < 0) fva['flexible'] = fva['maximum'] - fva['minimum'] > 0.01 print(fva[['minimum', 'maximum', 'essential', 'flexible']])
pythonfrom cobra.flux_analysis import production_envelope # Analyze tradeoff between growth and product secretion # Useful for metabolic engineering to find optimal conditions prod_env = production_envelope( model, reactions=['EX_ac_e'], # Product (acetate) objective='Biomass_Ecoli_core', points=20 ) # prod_env is a DataFrame with: # - EX_ac_e: acetate production rate # - Biomass_Ecoli_core: growth rate at that production level print(prod_env)
pythonfrom cobra.flux_analysis import phenotype_phase_plane # Analyze growth across two varying conditions # Typically oxygen and carbon uptake ppp = phenotype_phase_plane( model, variables=['EX_glc__D_e', 'EX_o2_e'], # X and Y axes points=10 ) # Returns growth rate as function of both uptake rates # Useful for identifying metabolic modes (aerobic vs anaerobic)
pythonfrom cobra.flux_analysis import pfba # pFBA minimizes total flux while achieving optimal growth # Produces more biologically realistic flux distributions pfba_solution = pfba(model) # Compare total flux fba_total = sum(abs(model.optimize().fluxes)) pfba_total = sum(abs(pfba_solution.fluxes)) print(f'FBA total flux: {fba_total:.1f}') print(f'pFBA total flux: {pfba_total:.1f}')
pythonfrom cobra.flux_analysis import loopless_solution # Remove thermodynamically infeasible loops # Important for realistic flux predictions solution = loopless_solution(model)
<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 13,747 | 13,533 | -2% | 1 | 1 | 0% | 3,154 | 4,946 | +57% | 0 | 0 | — |
case-02 | pass→pass | 9,908 | 7,445 | -25% | 1 | 1 | 0% | 2,039 | 3,199 | +57% | 0 | 0 | — |
case-03 | fail→pass | 6,361 | 4,016 | -37% | 1 | 1 | 0% | 1,075 | 2,262 | +110% | 0 | 0 | — |
case-21 | fail→fail | 18,676 | 18,085 | -3% | 1 | 1 | 0% | 3,327 | 5,253 | +58% | 0 | 0 | — |
case-22 | fail→fail | 13,467 | 11,051 | -18% | 1 | 1 | 0% | 2,367 | 3,507 | +48% | 0 | 0 | — |
case-04 | fail→fail | 15,650 | 9,927 | -37% | 1 | 1 | 0% | 2,962 | 3,645 | +23% | 0 | 0 | — |
case-05 | pass→pass | 7,598 | 4,298 | -43% | 1 | 1 | 0% | 1,445 | 2,404 | +66% | 0 | 0 | — |
case-06 | pass→pass | 10,788 | 3,412 | -68% | 1 | 1 | 0% | 2,155 | 2,285 | +6% | 0 | 0 | — |
case-07 | fail→pass | 10,286 | 5,321 | -48% | 1 | 1 | 0% | 1,955 | 2,679 | +37% | 0 | 0 | — |
case-08 | fail→pass | 9,897 | 5,965 | -40% | 1 | 1 | 0% | 1,856 | 2,672 | +44% | 0 | 0 | — |
case-09 | pass→pass | 15,546 | 9,733 | -37% | 1 | 1 | 0% | 2,679 | 3,284 | +23% | 0 | 0 | — |
case-10 | pass→pass | 4,541 | 2,004 | -56% | 1 | 1 | 0% | 906 | 2,012 | +122% | 0 | 0 | — |
case-11 | fail→pass | 19,147 | 2,745 | -86% | 1 | 1 | 0% | 2,123 | 2,148 | +1% | 0 | 0 | — |
case-12 | pass→pass | 11,870 | 5,584 | -53% | 1 | 1 | 0% | 1,919 | 2,501 | +30% | 0 | 0 | — |
case-13 | pass→pass | 7,314 | 3,825 | -48% | 1 | 1 | 0% | 1,427 | 2,362 | +66% | 0 | 0 | — |
case-14 | pass→pass | 9,976 | 4,124 | -59% | 1 | 1 | 0% | 1,875 | 2,428 | +29% | 0 | 0 | — |
case-15 | fail→pass | 15,474 | 7,840 | -49% | 1 | 1 | 0% | 2,569 | 3,057 | +19% | 0 | 0 | — |
case-16 | pass→pass | 3,175 | 1,951 | -39% | 1 | 1 | 0% | 569 | 1,973 | +247% | 0 | 0 | — |
case-17 | pass→pass | 8,331 | 3,345 | -60% | 1 | 1 | 0% | 1,606 | 2,187 | +36% | 0 | 0 | — |
case-18 | pass→pass | 8,209 | 3,526 | -57% | 1 | 1 | 0% | 1,535 | 2,198 | +43% | 0 | 0 | — |
case-19 | fail→fail | 22,931 | 6,613 | -71% | 1 | 1 | 0% | 2,561 | 2,751 | +7% | 0 | 0 | — |
case-20 | fail→fail | 9,989 | 8,093 | -19% | 1 | 1 | 0% | 1,898 | 3,146 | +66% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 7/26/2026 | +5% |
Other measured skills in the registry, with their headline benchmark lift.