Agent skill

Flux Balance Analysis Simulator

by aiming-lab in aiming-lab/AutoResearchClaw

Runs flux balance analysis and related constraint-based simulations on a COBRApy metabolic model, from standard FBA to gene knockouts and carbon source swaps.

MITAuto-check passedResearch & Science

Install Flux Balance Analysis Simulator

skills CLI
$ npx skills add aiming-lab/AutoResearchClaw --skill fba-simulator -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aiming-lab/AutoResearchClaw fba-simulator --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aiming-lab/AutoResearchClaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/external/agents/Biology-Agent/skills/fba-simulator .claude/skills/fba-simulator && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fba-simulator
GitHub stars
15k
Token cost
~2.1k tokens
SKILL.md length
374 words
Files
1
Skills in repo
34
Repo updated
First seen
Licence
MIT

At a glance

Runs flux balance analysis and related constraint-based simulations on a COBRApy metabolic model, from standard FBA to gene knockouts and carbon source swaps.

  • Works in 9 steps: Load Validated Model → Standard FBA → Parsimonious FBA (pFBA) → …
  • Predicting growth rate from a genome-scale metabolic model
  • SKILL.md covers Overview, Workflow and Key Conventions
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

The skill runs constraint-based metabolic simulations on an already validated COBRApy model. Standard FBA solves a linear program for the flux distribution that optimizes the objective, usually biomass, under steady-state stoichiometric and bound constraints. The workflow then moves to parsimonious FBA, which fixes maximum growth first and then minimizes total flux, and to flux variability analysis, which reports the minimum and maximum flux of each reaction at a chosen fraction of optimal growth, such as 90%.

Further steps cover loopless FBA to remove thermodynamically infeasible energy cycles, single gene and reaction knockouts, and carbon source swapping through exchange reactions. COBRApy context managers restore the model after each change, so the simulations leave it untouched. The skill is meant to sit after model construction (gsmm-builder) and before biological interpretation (flux-analyzer), and it writes out flux distributions and CSV files.

When your agent uses it

  • Predicting growth rate from a genome-scale metabolic model
  • Finding which reactions can carry flux near optimal growth
  • Simulating gene or reaction knockouts and comparing growth
  • Testing how growth changes when the carbon source is swapped

Example prompts

  • “Run FBA on my E. coli iJO1366 model and report the growth rate.”
  • “Run flux variability analysis at 90% of optimal growth and save the flux ranges to a CSV.”
  • “Knock out gene b0720 and tell me how much growth drops.”
  • “Compare growth on glucose with growth on another carbon source for this model.”

Requirements

  • Python with COBRApy
  • A validated COBRApy metabolic model

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Load Validated Model
  2. Standard FBA
  3. Parsimonious FBA (pFBA)
  4. Flux Variability Analysis (FVA)
  5. Loopless FBA
  6. Gene Knockout Simulations
  7. Reaction Knockout Simulations
  8. Carbon Source Swapping
  9. Aggregate and Save Results

What it can do on your machine

Read from SKILL.md and the folder at commit be4ba47. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Flux Balance Analysis Simulator loads about 2.1k tokens when it runs. Until then it costs about 72 tokens; SKILL.md has 374 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~72
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from aiming-lab/AutoResearchClaw at commit be4ba47, republished under its MIT licence (© aiming-lab). 374 words, ~2,070 tokens.

