Creator · AlterLab-IEU
Last updated · Sep 5, 2026
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 phen
Creator · AlterLab-IEU
Last updated · Sep 5, 2026
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 phen
Creator · AlterLab-IEU
Last updated · Sep 5, 2026
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 phen
Creator · AlterLab-IEU
Last updated · Sep 5, 2026
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 phen
Sandbox only
Install targets
Codex install prompt
Install the "alterlab-cobrapy" agent skill from https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-cobrapy. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"alterlab-ieu-alterlab-cobrapy","task":"Install alterlab-cobrapy","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Design assets, images, video, audio, multimodal media, presentation, and creative production skills.
Scenario
Design and creative
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Maintenance
fresh
1d since push
Risk
Needs review
Dependency or permission surface needs review
GitHub quality
63
65/100 Quality · 69/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
63 GitHub stars
Repo activity
63 stars, 13 forks
Maintenance
1d since push
License
GPL-2.0
Install
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyDo not use when
Alternative
174.6K Stars
npx skills add anthropics/skills --skill frontend-design
Alternative
84.6K Stars
npx skills add Leonxlnx/taste-skill --skill design-taste-frontend
Alternative
1.8K Stars
npx skills add Alisa0808/vox-director --skill vox-director
Alternative
174.6K Stars
npx skills add anthropics/skills --skill canvas-design
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
Agent should check
Copy prompt
Task: Use alterlab-cobrapy in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install
Install command: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
LLM text format
/api/skills/alterlab-ieu-alterlab-cobrapy/install?format=text
Find alternatives
/api/skills/search?q=alterlab-cobrapy&limit=3
Agent prompt
Use alterlab-cobrapy for this task. Review https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install, then install with: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy
LLM text
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy?format=text
Install alias
/api/registry/install/alterlab-ieu-alterlab-cobrapy
Recommend
/api/registry/recommend?task=Use%20alterlab-cobrapy%20in%20an%20agent%20workflow&limit=3
Agent fit
Research agents
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Research agents
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
CHECK63 GitHub stars
Stars/forks activity
CHECK63 stars, 13 forks; issue activity unavailable in current metadata
Recent maintenance
PASS1d since push
License clarity
PASSGPL-2.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Operate web apps
I need my agent to control a browser, fill forms, and verify web app workflows.
Create assets
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Workflow fit
Design, build, test, and ship interfaces
A practical workflow for agents that turn product briefs or Figma designs into polished frontend code, review the result, test it in a browser, and prepare a safe deployment.
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Operate and verify web apps
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Alternative shortlist
Similar skills that may fit this task.
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
--- 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 allowed-tools: Read Write Edit Bash(python:*) Bash(uv:*) compatibility: "Self-contained — runs under `uv run python` with the skill's Python package installed; no API key or account required." metadata: skill-author: AlterLab version: "1.0.0" ---
# 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.
## Installation and Requirements
```bash uv pip install 'cobra>=0.29,<0.32' ```
**Requirements:** Python 3.8+; depends on optlang and a solver (GLPK ships by default via swiglpk; CPLEX/Gurobi optional). Optional for plots: matplotlib, seaborn, pandas (pandas is already a hard dependency). Flux sampling and parallel deletions use multiprocessing.
> **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) ```
### 4. Flux Variability Analysis (FVA)
Determine flux ranges for all reactions: ```python from cobra.flux_analysis import flux_variability_analysis
# Standard FVA fva_result = flux_variability_analysis(model)
# FVA at 90% optimality fva_result = flux_variability_analysis(model, fraction_of_optimum=0.9)
# Loopless FVA (eliminates thermodynamically infeasible loops) fva_result = flux_variability_analysis(model, loopless=True)
# FVA for specific reactions fva_result = flux_variability_analysis( model, reaction_list=["PFK", "FBA", "PGI"] ) ```
### 5. Gene and Reaction Deletion Studies
Perform knockout analyses: ```python from cobra.flux_analysis import ( single_gene_deletion, single_reaction_deletion, double_gene_deletion, double_reaction_deletion )
# Single deletions gene_results = single_gene_deletion(model) reaction_results = single_reaction_deletion(model)
# Double deletions (uses multiprocessing) double_gene_results = double_gene_deletion( model, processes=4 # Number of CPU cores )
# Manual knockout using context manager with model: model.genes.get_by_id("b0008").knock_out() solution = model.optimize() print(f"Growth after knockout: {solution.objective_value}") # Model automatically reverts after context exit ```
### 6. Growth Media and Minimal Media
Manage growth medium: ```python # View current medium print(model.medium)
# Modify medium (must reassign entire dict) medium = model.medium medium["EX_glc__D_e"] = 10.0 # Set glucose uptake medium["EX_o2_e"] = 0.0 # Anaerobic conditions model.medium = medium
# Calculate minimal media from cobra.medium import minimal_medium
# Minimize total import flux min_medium = minimal_medium(model, minimize_components=False)
# Minimize number of components (uses MILP, slower) min_medium = minimal_medium( model, minimize_components=True, open_exchanges=True ) ```
### 7. Flux Sampling
Sample the feasible flux space: ```python from cobra.sampling import sample
# Sample using OptGP (default, supports parallel processing) samples = sample(model, n=1000, method="optgp", processes=4)
# Sample using ACHR samples = sample(model, n=1000, method="achr")
# Validate samples from cobra.sampling import OptGPSampler sampler = OptGPSampler(model, processes=4) sampler.sample(1000) validation = sampler.validate(sampler.samples) print(validation.value_counts()) # Should be all 'v' for valid ```
### 8. Production Envelopes
Calculate phenotype phase planes: ```python from cobra.flux_analysis import production_envelope
# Standard production envelope envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], objective="EX_ac_e" # Acetate production )
# With carbon yield envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], carbon_sources="EX_glc__D_e" )
# Visualize (use matplotlib or pandas plotting) import matplotlib.pyplot as plt envelope.plot(x="EX_glc__D_e", y="EX_o2_e", kind="scatter") plt.show() ```
### 9. Gapfilling
Add reactions to make models feasible: ```python import cobra from cobra.flux_analysis import gapfill
# Build a universal model of candidate reactions to draw from. # In practice, load a curated reaction database (e.g. the BiGG # universal reactions JSON via load_json_model) or assemble reactions # into an empty cobra.Model — there is no load_model("universal"). universal = cobra.Model("universal_reactions") # ...populate `universal` with candidate cobra.Reaction objects...
with model: # Create a gap for demonstration model.remove_reactions([model.reactions.PGI])
# Find the minimal set of reactions from `universal` to restore feasibility solution = gapfill(model, universal, demand_reactions=False) for reaction in solution[0]: print(reaction.id) ```
> **Note**: `gapfill` returns a list of reaction lists (one per iteration when `iterations > 1`), so iterate `solution[0]` rather than printing `solution` directly.
### 10. Model Building
Build models from scratch: ```python from cobra import Model, Reaction, Metabolite
# Create model model = Model("my_model")
# Create metabolites atp_c = Metabolite("atp_c", formula="C10H12N5O13P3", name="ATP", compartment="c") adp_c = Metabolite("adp_c", formula="C10H12N5O10P2", name="ADP", compartment="c") pi_c = Metabolite("pi_c", formula="HO4P", name="Phosphate", compartment="c")
# Create reaction reaction = Reaction("ATPASE") reaction.name = "ATP hydrolysis" reaction.subsystem = "Energy" reaction.lower_bound = 0.0 reaction.upper_bound = 1000.0
# Add metabolites with stoichiometry reaction.add_metabolites({ atp_c: -1.0, adp_c: 1.0, pi_c: 1.0 })
# Add gene-reaction rule reaction.gene_reaction_rule = "(gene1 and gene2) or gene3"
# Add to model model.add_reactions([reaction])
# Add boundary reactions model.add_boundary(atp_c, type="exchange") model.add_boundary(adp_c, type="demand")
# Set objective model.objective = "ATPASE" ```
## Common Workflows
### Workflow 1: Load Model and Predict Growth
```python from cobra.io import load_model
# Load model model = load_model("iJO1366")
# Run FBA solution = model.optimize() print(f"Growth rate: {solution.objective_value:.3f} /h")
# Show active pathways print(solution.fluxes[solution.fluxes.abs() > 1e-6]) ```
### Workflow 2: Gene Knockout Screen
```python from cobra.io import load_model from cobra.flux_analysis import single_gene_deletion
# Load model model = load_model("iJO1366")
# Perform single gene deletions results = single_gene_deletion(model)
# Find essential genes (growth < threshold) essential_genes = results[results["growth"] < 0.01] print(f"Found {len(essential_genes)} essential genes")
# Find genes with minimal impact neutral_genes = results[results["growth"] > 0.9 * solution.objective_value] ```
### Workflow 3: Media Optimization
```python from cobra.io import load_model from cobra.medium import minimal_medium
# Load model model = load_model("iJO1366")
# Calculate minimal medium for 50% of max growth target_growth = model.slim_optimize() * 0.5 min_medium = minimal_medium( model, target_growth, minimize_components=True )
print(f"Minimal medium components: {len(min_medium)}") print(min_medium) ```
### Workflow 4: Flux Uncertainty Analysis
```python from cobra.io import load_model from cobra.flux_analysis import flux_variability_analysis from cobra.sampling import sample
# Load model model = load_model("iJO1366")
# First check flux ranges at optimality fva = flux_variability_analysis(model, fraction_of_optimum=1.0)
# For reactions with large ranges, sample to understand distribution samples = sample(model, n=1000)
# Analyze specific reaction reaction_id = "PFK" import matplotlib.pyplot as plt samples[reaction_id].hist(bins=50) plt.xlabel(f"Flux through {reaction_id}") plt.ylabel("Frequency") plt.show() ```
### Workflow 5: Context Manager for Temporary Changes
Use context managers to make temporary modifications: ```python # Model remains unchanged outside context with model: # Temporarily change objective model.objective = "ATPM"
# Temporarily modify bounds model.reactions.EX_glc__D_e.lower_bound = -5.0
# Temporarily knock out genes model.genes.b0008.knock_out()
# Optimize with changes solution = model.optimize() print(f"Modified growth: {solution.objective_value}")
# All changes automatically reverted solution = model.optimize() print(f"Original growth: {solution.objective_value}") ```
## Key Concepts
### DictList Objects Models use `DictList` objects for reactions, metabolites, and genes - behaving like both lists and dictionaries: ```python # Access by index first_reaction = model.reactions[0]
# Access by ID pfk
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for alterlab-cobrapy, ready for a manual X post.
A practical pick for design or creative work: alterlab-cobrapy: Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variabili... 63 stars https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x
Listing + install path for alterlab-cobrapy: https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x Install: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to AlterLab-IEU but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy/audit)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)AlterLab-IEU
@alterlab-ieu
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Frontend Design
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
174.6K StarsTaste Skill: Anti-Slop Frontend
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
84.6K StarsVox Director
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
1.8K StarsCanvas Design
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
174.6K StarsSandbox only
Install targets
Codex install prompt
Install the "alterlab-cobrapy" agent skill from https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-cobrapy. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"alterlab-ieu-alterlab-cobrapy","task":"Install alterlab-cobrapy","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Design assets, images, video, audio, multimodal media, presentation, and creative production skills.
Scenario
Design and creative
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Maintenance
fresh
1d since push
Risk
Needs review
Dependency or permission surface needs review
GitHub quality
63
65/100 Quality · 69/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
63 GitHub stars
Repo activity
63 stars, 13 forks
Maintenance
1d since push
License
GPL-2.0
Install
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyDo not use when
Alternative
174.6K Stars
npx skills add anthropics/skills --skill frontend-design
Alternative
84.6K Stars
npx skills add Leonxlnx/taste-skill --skill design-taste-frontend
Alternative
1.8K Stars
npx skills add Alisa0808/vox-director --skill vox-director
Alternative
174.6K Stars
npx skills add anthropics/skills --skill canvas-design
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
Agent should check
Copy prompt
Task: Use alterlab-cobrapy in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install
Install command: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
LLM text format
/api/skills/alterlab-ieu-alterlab-cobrapy/install?format=text
Find alternatives
/api/skills/search?q=alterlab-cobrapy&limit=3
Agent prompt
Use alterlab-cobrapy for this task. Review https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install, then install with: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy
LLM text
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy?format=text
Install alias
/api/registry/install/alterlab-ieu-alterlab-cobrapy
Recommend
/api/registry/recommend?task=Use%20alterlab-cobrapy%20in%20an%20agent%20workflow&limit=3
Agent fit
Research agents
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Research agents
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
CHECK63 GitHub stars
Stars/forks activity
CHECK63 stars, 13 forks; issue activity unavailable in current metadata
Recent maintenance
PASS1d since push
License clarity
PASSGPL-2.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Operate web apps
I need my agent to control a browser, fill forms, and verify web app workflows.
Create assets
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Workflow fit
Design, build, test, and ship interfaces
A practical workflow for agents that turn product briefs or Figma designs into polished frontend code, review the result, test it in a browser, and prepare a safe deployment.
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Operate and verify web apps
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Alternative shortlist
Similar skills that may fit this task.
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
--- 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 allowed-tools: Read Write Edit Bash(python:*) Bash(uv:*) compatibility: "Self-contained — runs under `uv run python` with the skill's Python package installed; no API key or account required." metadata: skill-author: AlterLab version: "1.0.0" ---
# 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.
## Installation and Requirements
```bash uv pip install 'cobra>=0.29,<0.32' ```
**Requirements:** Python 3.8+; depends on optlang and a solver (GLPK ships by default via swiglpk; CPLEX/Gurobi optional). Optional for plots: matplotlib, seaborn, pandas (pandas is already a hard dependency). Flux sampling and parallel deletions use multiprocessing.
> **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) ```
### 4. Flux Variability Analysis (FVA)
Determine flux ranges for all reactions: ```python from cobra.flux_analysis import flux_variability_analysis
# Standard FVA fva_result = flux_variability_analysis(model)
# FVA at 90% optimality fva_result = flux_variability_analysis(model, fraction_of_optimum=0.9)
# Loopless FVA (eliminates thermodynamically infeasible loops) fva_result = flux_variability_analysis(model, loopless=True)
# FVA for specific reactions fva_result = flux_variability_analysis( model, reaction_list=["PFK", "FBA", "PGI"] ) ```
### 5. Gene and Reaction Deletion Studies
Perform knockout analyses: ```python from cobra.flux_analysis import ( single_gene_deletion, single_reaction_deletion, double_gene_deletion, double_reaction_deletion )
# Single deletions gene_results = single_gene_deletion(model) reaction_results = single_reaction_deletion(model)
# Double deletions (uses multiprocessing) double_gene_results = double_gene_deletion( model, processes=4 # Number of CPU cores )
# Manual knockout using context manager with model: model.genes.get_by_id("b0008").knock_out() solution = model.optimize() print(f"Growth after knockout: {solution.objective_value}") # Model automatically reverts after context exit ```
### 6. Growth Media and Minimal Media
Manage growth medium: ```python # View current medium print(model.medium)
# Modify medium (must reassign entire dict) medium = model.medium medium["EX_glc__D_e"] = 10.0 # Set glucose uptake medium["EX_o2_e"] = 0.0 # Anaerobic conditions model.medium = medium
# Calculate minimal media from cobra.medium import minimal_medium
# Minimize total import flux min_medium = minimal_medium(model, minimize_components=False)
# Minimize number of components (uses MILP, slower) min_medium = minimal_medium( model, minimize_components=True, open_exchanges=True ) ```
### 7. Flux Sampling
Sample the feasible flux space: ```python from cobra.sampling import sample
# Sample using OptGP (default, supports parallel processing) samples = sample(model, n=1000, method="optgp", processes=4)
# Sample using ACHR samples = sample(model, n=1000, method="achr")
# Validate samples from cobra.sampling import OptGPSampler sampler = OptGPSampler(model, processes=4) sampler.sample(1000) validation = sampler.validate(sampler.samples) print(validation.value_counts()) # Should be all 'v' for valid ```
### 8. Production Envelopes
Calculate phenotype phase planes: ```python from cobra.flux_analysis import production_envelope
# Standard production envelope envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], objective="EX_ac_e" # Acetate production )
# With carbon yield envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], carbon_sources="EX_glc__D_e" )
# Visualize (use matplotlib or pandas plotting) import matplotlib.pyplot as plt envelope.plot(x="EX_glc__D_e", y="EX_o2_e", kind="scatter") plt.show() ```
### 9. Gapfilling
Add reactions to make models feasible: ```python import cobra from cobra.flux_analysis import gapfill
# Build a universal model of candidate reactions to draw from. # In practice, load a curated reaction database (e.g. the BiGG # universal reactions JSON via load_json_model) or assemble reactions # into an empty cobra.Model — there is no load_model("universal"). universal = cobra.Model("universal_reactions") # ...populate `universal` with candidate cobra.Reaction objects...
with model: # Create a gap for demonstration model.remove_reactions([model.reactions.PGI])
# Find the minimal set of reactions from `universal` to restore feasibility solution = gapfill(model, universal, demand_reactions=False) for reaction in solution[0]: print(reaction.id) ```
> **Note**: `gapfill` returns a list of reaction lists (one per iteration when `iterations > 1`), so iterate `solution[0]` rather than printing `solution` directly.
### 10. Model Building
Build models from scratch: ```python from cobra import Model, Reaction, Metabolite
# Create model model = Model("my_model")
# Create metabolites atp_c = Metabolite("atp_c", formula="C10H12N5O13P3", name="ATP", compartment="c") adp_c = Metabolite("adp_c", formula="C10H12N5O10P2", name="ADP", compartment="c") pi_c = Metabolite("pi_c", formula="HO4P", name="Phosphate", compartment="c")
# Create reaction reaction = Reaction("ATPASE") reaction.name = "ATP hydrolysis" reaction.subsystem = "Energy" reaction.lower_bound = 0.0 reaction.upper_bound = 1000.0
# Add metabolites with stoichiometry reaction.add_metabolites({ atp_c: -1.0, adp_c: 1.0, pi_c: 1.0 })
# Add gene-reaction rule reaction.gene_reaction_rule = "(gene1 and gene2) or gene3"
# Add to model model.add_reactions([reaction])
# Add boundary reactions model.add_boundary(atp_c, type="exchange") model.add_boundary(adp_c, type="demand")
# Set objective model.objective = "ATPASE" ```
## Common Workflows
### Workflow 1: Load Model and Predict Growth
```python from cobra.io import load_model
# Load model model = load_model("iJO1366")
# Run FBA solution = model.optimize() print(f"Growth rate: {solution.objective_value:.3f} /h")
# Show active pathways print(solution.fluxes[solution.fluxes.abs() > 1e-6]) ```
### Workflow 2: Gene Knockout Screen
```python from cobra.io import load_model from cobra.flux_analysis import single_gene_deletion
# Load model model = load_model("iJO1366")
# Perform single gene deletions results = single_gene_deletion(model)
# Find essential genes (growth < threshold) essential_genes = results[results["growth"] < 0.01] print(f"Found {len(essential_genes)} essential genes")
# Find genes with minimal impact neutral_genes = results[results["growth"] > 0.9 * solution.objective_value] ```
### Workflow 3: Media Optimization
```python from cobra.io import load_model from cobra.medium import minimal_medium
# Load model model = load_model("iJO1366")
# Calculate minimal medium for 50% of max growth target_growth = model.slim_optimize() * 0.5 min_medium = minimal_medium( model, target_growth, minimize_components=True )
print(f"Minimal medium components: {len(min_medium)}") print(min_medium) ```
### Workflow 4: Flux Uncertainty Analysis
```python from cobra.io import load_model from cobra.flux_analysis import flux_variability_analysis from cobra.sampling import sample
# Load model model = load_model("iJO1366")
# First check flux ranges at optimality fva = flux_variability_analysis(model, fraction_of_optimum=1.0)
# For reactions with large ranges, sample to understand distribution samples = sample(model, n=1000)
# Analyze specific reaction reaction_id = "PFK" import matplotlib.pyplot as plt samples[reaction_id].hist(bins=50) plt.xlabel(f"Flux through {reaction_id}") plt.ylabel("Frequency") plt.show() ```
### Workflow 5: Context Manager for Temporary Changes
Use context managers to make temporary modifications: ```python # Model remains unchanged outside context with model: # Temporarily change objective model.objective = "ATPM"
# Temporarily modify bounds model.reactions.EX_glc__D_e.lower_bound = -5.0
# Temporarily knock out genes model.genes.b0008.knock_out()
# Optimize with changes solution = model.optimize() print(f"Modified growth: {solution.objective_value}")
# All changes automatically reverted solution = model.optimize() print(f"Original growth: {solution.objective_value}") ```
## Key Concepts
### DictList Objects Models use `DictList` objects for reactions, metabolites, and genes - behaving like both lists and dictionaries: ```python # Access by index first_reaction = model.reactions[0]
# Access by ID pfk
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for alterlab-cobrapy, ready for a manual X post.
A practical pick for design or creative work: alterlab-cobrapy: Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variabili... 63 stars https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x
Listing + install path for alterlab-cobrapy: https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x Install: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to AlterLab-IEU but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy/audit)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)AlterLab-IEU
@alterlab-ieu
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Frontend Design
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
174.6K StarsTaste Skill: Anti-Slop Frontend
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
84.6K StarsVox Director
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
1.8K StarsCanvas Design
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
174.6K StarsSandbox only
Install targets
Codex install prompt
Install the "alterlab-cobrapy" agent skill from https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-cobrapy. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"alterlab-ieu-alterlab-cobrapy","task":"Install alterlab-cobrapy","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Design assets, images, video, audio, multimodal media, presentation, and creative production skills.
Scenario
Design and creative
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Maintenance
fresh
1d since push
Risk
Needs review
Dependency or permission surface needs review
GitHub quality
63
65/100 Quality · 69/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
63 GitHub stars
Repo activity
63 stars, 13 forks
Maintenance
1d since push
License
GPL-2.0
Install
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyDo not use when
Alternative
174.6K Stars
npx skills add anthropics/skills --skill frontend-design
Alternative
84.6K Stars
npx skills add Leonxlnx/taste-skill --skill design-taste-frontend
Alternative
1.8K Stars
npx skills add Alisa0808/vox-director --skill vox-director
Alternative
174.6K Stars
npx skills add anthropics/skills --skill canvas-design
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
Agent should check
Copy prompt
Task: Use alterlab-cobrapy in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install
Install command: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
LLM text format
/api/skills/alterlab-ieu-alterlab-cobrapy/install?format=text
Find alternatives
/api/skills/search?q=alterlab-cobrapy&limit=3
Agent prompt
Use alterlab-cobrapy for this task. Review https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install, then install with: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy
LLM text
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy?format=text
Install alias
/api/registry/install/alterlab-ieu-alterlab-cobrapy
Recommend
/api/registry/recommend?task=Use%20alterlab-cobrapy%20in%20an%20agent%20workflow&limit=3
Agent fit
Research agents
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Research agents
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
CHECK63 GitHub stars
Stars/forks activity
CHECK63 stars, 13 forks; issue activity unavailable in current metadata
Recent maintenance
PASS1d since push
License clarity
PASSGPL-2.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Operate web apps
I need my agent to control a browser, fill forms, and verify web app workflows.
Create assets
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Workflow fit
Design, build, test, and ship interfaces
A practical workflow for agents that turn product briefs or Figma designs into polished frontend code, review the result, test it in a browser, and prepare a safe deployment.
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Operate and verify web apps
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Alternative shortlist
Similar skills that may fit this task.
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
--- 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 allowed-tools: Read Write Edit Bash(python:*) Bash(uv:*) compatibility: "Self-contained — runs under `uv run python` with the skill's Python package installed; no API key or account required." metadata: skill-author: AlterLab version: "1.0.0" ---
# 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.
## Installation and Requirements
```bash uv pip install 'cobra>=0.29,<0.32' ```
**Requirements:** Python 3.8+; depends on optlang and a solver (GLPK ships by default via swiglpk; CPLEX/Gurobi optional). Optional for plots: matplotlib, seaborn, pandas (pandas is already a hard dependency). Flux sampling and parallel deletions use multiprocessing.
> **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) ```
### 4. Flux Variability Analysis (FVA)
Determine flux ranges for all reactions: ```python from cobra.flux_analysis import flux_variability_analysis
# Standard FVA fva_result = flux_variability_analysis(model)
# FVA at 90% optimality fva_result = flux_variability_analysis(model, fraction_of_optimum=0.9)
# Loopless FVA (eliminates thermodynamically infeasible loops) fva_result = flux_variability_analysis(model, loopless=True)
# FVA for specific reactions fva_result = flux_variability_analysis( model, reaction_list=["PFK", "FBA", "PGI"] ) ```
### 5. Gene and Reaction Deletion Studies
Perform knockout analyses: ```python from cobra.flux_analysis import ( single_gene_deletion, single_reaction_deletion, double_gene_deletion, double_reaction_deletion )
# Single deletions gene_results = single_gene_deletion(model) reaction_results = single_reaction_deletion(model)
# Double deletions (uses multiprocessing) double_gene_results = double_gene_deletion( model, processes=4 # Number of CPU cores )
# Manual knockout using context manager with model: model.genes.get_by_id("b0008").knock_out() solution = model.optimize() print(f"Growth after knockout: {solution.objective_value}") # Model automatically reverts after context exit ```
### 6. Growth Media and Minimal Media
Manage growth medium: ```python # View current medium print(model.medium)
# Modify medium (must reassign entire dict) medium = model.medium medium["EX_glc__D_e"] = 10.0 # Set glucose uptake medium["EX_o2_e"] = 0.0 # Anaerobic conditions model.medium = medium
# Calculate minimal media from cobra.medium import minimal_medium
# Minimize total import flux min_medium = minimal_medium(model, minimize_components=False)
# Minimize number of components (uses MILP, slower) min_medium = minimal_medium( model, minimize_components=True, open_exchanges=True ) ```
### 7. Flux Sampling
Sample the feasible flux space: ```python from cobra.sampling import sample
# Sample using OptGP (default, supports parallel processing) samples = sample(model, n=1000, method="optgp", processes=4)
# Sample using ACHR samples = sample(model, n=1000, method="achr")
# Validate samples from cobra.sampling import OptGPSampler sampler = OptGPSampler(model, processes=4) sampler.sample(1000) validation = sampler.validate(sampler.samples) print(validation.value_counts()) # Should be all 'v' for valid ```
### 8. Production Envelopes
Calculate phenotype phase planes: ```python from cobra.flux_analysis import production_envelope
# Standard production envelope envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], objective="EX_ac_e" # Acetate production )
# With carbon yield envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], carbon_sources="EX_glc__D_e" )
# Visualize (use matplotlib or pandas plotting) import matplotlib.pyplot as plt envelope.plot(x="EX_glc__D_e", y="EX_o2_e", kind="scatter") plt.show() ```
### 9. Gapfilling
Add reactions to make models feasible: ```python import cobra from cobra.flux_analysis import gapfill
# Build a universal model of candidate reactions to draw from. # In practice, load a curated reaction database (e.g. the BiGG # universal reactions JSON via load_json_model) or assemble reactions # into an empty cobra.Model — there is no load_model("universal"). universal = cobra.Model("universal_reactions") # ...populate `universal` with candidate cobra.Reaction objects...
with model: # Create a gap for demonstration model.remove_reactions([model.reactions.PGI])
# Find the minimal set of reactions from `universal` to restore feasibility solution = gapfill(model, universal, demand_reactions=False) for reaction in solution[0]: print(reaction.id) ```
> **Note**: `gapfill` returns a list of reaction lists (one per iteration when `iterations > 1`), so iterate `solution[0]` rather than printing `solution` directly.
### 10. Model Building
Build models from scratch: ```python from cobra import Model, Reaction, Metabolite
# Create model model = Model("my_model")
# Create metabolites atp_c = Metabolite("atp_c", formula="C10H12N5O13P3", name="ATP", compartment="c") adp_c = Metabolite("adp_c", formula="C10H12N5O10P2", name="ADP", compartment="c") pi_c = Metabolite("pi_c", formula="HO4P", name="Phosphate", compartment="c")
# Create reaction reaction = Reaction("ATPASE") reaction.name = "ATP hydrolysis" reaction.subsystem = "Energy" reaction.lower_bound = 0.0 reaction.upper_bound = 1000.0
# Add metabolites with stoichiometry reaction.add_metabolites({ atp_c: -1.0, adp_c: 1.0, pi_c: 1.0 })
# Add gene-reaction rule reaction.gene_reaction_rule = "(gene1 and gene2) or gene3"
# Add to model model.add_reactions([reaction])
# Add boundary reactions model.add_boundary(atp_c, type="exchange") model.add_boundary(adp_c, type="demand")
# Set objective model.objective = "ATPASE" ```
## Common Workflows
### Workflow 1: Load Model and Predict Growth
```python from cobra.io import load_model
# Load model model = load_model("iJO1366")
# Run FBA solution = model.optimize() print(f"Growth rate: {solution.objective_value:.3f} /h")
# Show active pathways print(solution.fluxes[solution.fluxes.abs() > 1e-6]) ```
### Workflow 2: Gene Knockout Screen
```python from cobra.io import load_model from cobra.flux_analysis import single_gene_deletion
# Load model model = load_model("iJO1366")
# Perform single gene deletions results = single_gene_deletion(model)
# Find essential genes (growth < threshold) essential_genes = results[results["growth"] < 0.01] print(f"Found {len(essential_genes)} essential genes")
# Find genes with minimal impact neutral_genes = results[results["growth"] > 0.9 * solution.objective_value] ```
### Workflow 3: Media Optimization
```python from cobra.io import load_model from cobra.medium import minimal_medium
# Load model model = load_model("iJO1366")
# Calculate minimal medium for 50% of max growth target_growth = model.slim_optimize() * 0.5 min_medium = minimal_medium( model, target_growth, minimize_components=True )
print(f"Minimal medium components: {len(min_medium)}") print(min_medium) ```
### Workflow 4: Flux Uncertainty Analysis
```python from cobra.io import load_model from cobra.flux_analysis import flux_variability_analysis from cobra.sampling import sample
# Load model model = load_model("iJO1366")
# First check flux ranges at optimality fva = flux_variability_analysis(model, fraction_of_optimum=1.0)
# For reactions with large ranges, sample to understand distribution samples = sample(model, n=1000)
# Analyze specific reaction reaction_id = "PFK" import matplotlib.pyplot as plt samples[reaction_id].hist(bins=50) plt.xlabel(f"Flux through {reaction_id}") plt.ylabel("Frequency") plt.show() ```
### Workflow 5: Context Manager for Temporary Changes
Use context managers to make temporary modifications: ```python # Model remains unchanged outside context with model: # Temporarily change objective model.objective = "ATPM"
# Temporarily modify bounds model.reactions.EX_glc__D_e.lower_bound = -5.0
# Temporarily knock out genes model.genes.b0008.knock_out()
# Optimize with changes solution = model.optimize() print(f"Modified growth: {solution.objective_value}")
# All changes automatically reverted solution = model.optimize() print(f"Original growth: {solution.objective_value}") ```
## Key Concepts
### DictList Objects Models use `DictList` objects for reactions, metabolites, and genes - behaving like both lists and dictionaries: ```python # Access by index first_reaction = model.reactions[0]
# Access by ID pfk
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for alterlab-cobrapy, ready for a manual X post.
A practical pick for design or creative work: alterlab-cobrapy: Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variabili... 63 stars https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x
Listing + install path for alterlab-cobrapy: https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x Install: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to AlterLab-IEU but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy/audit)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)AlterLab-IEU
@alterlab-ieu
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Frontend Design
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
174.6K StarsTaste Skill: Anti-Slop Frontend
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
84.6K StarsVox Director
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
1.8K StarsCanvas Design
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
174.6K StarsSandbox only
Install targets
Codex install prompt
Install the "alterlab-cobrapy" agent skill from https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-cobrapy. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"alterlab-ieu-alterlab-cobrapy","task":"Install alterlab-cobrapy","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Design assets, images, video, audio, multimodal media, presentation, and creative production skills.
Scenario
Design and creative
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Maintenance
fresh
1d since push
Risk
Needs review
Dependency or permission surface needs review
GitHub quality
63
65/100 Quality · 69/100 Trust
Coverage tags
Review notes
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
63 GitHub stars
Repo activity
63 stars, 13 forks
Maintenance
1d since push
License
GPL-2.0
Install
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyDo not use when
Alternative
174.6K Stars
npx skills add anthropics/skills --skill frontend-design
Alternative
84.6K Stars
npx skills add Leonxlnx/taste-skill --skill design-taste-frontend
Alternative
1.8K Stars
npx skills add Alisa0808/vox-director --skill vox-director
Alternative
174.6K Stars
npx skills add anthropics/skills --skill canvas-design
Agent safety v2
This skill should not be selected by an agent without explicit human security review.
Do not auto-install. Inspect the source, dependencies, and permission surface first.
high
Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
high
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
Agent should check
Copy prompt
Task: Use alterlab-cobrapy in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20alterlab-cobrapy%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install
Install command: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/alterlab-ieu-alterlab-cobrapy/install
LLM text format
/api/skills/alterlab-ieu-alterlab-cobrapy/install?format=text
Find alternatives
/api/skills/search?q=alterlab-cobrapy&limit=3
Agent prompt
Use alterlab-cobrapy for this task. Review https://www.openagentskill.com/api/skills/alterlab-ieu-alterlab-cobrapy/install, then install with: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapyRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy
LLM text
/api/registry/manifest/alterlab-ieu-alterlab-cobrapy?format=text
Install alias
/api/registry/install/alterlab-ieu-alterlab-cobrapy
Recommend
/api/registry/recommend?task=Use%20alterlab-cobrapy%20in%20an%20agent%20workflow&limit=3
Agent fit
Research agents
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Research agents
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
CHECK63 GitHub stars
Stars/forks activity
CHECK63 stars, 13 forks; issue activity unavailable in current metadata
Recent maintenance
PASS1d since push
License clarity
PASSGPL-2.0
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Investigate faster
I need my agent to research a topic, compare sources, and produce a concise report.
Operate web apps
I need my agent to control a browser, fill forms, and verify web app workflows.
Create assets
I need my agent to produce design assets, UI directions, presentations, or creative media workflows.
Workflow fit
Design, build, test, and ship interfaces
A practical workflow for agents that turn product briefs or Figma designs into polished frontend code, review the result, test it in a browser, and prepare a safe deployment.
Find, compare, and synthesize
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Operate and verify web apps
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Alternative shortlist
Similar skills that may fit this task.
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
--- 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 allowed-tools: Read Write Edit Bash(python:*) Bash(uv:*) compatibility: "Self-contained — runs under `uv run python` with the skill's Python package installed; no API key or account required." metadata: skill-author: AlterLab version: "1.0.0" ---
# 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.
## Installation and Requirements
```bash uv pip install 'cobra>=0.29,<0.32' ```
**Requirements:** Python 3.8+; depends on optlang and a solver (GLPK ships by default via swiglpk; CPLEX/Gurobi optional). Optional for plots: matplotlib, seaborn, pandas (pandas is already a hard dependency). Flux sampling and parallel deletions use multiprocessing.
> **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) ```
### 4. Flux Variability Analysis (FVA)
Determine flux ranges for all reactions: ```python from cobra.flux_analysis import flux_variability_analysis
# Standard FVA fva_result = flux_variability_analysis(model)
# FVA at 90% optimality fva_result = flux_variability_analysis(model, fraction_of_optimum=0.9)
# Loopless FVA (eliminates thermodynamically infeasible loops) fva_result = flux_variability_analysis(model, loopless=True)
# FVA for specific reactions fva_result = flux_variability_analysis( model, reaction_list=["PFK", "FBA", "PGI"] ) ```
### 5. Gene and Reaction Deletion Studies
Perform knockout analyses: ```python from cobra.flux_analysis import ( single_gene_deletion, single_reaction_deletion, double_gene_deletion, double_reaction_deletion )
# Single deletions gene_results = single_gene_deletion(model) reaction_results = single_reaction_deletion(model)
# Double deletions (uses multiprocessing) double_gene_results = double_gene_deletion( model, processes=4 # Number of CPU cores )
# Manual knockout using context manager with model: model.genes.get_by_id("b0008").knock_out() solution = model.optimize() print(f"Growth after knockout: {solution.objective_value}") # Model automatically reverts after context exit ```
### 6. Growth Media and Minimal Media
Manage growth medium: ```python # View current medium print(model.medium)
# Modify medium (must reassign entire dict) medium = model.medium medium["EX_glc__D_e"] = 10.0 # Set glucose uptake medium["EX_o2_e"] = 0.0 # Anaerobic conditions model.medium = medium
# Calculate minimal media from cobra.medium import minimal_medium
# Minimize total import flux min_medium = minimal_medium(model, minimize_components=False)
# Minimize number of components (uses MILP, slower) min_medium = minimal_medium( model, minimize_components=True, open_exchanges=True ) ```
### 7. Flux Sampling
Sample the feasible flux space: ```python from cobra.sampling import sample
# Sample using OptGP (default, supports parallel processing) samples = sample(model, n=1000, method="optgp", processes=4)
# Sample using ACHR samples = sample(model, n=1000, method="achr")
# Validate samples from cobra.sampling import OptGPSampler sampler = OptGPSampler(model, processes=4) sampler.sample(1000) validation = sampler.validate(sampler.samples) print(validation.value_counts()) # Should be all 'v' for valid ```
### 8. Production Envelopes
Calculate phenotype phase planes: ```python from cobra.flux_analysis import production_envelope
# Standard production envelope envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], objective="EX_ac_e" # Acetate production )
# With carbon yield envelope = production_envelope( model, reactions=["EX_glc__D_e", "EX_o2_e"], carbon_sources="EX_glc__D_e" )
# Visualize (use matplotlib or pandas plotting) import matplotlib.pyplot as plt envelope.plot(x="EX_glc__D_e", y="EX_o2_e", kind="scatter") plt.show() ```
### 9. Gapfilling
Add reactions to make models feasible: ```python import cobra from cobra.flux_analysis import gapfill
# Build a universal model of candidate reactions to draw from. # In practice, load a curated reaction database (e.g. the BiGG # universal reactions JSON via load_json_model) or assemble reactions # into an empty cobra.Model — there is no load_model("universal"). universal = cobra.Model("universal_reactions") # ...populate `universal` with candidate cobra.Reaction objects...
with model: # Create a gap for demonstration model.remove_reactions([model.reactions.PGI])
# Find the minimal set of reactions from `universal` to restore feasibility solution = gapfill(model, universal, demand_reactions=False) for reaction in solution[0]: print(reaction.id) ```
> **Note**: `gapfill` returns a list of reaction lists (one per iteration when `iterations > 1`), so iterate `solution[0]` rather than printing `solution` directly.
### 10. Model Building
Build models from scratch: ```python from cobra import Model, Reaction, Metabolite
# Create model model = Model("my_model")
# Create metabolites atp_c = Metabolite("atp_c", formula="C10H12N5O13P3", name="ATP", compartment="c") adp_c = Metabolite("adp_c", formula="C10H12N5O10P2", name="ADP", compartment="c") pi_c = Metabolite("pi_c", formula="HO4P", name="Phosphate", compartment="c")
# Create reaction reaction = Reaction("ATPASE") reaction.name = "ATP hydrolysis" reaction.subsystem = "Energy" reaction.lower_bound = 0.0 reaction.upper_bound = 1000.0
# Add metabolites with stoichiometry reaction.add_metabolites({ atp_c: -1.0, adp_c: 1.0, pi_c: 1.0 })
# Add gene-reaction rule reaction.gene_reaction_rule = "(gene1 and gene2) or gene3"
# Add to model model.add_reactions([reaction])
# Add boundary reactions model.add_boundary(atp_c, type="exchange") model.add_boundary(adp_c, type="demand")
# Set objective model.objective = "ATPASE" ```
## Common Workflows
### Workflow 1: Load Model and Predict Growth
```python from cobra.io import load_model
# Load model model = load_model("iJO1366")
# Run FBA solution = model.optimize() print(f"Growth rate: {solution.objective_value:.3f} /h")
# Show active pathways print(solution.fluxes[solution.fluxes.abs() > 1e-6]) ```
### Workflow 2: Gene Knockout Screen
```python from cobra.io import load_model from cobra.flux_analysis import single_gene_deletion
# Load model model = load_model("iJO1366")
# Perform single gene deletions results = single_gene_deletion(model)
# Find essential genes (growth < threshold) essential_genes = results[results["growth"] < 0.01] print(f"Found {len(essential_genes)} essential genes")
# Find genes with minimal impact neutral_genes = results[results["growth"] > 0.9 * solution.objective_value] ```
### Workflow 3: Media Optimization
```python from cobra.io import load_model from cobra.medium import minimal_medium
# Load model model = load_model("iJO1366")
# Calculate minimal medium for 50% of max growth target_growth = model.slim_optimize() * 0.5 min_medium = minimal_medium( model, target_growth, minimize_components=True )
print(f"Minimal medium components: {len(min_medium)}") print(min_medium) ```
### Workflow 4: Flux Uncertainty Analysis
```python from cobra.io import load_model from cobra.flux_analysis import flux_variability_analysis from cobra.sampling import sample
# Load model model = load_model("iJO1366")
# First check flux ranges at optimality fva = flux_variability_analysis(model, fraction_of_optimum=1.0)
# For reactions with large ranges, sample to understand distribution samples = sample(model, n=1000)
# Analyze specific reaction reaction_id = "PFK" import matplotlib.pyplot as plt samples[reaction_id].hist(bins=50) plt.xlabel(f"Flux through {reaction_id}") plt.ylabel("Frequency") plt.show() ```
### Workflow 5: Context Manager for Temporary Changes
Use context managers to make temporary modifications: ```python # Model remains unchanged outside context with model: # Temporarily change objective model.objective = "ATPM"
# Temporarily modify bounds model.reactions.EX_glc__D_e.lower_bound = -5.0
# Temporarily knock out genes model.genes.b0008.knock_out()
# Optimize with changes solution = model.optimize() print(f"Modified growth: {solution.objective_value}")
# All changes automatically reverted solution = model.optimize() print(f"Original growth: {solution.objective_value}") ```
## Key Concepts
### DictList Objects Models use `DictList` objects for reactions, metabolites, and genes - behaving like both lists and dictionaries: ```python # Access by index first_reaction = model.reactions[0]
# Access by ID pfk
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for alterlab-cobrapy, ready for a manual X post.
A practical pick for design or creative work: alterlab-cobrapy: Build and analyze genome-scale constraint-based metabolic models with COBRApy — flux balance analysis (FBA), flux variabili... 63 stars https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x
Listing + install path for alterlab-cobrapy: https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=x Install: npx skills add AlterLab-IEU/AlterLab-Academic-Skills --skill alterlab-cobrapy
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to AlterLab-IEU but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy/audit)
[](https://www.openagentskill.com/skills/alterlab-ieu-alterlab-cobrapy?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)AlterLab-IEU
@alterlab-ieu
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Frontend Design
Guidance for distinctive, intentional UI design, typography, visual direction, and non-template-like product interfaces.
174.6K StarsTaste Skill: Anti-Slop Frontend
Design and implementation guidance for distinctive landing pages, portfolios, product demos, and purposeful redesigns.
84.6K StarsVox Director
Turn one topic into a narrated Vox-style paper-collage explainer or ad video, from script through captions.
1.8K StarsCanvas Design
Create original visual art, posters, PNG assets, and PDF documents through a clear design philosophy.
174.6K StarsPermission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness
Permission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness
Permission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness
Permission surface
secrets or environment access, shell or command execution
Agent outcomes
No agent outcome data yet
Docs
Strong README/SKILL.md context
Risk summary
Install readiness