Skip to content
Agentmart
Submit a tool

alterlab-cobrapy

Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variability analysis (FVA), gene and…

Skill by AlterLab-IEU

IndexedGPL-2.0★ 78
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/alterlab-ieu-alterlab-cobrapy

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variability analysis (FVA), gene and reaction knockouts, flux sampling, and SBML model I/O. Use when simulating metabolic networks, predicting growth or knockout phenotypes, or running systems-biology and metabolic-engineering analyses on SBML genome-scale models. Part of the AlterLab Academic Skills suite.

Use cases: marketing, research

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/alterlab-cobrapy

Tools it pre-approves 5

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Read
  • Write
  • Edit
  • Bash(python:*)
  • Bash(uv:*)

What's inside

Skill name
alterlab-cobrapy
Description
Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variability analysis (FVA), gene and reaction knockouts, flux sampling, and SBML model I/O. Use when simulating metabolic networks, predicting growth or knockout phenotypes, or running systems-biology and metabolic-engineering analyses on SBML genome-scale models. Part of the AlterLab Academic Skills suite.
License
GPL-2.0
Compatibility
Self-contained — runs under `uv run python` with `cobra` installed (0.32.1 as of 2026-09; depends on optlang, pandas < 3 and a solver). GLPK ships via swiglpk; CPLEX/Gurobi are optional and faster on big models. `load_model` and gapfilling from BiGG/BioModels need network access; everything else is offline.
Allowed tools
Read, Write, Edit, Bash(python:*), Bash(uv:*)
Metadata
version: 1.1.0 · last_updated: 2026-09-23 · skill-author: AlterLab
Instructions
496 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (4)

  • SKILL.md
  • evals.json · evals/
  • api_quick_reference.md · references/
  • workflows.md · references/

SKILL.md (first lines)

# COBRApy - Constraint-Based Reconstruction and Analysis

## Overview

COBRApy is a Python library for constraint-based reconstruction and analysis (COBRA) of metabolic models, essential for systems biology research. Work with genome-scale metabolic models, perform computational simulations of cellular metabolism, conduct metabolic engineering analyses, and predict phenotypic behaviors.

## When to Use This Skill

Use this skill when the user wants to:
- Load a genome-scale metabolic model (SBML/JSON/YAML) and simulate growth with FBA/pFBA.
- Predict knockout phenotypes, essential genes, or minimal media.
- Explore flux space with FVA, flux sampling, or production envelopes.
- Build, gapfill, or curate a constraint-based model.

### Does NOT Trigger

| Scenario | Use Instead |
|----------|-------------|
| Looking up a pathway or reaction annotation rather than simulating | `alterlab-kegg`, `alterlab-reactome` |
| Enzyme kinetic parameters (kcat, Km) for a reaction | `alterlab-brenda` |
| Graph analysis of the metabolic network (centrality, communities) rather than flux | `alterlab-networkx` |
| Metabolomics measurements and their identification | `alterlab-metabolomics-wb`, `alterlab-hmdb` |
| Multi-objective optimization that is not a flux-balance problem | `alterlab-pymoo` |

## Installation and Requirements

```bash
uv pip install cobra              # 0.32.x as of 2026-09
uv pip install 'cobra[array]'     # scipy extra, for array-based model handling
uv pip install 'cobra[chrr]'      # hopsy, enables the fast CHRR sampler
```

**Requirements:** depends on optlang and a solver — GLPK ships by default via swiglpk, while CPLEX and Gurobi are optional and considerably faster on genome-scale models. pandas is a hard dependency (pinned `< 3`); matplotlib/seaborn only for plots. Flux sampling and parallel deletions use multiprocessing, so guard scripts with `if __name__ == "__main__":` on Windows/macOS spawn.

> **Bundled model names.** `load_model` only recognizes three bundled aliases: `"textbook"` (the E. coli core model, `e_coli_core`), `"iJO1366"` (full E. coli genome-scale), and `"salmonella"`. Any other identifier (e.g. `"ecoli"`, `"e_coli_core"`) is not a bundled alias and triggers a remote lookup against BiGG/BioModels, which requires network access and may fail. Use `read_sbml_model("path.xml")` for your own models.

## Core Capabilities

COBRApy provides comprehensive tools organized into several key areas:

### 1. Model Management

Load existing models from repositories or files:
```python
from cobra.io import load_model

# Load bundled test models
model = load_model("textbook")  # E. coli core model
model = load_model("iJO1366")   # Full E. coli genome-scale model (BiGG)
model = load_model("salmonella")

# Load from files
from cobra.io import read_sbml_model, load_json_model, load_yaml_model
model = read_sbml_model("path/to/model.xml")
model = load_json_model("path/to/model.json")
model = load_yaml_model("path/to/model.yml")
```

Save models in various formats:
```python
from cobra.io import write_sbml_model, save_json_model, save_yaml_model
write_sbml_model(model, "output.xml")  # Preferred format
save_json_model(model, "output.json")  # For Escher compatibility
save_yaml_model(model, "output.yml")   # Human-readable
```

### 2. Model Structure and Components

Access and inspect model components:
```python
# Access components
model.reactions      # DictList of all reactions
model.metabolites    # DictList of all metabolites
model.genes          # DictList of all genes

# Get specific items by ID or index
reaction = model.reactions.get_by_id("PFK")
metabolite = model.metabolites[0]

# Inspect properties
print(reaction.reaction)        # Stoichiometric equation
print(reaction.bounds)          # Flux constraints
print(reaction.gene_reaction_rule)  # GPR logic
print(metabolite.formula)       # Chemical formula
print(metabolite.compartment)   # Cellular location
```

### 3. Flux Balance Analysis (FBA)

Perform standard FBA simulation:
```python
# Basic optimization
solution = model.optimize()
print(f"Objective value: {solution.objective_value}")
print(f"Status: {solution.status}")

# Access fluxes
print(solution.fluxes["PFK"])
print(solution.fluxes.head())

# Fast optimization (objective value only)
objective_value = model.slim_optimize()

# Change objective
model.objective = "ATPM"
solution = model.optimize()
```

Parsimonious FBA (minimize total flux):
```python
from cobra.flux_analysis import pfba
solution = pfba(model)
```

Geometric FBA (find central solution):
```python
from cobra.flux_analysis import geometric_fba
solution = geometric_fba(model)
```

From AlterLab-IEU/AlterLab-Academic-Skills, GPL-2.0.

More from AlterLab-IEU/AlterLab-Academic-Skills

Signals

Stars
78
Forks
16
Open issues
1
Last commit (this folder)
Sep 23, 2026 (1 month ago)
Last release
Sep 23, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.1.0
License
GPL-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from AlterLab-IEU

Cite this page

alterlab-cobrapy skill. Agent Mart. https://agentmart.dev/skills/alterlab-ieu-alterlab-cobrapy (last updated 2026-10-24)