flux-analyzer
它能做什么
该技能解释通量模拟的输出,并生成易读的结果和图表。适合需要解释模拟数字含义的研究人员。
适用场景
- ✓当你已有通量结果,并想知道哪些基因是必需的时候。
- ✓当你需要相平面图或通量采样摘要的时候。
- ✓当你需要为论文准备通路层面或产物分泌摘要的时候。
技能链接
https://github.com/aiming-lab/AutoResearchClaw/blob/main/external/agents/Biology-Agent/skills/flux-analyzer/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请找出我的模型中的必需基因,并绘制氧气相对于葡萄糖的相平面图。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会加载模型和通量结果,依次删除每个基因以观察生长如何变化,标记使生长降到设定阈值以下的基因,并生成图表和摘要表格。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Overview
The flux-analyzer skill transforms raw FBA output into actionable biological
knowledge. It operates on FBA result files and the COBRApy model to produce
gene essentiality maps, phenotypic phase planes (PPP), flux sampling
distributions, pathway-level summaries, and product secretion profiles.
This skill is the metabolic-modelling analogue of event reconstruction and phenomenology summary stage in the ColliderAgent pipeline: it turns numbers into biology.
Workflow
Step 1 — Load Model and FBA Results
import cobra
import cobra.io
import cobra.flux_analysis
import cobra.sampling
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
model = cobra.io.load_json_model("my_model.json")
fba_fluxes = pd.read_csv("fba_fluxes.csv", index_col=0)["flux_mmol_gDW_h"]
wt_growth = model.optimize().objective_value
print(f"Wild-type growth: {wt_growth:.4f} h^-1")
Step 2 — Gene Essentiality Analysis
Essential genes are those whose deletion reduces growth to below 5% of wild-type — a widely used lethality criterion.
from cobra.flux_analysis import single_gene_deletion, double_gene_deletion
# --- Single gene essentiality ---
sg_deletion = single_gene_deletion(model)
sg_deletion.columns = ["growth", "status"]
sg_deletion["is_essential"] = sg_deletion["growth"] < 0.05 * wt_growth
sg_deletion["growth_fraction"] = sg_deletion["growth"] / wt_growth
essential_genes = sg_deletion[sg_deletion["is_essential"]]
print(f"Essential genes: {len(essential_genes)} / {len(model.genes)}")
sg_deletion.to_csv("gene_essentiality.csv")
# --- Double gene essentiality (synthetic lethality) ---
# Limit to a focused gene set to reduce compute time
target_genes = list(model.genes)[:50] # adjust as needed
dg_deletion = double_gene_deletion(model, target_genes, target_genes)
dg_deletion.columns = ["growth", "status"]
dg_deletion["is_synthetic_lethal"] = dg_deletion["growth"] < 0.05 * wt_growth
dg_deletion.to_csv("double_gene_essentiality.csv")
Step 3 — Reaction Essentiality Analysis
from cobra.flux_analysis import single_reaction_deletion
sr_deletion = single_reaction_deletion(model)
sr_deletion.columns = ["growth", "status"]
sr_deletion["is_essential"] = sr_deletion["growth"] < 0.05 * wt_growth
essential_rxns = sr_deletion[sr_deletion["is_essential"]]
print(f"Essential reactions: {len(essential_rxns)} / {len(model.reactions)}")
sr_deletion.to_csv("reaction_essentiality.csv")
Step 4 — Phenotypic Phase Plane (PPP)
The PPP maps growth rate over a 2D grid of two nutrient uptake rates, revealing metabolic phase transitions (aerobic growth, mixed-acid fermentation, etc.).
from cobra.flux_analysis import production_envelope
# Phase plane: glucose uptake vs. oxygen uptake
ppp = production_envelope(
model,
["EX_glc__D_e", "EX_o2_e"], # x and y axes
objective=model.reactions.get_by_id("BIOMASS_Ec_iJO1366_core_53p95M"),
points=20,
)
print(ppp.head())
# Plot heatmap
fig, ax = plt.subplots(figsize=(8, 6))
pivot = ppp.pivot_table(
index="EX_o2_e", columns="EX_glc__D_e", values="flux_maximum"
)
im = ax.imshow(pivot.values, aspect="auto", origin="lower",
cmap="viridis",
extent=[ppp["EX_glc__D_e"].min(), ppp["EX_glc__D_e"].max(),
ppp["EX_o2_e"].min(), ppp["EX_o2_e"].max()])
plt.colorbar(im, ax=ax, label="Growth rate (h$^{-1}$)")
ax.set_xlabel("Glucose uptake (mmol/gDW/h)")
ax.set_ylabel("O$_2$ uptake (mmol/gDW/h)")
ax.set_title("Phenotypic Phase Plane")
fig.tight_layout()
fig.savefig("phenotypic_phase_plane.pdf", dpi=300)
fig.savefig("phenotypic_phase_plane.png", dpi=150)
plt.close(fig)
print("PPP saved to phenotypic_phase_plane.pdf")
Step 5 — Flux Sampling
Flux sampling explores the full space of feasible steady-state flux distributions, revealing which reactions have wide vs. narrow feasible ranges.
# OptGP sampler: Markov-chain Monte Carlo in flux cone
samples = cobra.sampling.sample(model, n=1000, method="optgp",
thinning=100, processes=4)
# samples is a DataFrame: rows = samples, columns = reaction IDs
samples.to_csv("flux_samples.csv", index=False)
# Violin plot for key central metabolism reactions
KEY_REACTIONS = ["PFK", "PGI", "PDH", "CS", "AKGDH",
"EX_glc__D_e", "EX_ac_e", "EX_co2_e"]
key_data = samples[[r for r in KEY_REACTIONS if r in samples.columns]]
fig, ax
常见问题
它如何判定某个基因是必需的?
当删除某个基因会使生长降到野生型生长速率的 5% 以下时,该基因被视为必需基因。
什么是相平面图?
一种图形,展示当两个输入变化时,可达到的最优生长如何随之改变。
它使用哪些工具绘制图表?
使用 matplotlib,并设置为在没有显示器的情况下保存图表。
详情
作者的原始描述
Analyse FBA flux distributions to extract biological insights. Covers gene essentiality, phenotypic phase planes, flux sampling, pathway-level aggregation, secretion product prediction, and production of publication- quality figures.
热度
- GitHub 星标
- 15k
- 排名
- #11054
- 许可证
- MIT
- 更新时间
- 2026/8/19
评论
- …
同一仓库的更多技能
a-evolve
15k帮你的智能体通过反复运行来不断改进:诊断失败原因,根据错误模式创建有针对性的技能,并记录经验以备日后使用。
biology-biopython
15k帮你的智能体使用 Biopython 处理 DNA、RNA 和蛋白质序列,包括文件解析、序列计算、BLAST 搜索和数据库访问。
chemistry-rdkit
15k帮你的智能体使用 RDKit 分析以 SMILES 字符串表示的分子,包括描述符、指纹、相似性和子结构搜索。
hypothesis-formulation
15k帮你的智能体把一项观察转化为可检验的假设,附上相互竞争的解释,以及能够证伪它们的明确预测。