flux-analyzer
できること
このスキルは、フラックスシミュレーションの出力を解釈し、読みやすい結果と図を作成します。シミュレーションの数値の意味を説明する必要がある研究者向けです。
使う場面
- ✓フラックスの結果があり、どの遺伝子が必須かを知りたいとき。
- ✓相平面図やフラックスサンプリングの要約が欲しいとき。
- ✓論文のために経路レベルや産物の分泌の要約が必要なとき。
スキルのリンク
https://github.com/aiming-lab/AutoResearchClaw/blob/main/external/agents/Biology-Agent/skills/flux-analyzer/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。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パーセント未満に下がる場合、必須とみなします。
相平面図とは何ですか?
2つの入力を変えたときに、最適な成長がどう変わるかを示す図です。
図にはどのツールを使いますか?
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エージェントが、SMILES文字列で表された分子をRDKitで解析できるよう支援します。記述子、フィンガープリント、類似度、部分構造検索を含みます。
hypothesis-formulation
15kエージェントが、観察から検証可能な仮説を立てられるよう支援します。複数の対立する説明と、それを反証しうる明確な予測を含みます。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。