Download SKILL.mdSave it as .claude/skills/fba-simulator/SKILL.md (or your agent's skills folder).
name
fba-simulator
description
Run Flux Balance Analysis (FBA) and related constraint-based simulations using COBRApy. Covers standard FBA, parsimonious FBA (pFBA), Flux Variability Analysis (FVA), loopless FBA, gene/reaction knockouts, and carbon source swapping. Outputs flux distributions and CSV files.
metadata.category
domain
metadata.trigger-keywords
metabolic,FBA,pFBA,FVA,Flux Balance Analysis,COBRApy,knockout,carbon source,medium swap,flux distribution,growth rate
metadata.applicable-stages
9,10,11,12,13,14,15
metadata.priority
1

Overview

The fba-simulator skill executes constraint-based metabolic simulations on a validated COBRApy model. FBA solves a linear program to find the flux distribution that maximizes (or minimizes) the objective function subject to stoichiometric and thermodynamic constraints.

This skill sits between model construction (gsmm-builder) and biological interpretation (flux-analyzer). All simulations are non-destructive: COBRApy context managers restore model state after each perturbation.


Workflow

Step 1 — Load Validated Model
python
import cobra
import cobra.io
import cobra.flux_analysis
import pandas as pd

model = cobra.io.load_json_model("my_model.json")
print(f"Model: {model.id}  Solver: {model.solver}")
Step 2 — Standard FBA

FBA maximizes the objective (typically biomass) subject to stoichiometric steady-state constraints: S·v = 0, lb ≤ v ≤ ub.

python
# Run FBA
solution = model.optimize()

print(f"Status          : {solution.status}")
print(f"Growth rate     : {solution.objective_value:.4f} h^-1")
print(f"Glucose uptake  : "
      f"{solution.fluxes['EX_glc__D_e']:.4f} mmol/gDW/h")
print(f"O2 uptake       : "
      f"{solution.fluxes.get('EX_o2_e', 0):.4f} mmol/gDW/h")
print(f"Acetate sec.    : "
      f"{solution.fluxes.get('EX_ac_e', 0):.4f} mmol/gDW/h")

# Save full flux distribution
solution.fluxes.to_csv("fba_fluxes.csv", header=["flux_mmol_gDW_h"])
Step 3 — Parsimonious FBA (pFBA)

pFBA first maximizes growth, then minimizes total absolute flux, producing the most "economical" solution consistent with maximum growth. This avoids biologically unrealistic high-flux split cycles.

python
pfba_solution = cobra.flux_analysis.pfba(model)

print(f"pFBA growth rate : {pfba_solution.objective_value:.4f} h^-1")
print(f"Total flux norm  : {pfba_solution.fluxes.abs().sum():.2f}")

pfba_solution.fluxes.to_csv("pfba_fluxes.csv", header=["flux_mmol_gDW_h"])
Step 4 — Flux Variability Analysis (FVA)

FVA computes the minimum and maximum flux each reaction can carry while maintaining at least fraction_of_optimum of the maximum growth rate. This reveals which fluxes are uniquely determined vs. flexible.

python
from cobra.flux_analysis import flux_variability_analysis

# FVA at 90% of maximum growth
fva_result = flux_variability_analysis(
    model,
    fraction_of_optimum=0.90,
    processes=4,          # parallel workers
)

# fva_result is a DataFrame with columns "minimum" and "maximum"
print(fva_result.head(10))

# Identify rigidly constrained reactions (min ≈ max)
TOLERANCE = 1e-6
rigid = fva_result[
    (fva_result["maximum"] - fva_result["minimum"]).abs() < TOLERANCE
]
print(f"\nRigid reactions (min=max): {len(rigid)}")

fva_result.to_csv("fva_result.csv")
Step 5 — Loopless FBA

Standard FBA may route flux through thermodynamically infeasible energy- generating cycles. Loopless FBA enforces thermodynamic feasibility.

python
loopless_sol = cobra.flux_analysis.loopless_solution(model)

print(f"Loopless growth  : {loopless_sol.objective_value:.4f} h^-1")
loopless_sol.fluxes.to_csv("loopless_fluxes.csv",
                            header=["flux_mmol_gDW_h"])
Step 6 — Gene Knockout Simulations
python
# Single gene knockout (context manager — model is restored after)
gene_id = "b0720"  # pgi in E. coli iJO1366

with model:
    model.genes.get_by_id(gene_id).knock_out()
    ko_solution = model.optimize()
    print(f"KO {gene_id} growth: {ko_solution.objective_value:.4f} h^-1")

# Batch single gene deletions
from cobra.flux_analysis import single_gene_deletion

deletion_results = single_gene_deletion(model)
# Returns DataFrame: index = frozenset({gene_id}), columns = [growth, status]
deletion_results.to_csv("gene_deletions.csv")

# Essential genes: growth < 5% of wild-type
wt_growth = model.optimize().objective_value
essential = deletion_results[
    deletion_results["growth"] < 0.05 * wt_growth
]
print(f"\nEssential genes: {len(essential)}")
print(essential.head())
Step 7 — Reaction Knockout Simulations
python
from cobra.flux_analysis import single_reaction_deletion

rxn_deletion_results = single_reaction_deletion(model)
rxn_deletion_results.to_csv("reaction_deletions.csv")

essential_rxns = rxn_deletion_results[
    rxn_deletion_results["growth"] < 0.05 * wt_growth
]
print(f"Essential reactions: {len(essential_rxns)}")
Step 8 — Carbon Source Swapping
python
CARBON_SOURCES = {
    "glucose":   ("EX_glc__D_e", -10.0),
    "fructose":  ("EX_fru_e",    -10.0),
    "acetate":   ("EX_ac_e",     -10.0),
    "glycerol":  ("EX_glyc_e",   -10.0),
    "succinate": ("EX_succ_e",   -10.0),
}

results = []

for carbon, (rxn_id, bound) in CARBON_SOURCES.items():
    with model:
        # Close all carbon exchange reactions first
        for r in model.exchanges:
            if r.lower_bound < 0 and r.id != "EX_o2_e":
                r.lower_bound = 0.0

        # Open the target carbon source
        if rxn_id in model.reactions:
            model.reactions.get_by_id(rxn_id).lower_bound = bound
            sol = model.optimize()
            results.append({
                "carbon_source": carbon,
                "growth_rate": sol.objective_value,
                "status": sol.status,
            })
        else:
            results.append({
                "carbon_source": carbon,
                "growth_rate": None,
                "status": "reaction_not_in_model",
            })

carbon_df = pd.DataFrame(results)
print(carbon_df)
carbon_df.to_csv("carbon_source_comparison.csv", index=False)
Step 9 — Aggregate and Save Results
python
summary = {
    "model_id": model.id,
    "wt_growth_fba": wt_growth,
    "wt_growth_pfba": pfba_solution.objective_value,
    "wt_growth_loopless": loopless_sol.objective_value,
    "n_essential_genes": len(essential),
    "n_essential_reactions": len(essential_rxns),
}

import json
with open("simulation_summary.json", "w") as f:
    json.dump(summary, f, indent=2)
print("Summary written to simulation_summary.json")

Key Conventions

ParameterRecommended ValueRationale
fraction_of_optimum (FVA)0.910% growth slack — realistic variability
Essentiality thresholdgrowth < 5% WTStandard in metabolic engineering
pFBA normL1 (sum abs fluxes)COBRApy default; correlates with enzyme cost
Loopless FBAUse for publicationStandard FBA may inflate central metabolism
processes (FVA)4 or CPU countScales near-linearly; avoid >8 for small models
Show full SKILL.md (122 more words)Show less
Output File Conventions
FileContent
fba_fluxes.csvStandard FBA flux vector
pfba_fluxes.csvpFBA flux vector (minimum total flux)
fva_result.csvFVA minimum/maximum per reaction
loopless_fluxes.csvLoopless-constrained flux vector
gene_deletions.csvGrowth rate for each single gene KO
reaction_deletions.csvGrowth rate for each single reaction KO
carbon_source_comparison.csvGrowth across different carbon sources
simulation_summary.jsonScalar summary of all simulation runs
Common Failure Modes
  • solution.status = "infeasible": medium is too restrictive or objective reaction bounds are wrong. Run gsmm-validator first.
  • Negative growth in pFBA: can occur if cobra.flux_analysis.pfba is called on an infeasible model — always check model.optimize() first.
  • FVA hangs: reduce processes or set loopless=False; large models (>10,000 reactions) may require HPC clusters.
  • Carbon source absent from model: check BIGG ID spelling carefully; use model.reactions.query("EX_") to list available exchanges.

© aiming-lab, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in external/agents/Biology-Agent/skills/fba-simulator of aiming-lab/AutoResearchClaw.

Open the folder on GitHubat commit be4ba47

Compare with similar skills

Flux Balance Analysis Simulator next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Flux Balance Analysis Simulator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Flux Balance Analysis Simulator this skillaiming-lab/AutoResearchClaw15k—~2.1kAutomated safety check: PassMIT
Alphagenome Single Variant Analysisgoogle-deepmind/science-skills3.2k2 repos~3kAutomated safety check: NotesApache-2.0
13C Metabolic Flux AnalysisK-Dense-AI/scientific-agent-skills48k1 repos~3.2kAutomated safety check: PassMIT
Singlecell Qcxuzhougeng/wisp-science1k—~1.6kAutomated safety check: PassAGPL-3.0
Trackplotygidtu/trackplot109—~1.9kAutomated safety check: PassBSD-3-Clause
UniProt Database Accessdavila7/claude-code-templates32k14 repos~1.7kAutomated safety check: PassMIT

Similar skills

  • Alphagenome Single Variant Analysis

    google-deepmind/science-skills

    Analyzes genetic variant effects on gene expression (RNA-seq), chromatin accessibility (DNASE), histone marks (ChIP), and transcription factors using the AlphaGenome API.

    3.2k GitHub starsUsed in 2 repos~3k tokens
    Research & ScienceAuto-check: notes
  • 13C Metabolic Flux Analysis

    K-Dense-AI/scientific-agent-skills

    Estimates reaction fluxes inside cells from steady-state carbon-13 labeling data with a bundled mfapy-based solver, and reports which fluxes the data pin down.

    48k GitHub starsUsed in 1 repo~3.2k tokens
    Research & ScienceAuto-check passed
  • Singlecell Qc

    xuzhougeng/wisp-science

    A skill your agent uses when designing, reviewing, or implementing single-cell RNA-seq QC in Python or R with a human-in-the-loop, data-driven approach.

    1k GitHub stars~1.6k tokensUpdated today
    Research & ScienceAuto-check passed
  • Trackplot

    ygidtu/trackplot

    Generate sashimi-style genome visualization plots (coverage, line, heatmap, IGV read-by-read, HiC, circRNA, motif) from BAM/bigWig/depth/HiC inputs.

    109 GitHub stars~1.9k tokensUpdated 13 days ago
    Research & ScienceAuto-check passed
  • UniProt Database Access

    davila7/claude-code-templates

    Queries the UniProt REST API directly to search proteins, fetch FASTA sequences, map IDs between databases and read Swiss-Prot and TrEMBL entries.

    32k GitHub starsUsed in 14 repos~1.7k tokens
    Research & ScienceAuto-check passed
  • End-to-end 10x Visium spatial transcriptomics analysis workflow with staged execution and human review gates.

    101 GitHub stars~1.4k tokensUpdated 1 mo ago
    Research & ScienceAuto-check passed

More from aiming-lab/AutoResearchClaw

All 34 skills in this repo
  • A-Evolve Agent Improvement

    aiming-lab/AutoResearchClaw

    Diagnoses where an agent failed across runs and turns the findings into new skills, system prompt patches and knowledge entries, using the A-Evolve loop.

    15k GitHub stars~1.8k tokensUpdated 1 mo ago
    Auto-check passed
  • Metabolic Study Planner

    aiming-lab/AutoResearchClaw

    Turns a broad metabolic modelling topic into a concrete, paper-shaped plan with organism, model, perturbations, metrics and figures before any FBA code is written.

    15k GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • MFA Pipeline Orchestrator

    aiming-lab/AutoResearchClaw

    Runs a metabolic flux analysis from model loading to phenotype prediction and figures by handing work to four sub-agents in sequence.

    15k GitHub stars~923 tokensUpdated 1 mo ago
    Auto-check passed
  • Qiskit 2.x Quantum ML Reference

    aiming-lab/AutoResearchClaw

    Reference patterns for writing qiskit 2.x code for variational quantum machine learning: feature maps, VQC training, VQE for chemistry, MPS circuits and noise models.

    15k GitHub stars~4.7k tokensUpdated 1 mo ago
    Auto-check passed
  • Genome-Scale Metabolic Model Builder

    aiming-lab/AutoResearchClaw

    Builds or loads a genome-scale metabolic model in COBRApy, sets its growth medium and objective, and exports it as a validated JSON file for flux analysis.

    15k GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Biopython Bioinformatics

    aiming-lab/AutoResearchClaw

    Quick reference for Biopython work: sequence operations, SeqIO file parsing, BLAST searches, Entrez queries, phylogenetic trees and PDB structure analysis.

    15k GitHub stars~810 tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Flux Balance Analysis Simulator

What does Flux Balance Analysis Simulator do?

Runs flux balance analysis and related constraint-based simulations on a COBRApy metabolic model, from standard FBA to gene knockouts and carbon source swaps. The skill runs constraint-based metabolic simulations on an already validated COBRApy model. Standard FBA solves a linear program for the flux distribution that optimizes the objective, usually biomass, under steady-state stoichiometric and bound constraints.

When should I use Flux Balance Analysis Simulator?

Flux Balance Analysis Simulator fits situations like: predicting growth rate from a genome-scale metabolic model; finding which reactions can carry flux near optimal growth; simulating gene or reaction knockouts and comparing growth; testing how growth changes when the carbon source is swapped.

How do I install Flux Balance Analysis Simulator in Claude Code?

Run `npx skills add aiming-lab/AutoResearchClaw --skill fba-simulator -a claude-code`. Or copy the skill folder (external/agents/Biology-Agent/skills/fba-simulator in aiming-lab/AutoResearchClaw) into .claude/skills/fba-simulator in your project. Claude Code loads it when a task matches its description.

How do I install Flux Balance Analysis Simulator in Codex?

Run `npx skills add aiming-lab/AutoResearchClaw --skill fba-simulator -a codex`. Or copy the skill folder (external/agents/Biology-Agent/skills/fba-simulator in aiming-lab/AutoResearchClaw) into .agents/skills/fba-simulator in your project. Codex loads it when a task matches its description.

Can I use Flux Balance Analysis Simulator in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aiming-lab/AutoResearchClaw --skill fba-simulator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fba-simulator, .gemini/skills/fba-simulator, .github/skills/fba-simulator and .opencode/skills/fba-simulator in your project.

What does Flux Balance Analysis Simulator need to run?

SKILL.md names no scripts, command-line tools or credentials: Flux Balance Analysis Simulator is instructions for the agent only. Our summary lists: Python with COBRApy; A validated COBRApy metabolic model.

Does Flux Balance Analysis Simulator access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Flux Balance Analysis Simulator safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Flux Balance Analysis Simulator use?

Flux Balance Analysis Simulator is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Flux Balance Analysis Simulator use?

About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Flux Balance Analysis Simulator?

Skills that share tags, products or a category with Flux Balance Analysis Simulator: Alphagenome Single Variant Analysis (google-deepmind/science-skills, 3.2k stars), 13C Metabolic Flux Analysis (K-Dense-AI/scientific-agent-skills, 48k stars), Singlecell Qc (xuzhougeng/wisp-science, 1k stars) and Trackplot (ygidtu/trackplot, 109 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Flux Balance Analysis Simulator?

aiming-lab (a GitHub organization) maintains it in aiming-lab/AutoResearchClaw, which has 14,602 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on August 19, 2026.

Source: aiming-lab/AutoResearchClaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.