gsmm-validator
它能做什么
该技能检测代谢模型中会使其结果失去意义的错误。适合希望在运行模拟之前进行质量检查的研究人员。
适用场景
- ✓当你构建或编辑了一个代谢模型,并希望对其进行检查的时候。
- ✓当模拟结果看起来异常,你怀疑模型有问题的时候。
- ✓当你需要一份列出错误和警告的验证报告的时候。
技能链接
https://github.com/aiming-lab/AutoResearchClaw/blob/main/external/agents/Biology-Agent/skills/gsmm-validator/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请验证我的代谢模型,并给我一份报告,列出任何不平衡的反应或死端代谢物。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会加载模型,并检查六个方面,包括质量和电荷平衡、生长可行性、死端代谢物、化学计量一致性、热力学循环以及基因规则格式。然后它会编写一份包含错误和警告的报告。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Overview
The gsmm-validator skill performs rigorous quality control on a COBRApy
Model before it enters any flux analysis pipeline. An invalid model
silently produces biologically meaningless fluxes; validation catches
structural errors early.
Validation covers six categories: (1) mass/charge balance, (2) feasibility and biomass production, (3) dead-end metabolites, (4) stoichiometric consistency, (5) thermodynamic loop detection, and (6) GPR rule integrity.
Workflow
Step 1 — Load the Model
import cobra
import cobra.io
model = cobra.io.load_json_model("my_model.json")
print(f"Loaded: {model.id} ({len(model.reactions)} reactions)")
Step 2 — Mass and Charge Balance Check
Unbalanced reactions are among the most common modelling errors. COBRApy computes elemental balance per reaction.
errors = []
warnings = []
print("=== Mass/Charge Balance ===")
for rxn in model.reactions:
# Returns dict like {"C": -1, "H": 2} if imbalanced; empty dict if OK
imbalance = rxn.check_mass_balance()
if imbalance:
# Exchange and demand reactions are expected to be imbalanced
if rxn.id.startswith(("EX_", "DM_", "SK_", "BIOMASS")):
warnings.append(f"WARN [{rxn.id}] boundary reaction imbalanced "
f"(expected): {imbalance}")
else:
errors.append(f"ERROR [{rxn.id}] mass/charge imbalance: "
f"{imbalance}")
for msg in errors + warnings:
print(msg)
print(f" {len(errors)} error(s), {len(warnings)} warning(s)")
Step 3 — Biomass Producibility (FBA Feasibility)
print("\n=== Biomass Producibility ===")
solution = model.optimize()
if solution.status != "optimal":
errors.append(f"ERROR Model is {solution.status} — "
f"cannot produce biomass under current medium.")
print(f" FAIL: {solution.status}")
elif solution.objective_value < 1e-6:
errors.append("ERROR Growth rate is effectively zero "
"(< 1e-6 h^-1). Check medium and objective reaction.")
print(f" FAIL: growth = {solution.objective_value:.6f} h^-1")
else:
print(f" PASS: growth = {solution.objective_value:.4f} h^-1")
Step 4 — Dead-End Metabolite Detection
A metabolite is a dead-end if it is produced by at least one reaction but consumed by none, or vice versa. Dead-ends create infeasibility in network regions.
from cobra.manipulation import find_blocked_reactions
print("\n=== Dead-End Metabolites ===")
dead_end_mets = []
for met in model.metabolites:
producers = [r for r in met.reactions
if r.get_coefficient(met) > 0]
consumers = [r for r in met.reactions
if r.get_coefficient(met) < 0]
if producers and not consumers:
dead_end_mets.append((met.id, "produced but never consumed"))
elif consumers and not producers:
dead_end_mets.append((met.id, "consumed but never produced"))
if dead_end_mets:
for met_id, reason in dead_end_mets:
warnings.append(f"WARN [{met_id}] dead-end: {reason}")
print(f" {len(dead_end_mets)} dead-end metabolite(s) found")
else:
print(" PASS: no dead-end metabolites")
for msg in warnings[-len(dead_end_mets):]:
print(f" {msg}")
Step 5 — Blocked Reaction Detection
from cobra.flux_analysis import find_blocked_reactions
print("\n=== Blocked Reactions ===")
blocked = find_blocked_reactions(model, open_exchanges=True)
if blocked:
warnings.append(f"WARN {len(blocked)} blocked reaction(s): "
f"{blocked[:5]} ...")
print(f" {len(blocked)} blocked reactions (cannot carry flux)")
else:
print(" PASS: no blocked reactions")
Step 6 — Thermodynamic Loop Detection (Loopless FBA)
Energy-generating cycles violate thermodynamics and inflate apparent fluxes.
print("\n=== Thermodynamic Loops ===")
try:
loopless_solution = cobra.flux_analysis.loopless_solution(model)
standard_solution = model.optimize()
# Compare objective values; large discrepancy suggests loop inflation
delta = abs(loopless_solution.objective_value
- standard_solution.objective_value)
if delta > 0.01:
warnings.append(
f"WARN Loop detected: standard FBA growth "
f"{standard_solution.objective_value:.4f} vs loopless "
f"{loopless_solution.objective_value:.4f} (delta={delta:.4f})"
)
print(f" WARN: po
常见问题
所有反应都必须平衡吗?
不必。交换反应和需求反应本来就是不平衡的,因此报告会将它们标记为警告。
什么是死端代谢物?
被产生却从不被使用,或被使用却从不被产生的化合物,它可能阻塞模型的某些部分。
为什么要在分析之前验证?
一个无效的模型可能在没有任何可见错误的情况下产生毫无意义的通量数值。
详情
作者的原始描述
Validate a COBRApy genome-scale metabolic model for mass/charge balance, stoichiometric consistency, biomass producibility, dead-end metabolites, thermodynamic loops, and GPR rule formatting. Outputs a structured validation report with errors and warnings.
热度
- GitHub 星标
- 15k
- 排名
- #11056
- 许可证
- MIT
- 更新时间
- 2026/8/19
评论
- …
同一仓库的更多技能
a-evolve
15k帮你的智能体通过反复运行来不断改进:诊断失败原因,根据错误模式创建有针对性的技能,并记录经验以备日后使用。
biology-biopython
15k帮你的智能体使用 Biopython 处理 DNA、RNA 和蛋白质序列,包括文件解析、序列计算、BLAST 搜索和数据库访问。
chemistry-rdkit
15k帮你的智能体使用 RDKit 分析以 SMILES 字符串表示的分子,包括描述符、指纹、相似性和子结构搜索。
hypothesis-formulation
15k帮你的智能体把一项观察转化为可检验的假设,附上相互竞争的解释,以及能够证伪它们的明确预测。