跳到正文
Skillpedia
分析与电子表格15k · #11055

gsmm-builder

它能做什么

该技能构建或加载某种生物代谢的模型。适合需要模型来进行通量分析的研究人员。

适用场景

  • ✓当你想加载一个已知的代谢模型,例如来自 BiGG 数据库的模型的时候。
  • ✓当你需要从零开始构建一个小型代谢模型的时候。
  • ✓当你想设置生长培养基并保存模型文件以供之后分析的时候。

技能链接

https://github.com/aiming-lab/AutoResearchClaw/blob/main/external/agents/Biology-Agent/skills/gsmm-builder/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/aiming-lab/AutoResearchClaw/blob/main/external/agents/Biology-Agent/skills/gsmm-builder/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“从 BiGG 加载 iJO1366 大肠杆菌模型,设置葡萄糖基础培养基,并保存为 JSON。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会加载一个经过整理的模型文件,或根据代谢物和反应构建一个模型。然后它会设置培养基限制和目标函数,并将模型写入 JSON 文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Overview

The gsmm-builder skill constructs or loads genome-scale metabolic models (GSMMs) in the COBRApy framework. It is the entry point for every metabolic flux analysis pipeline. Output is a validated COBRApy Model object serialized to a JSON file ready for downstream FBA and flux analysis.

GSMMs encode every known metabolic reaction in an organism as a stoichiometric matrix. Constraints (reaction bounds, medium composition, objective function) turn the model into a solvable linear program.


Workflow

Step 1 — Decide: Load Existing or Build from Scratch

Option A: Load a curated BIGG model

import cobra
import cobra.io

# Load E. coli iJO1366 from a local SBML file
model = cobra.io.read_sbml_model("iJO1366.xml")

# Or load from a pre-downloaded JSON file
model = cobra.io.load_json_model("iJO1366.json")

print(f"Loaded {model.id}: {len(model.reactions)} reactions, "
      f"{len(model.metabolites)} metabolites, {len(model.genes)} genes")

Key BIGG model IDs:

  • iJO1366 — E. coli K-12 MG1655 (2583 reactions)
  • Recon3D — Homo sapiens (13543 reactions)
  • iMM904 — S. cerevisiae (1577 reactions)
  • iNJ661 — M. tuberculosis (1049 reactions)

Option B: Build a minimal model from scratch

from cobra import Model, Metabolite, Reaction

model = Model("toy_glycolysis")

# Define metabolites with compartments and formula
glc_e = Metabolite("glc__D_e", formula="C6H12O6", name="D-Glucose",
                   compartment="e")
glc_c = Metabolite("glc__D_c", formula="C6H12O6", name="D-Glucose",
                   compartment="c")
atp_c = Metabolite("atp_c",  formula="C10H12N5O13P3", name="ATP",
                   compartment="c")
biomass = Metabolite("biomass", formula="", name="Biomass", compartment="c")

# Build reactions
ex_glc = Reaction("EX_glc__D_e")
ex_glc.lower_bound = -10.0  # uptake (negative = import)
ex_glc.upper_bound = 0.0
ex_glc.add_metabolites({glc_e: 1.0})

transport = Reaction("GLCt")
transport.lower_bound = -1000.0
transport.upper_bound = 1000.0
transport.add_metabolites({glc_e: -1.0, glc_c: 1.0})

# Stoichiometry: 1 glucose + ADP -> 2 ATP (simplified glycolysis)
glycolysis = Reaction("GLYCOLYSIS")
glycolysis.lower_bound = 0.0
glycolysis.upper_bound = 1000.0
glycolysis.add_metabolites({glc_c: -1.0, atp_c: 2.0})

biomass_rxn = Reaction("BIOMASS")
biomass_rxn.lower_bound = 0.0
biomass_rxn.upper_bound = 1000.0
biomass_rxn.add_metabolites({atp_c: -10.0, biomass: 1.0})

model.add_reactions([ex_glc, transport, glycolysis, biomass_rxn])

Step 2 — Set the Objective Function

# Set biomass as the optimization target
model.objective = "BIOMASS_Ec_iJO1366_core_53p95M"  # reaction ID string

# Verify objective is set
print(model.objective.to_json())

Step 3 — Define the Growth Medium

# M9 minimal medium with glucose (aerobic)
M9_MEDIUM = {
    "EX_glc__D_e": -10.0,   # glucose uptake, mmol/gDW/h
    "EX_o2_e":    -20.0,    # oxygen (aerobic)
    "EX_nh4_e":  -1000.0,   # ammonium (unlimited)
    "EX_pi_e":   -1000.0,   # phosphate (unlimited)
    "EX_so4_e":  -1000.0,   # sulfate (unlimited)
    "EX_h2o_e":  -1000.0,   # water (unlimited)
    "EX_h_e":    -1000.0,   # protons (unlimited)
}

# Apply medium: close all exchange reactions first, then open selected
medium = model.medium  # returns dict of current open exchange lb magnitudes
for rxn_id, lb in M9_MEDIUM.items():
    if rxn_id in model.reactions:
        model.reactions.get_by_id(rxn_id).lower_bound = lb

# Anaerobic: set O2 uptake to zero
# model.reactions.get_by_id("EX_o2_e").lower_bound = 0.0

Step 4 — Export Model

import cobra.io

cobra.io.save_json_model(model, "output/my_model.json")
cobra.io.write_sbml_model(model, "output/my_model.xml")
print("Model saved.")

Key Conventions

Convention Detail
Metabolite ID format <bigg_id>_<compartment> e.g. glc__D_c, atp_m
Compartment codes c cytosol, e extracellular, m mitochondria, n nucleus
Exchange reaction prefix EX_ e.g. EX_glc__D_e
Transport reaction prefix t or species-specific e.g. GLCt, PGI
Uptake bound sign Negative lower bound = import (e.g. lb = -10)
Secretion bound sign Positive upper bound = export (e.g. ub = 1000)
Biomass objective Reaction with ID containing BIOMASS or Growth
Aerobic medium EX_o2_e lb = -20 (mmol/gDW/h)
Anaerobic medium EX_o2_e lb = 0
Default irrevers
常见问题

什么是 BiGG?

一个经过整理的代谢模型数据库,该技能可以从中加载模型。

我能从零开始吗?

可以。该技能可以根据你自己的代谢物和反应构建一个小型模型。

培养基设置有什么作用?

它限制模型可以吸收哪些营养物质,从而改变生长预测。

详情

作者的原始描述

Build or load a genome-scale metabolic model (GSMM) using COBRApy. Covers loading from BIGG, constructing minimal models from scratch, setting medium constraints, and exporting validated .json model files.

repo: aiming-lab/AutoResearchClaw

热度

GitHub 星标
15k
排名
#11055
许可证
MIT
更新时间
2026/8/19

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能