AgentSkillsCN

scientific-metabolic-modeling

代谢建模技能。整合BiGG Models基因组尺度代谢模型与BioModels SBML存储库,构建代谢网络分析与模型检索流程。

SKILL.md
--- frontmatter
name: scientific-metabolic-modeling
description: |
  代謝モデリングスキル。BiGG Models ゲノムスケール代謝モデル、
  BioModels SBML リポジトリを統合した代謝ネットワーク解析・
  モデル検索パイプライン。

Scientific Metabolic Modeling

BiGG Models と BioModels を活用したゲノムスケール代謝モデルの 検索・探索・解析パイプラインを提供する。

When to Use

  • ゲノムスケール代謝モデル (GEM) を検索・取得するとき
  • BiGG Models の反応・代謝物データを調べるとき
  • BioModels リポジトリから SBML モデルを取得するとき
  • 代謝パスウェイのフラックス解析の準備を行うとき
  • 複数生物種の代謝モデルを比較するとき

Quick Start

1. BiGG Models 検索

python
import requests
import pandas as pd

BIGG_API = "http://bigg.ucsd.edu/api/v2"


def bigg_search(query, search_type="models"):
    """
    BiGG Models データベースを検索。

    Parameters:
        query: str — search term
        search_type: str — "models", "reactions", "metabolites"

    ToolUniverse:
        BiGG_search(query=query, search_type=search_type)
        BiGG_list_models()
    """
    url = f"{BIGG_API}/search"
    params = {
        "query": query,
        "search_type": search_type,
    }
    resp = requests.get(url, params=params)
    resp.raise_for_status()
    data = resp.json()

    results = data.get("results", [])
    df = pd.DataFrame(results)
    print(f"BiGG search '{query}' ({search_type}): {len(df)} results")
    return df

2. BiGG モデル詳細取得

python
def bigg_get_model(model_id):
    """
    BiGG Models からゲノムスケール代謝モデルの詳細を取得。

    Parameters:
        model_id: str — BiGG model ID (e.g., "iJO1366")

    ToolUniverse:
        BiGG_get_model(model_id=model_id)
        BiGG_get_model_reactions(model_id=model_id)
        BiGG_get_database_version()
    """
    url = f"{BIGG_API}/models/{model_id}"
    resp = requests.get(url)
    resp.raise_for_status()
    data = resp.json()

    info = {
        "model_id": data.get("bigg_id", ""),
        "organism": data.get("organism", ""),
        "genome_name": data.get("genome_name", ""),
        "num_reactions": data.get("reaction_count", 0),
        "num_metabolites": data.get("metabolite_count", 0),
        "num_genes": data.get("gene_count", 0),
    }

    print(f"BiGG model {model_id}: {info['organism']}, "
          f"{info['num_reactions']} reactions, "
          f"{info['num_metabolites']} metabolites, "
          f"{info['num_genes']} genes")
    return info, data

3. BiGG 反応・代謝物データ

python
def bigg_get_reaction(reaction_id):
    """
    BiGG 反応の詳細 (反応式, 関連モデル) を取得。

    ToolUniverse:
        BiGG_get_reaction(reaction_id=reaction_id)
    """
    url = f"{BIGG_API}/universal/reactions/{reaction_id}"
    resp = requests.get(url)
    resp.raise_for_status()
    data = resp.json()

    info = {
        "reaction_id": data.get("bigg_id", ""),
        "name": data.get("name", ""),
        "reaction_string": data.get("reaction_string", ""),
        "pseudoreaction": data.get("pseudoreaction", False),
        "model_count": len(data.get("models_containing_reaction", [])),
    }

    print(f"BiGG reaction {reaction_id}: {info['name']}")
    return info, data


def bigg_get_metabolite(metabolite_id):
    """
    BiGG 代謝物の詳細を取得。

    ToolUniverse:
        BiGG_get_metabolite(metabolite_id=metabolite_id)
    """
    url = f"{BIGG_API}/universal/metabolites/{metabolite_id}"
    resp = requests.get(url)
    resp.raise_for_status()
    data = resp.json()

    info = {
        "metabolite_id": data.get("bigg_id", ""),
        "name": data.get("name", ""),
        "formulae": data.get("formulae", []),
        "charges": data.get("charges", []),
        "model_count": len(data.get("models_containing_metabolite", [])),
    }

    print(f"BiGG metabolite {metabolite_id}: {info['name']}")
    return info, data

4. BioModels リポジトリ検索

python
BIOMODELS_API = "https://www.ebi.ac.uk/biomodels"


def biomodels_search(query, num_results=10):
    """
    BioModels (SBML) リポジトリからモデルを検索。

    Parameters:
        query: str — search term

    ToolUniverse:
        biomodels_search(query=query)
        BioModels_search_parameters(query=query)
    """
    url = f"{BIOMODELS_API}/search"
    params = {"query": query, "numResults": num_results}
    resp = requests.get(url, params=params)
    resp.raise_for_status()
    data = resp.json()

    models = data.get("models", [])
    results = []
    for m in models:
        results.append({
            "model_id": m.get("id", ""),
            "name": m.get("name", ""),
            "format": m.get("format", {}).get("name", ""),
            "submission_date": m.get("submissionDate", ""),
            "publication": m.get("publication", {}).get("title", ""),
        })

    df = pd.DataFrame(results)
    print(f"BioModels '{query}': {data.get('matches', 0)} total, "
          f"{len(df)} returned")
    return df


def biomodels_get_model(model_id):
    """
    BioModels モデル詳細取得。

    ToolUniverse:
        BioModels_get_model(model_id=model_id)
        BioModels_list_files(model_id=model_id)
        BioModels_download_model(model_id=model_id)
    """
    url = f"{BIOMODELS_API}/{model_id}"
    resp = requests.get(url, headers={"Accept": "application/json"})
    resp.raise_for_status()
    data = resp.json()

    info = {
        "model_id": data.get("publicationId", model_id),
        "name": data.get("name", ""),
        "description": data.get("description", ""),
        "format": data.get("format", {}).get("name", ""),
    }

    print(f"BioModels {model_id}: {info['name']}")
    return info, data

5. 統合代謝モデル探索パイプライン

python
def metabolic_model_exploration(organism_query):
    """
    BiGG + BioModels を横断した代謝モデル探索。

    ToolUniverse (横断):
        BiGG_search(query=organism_query) → BiGG_get_model(model_id)
        biomodels_search(query=organism_query) → BioModels_get_model(model_id)
    """
    pipeline = {"query": organism_query}

    # Step 1: BiGG search
    bigg_df = bigg_search(organism_query, search_type="models")
    pipeline["bigg_models"] = len(bigg_df)

    if not bigg_df.empty:
        top_model = bigg_df.iloc[0]
        model_id = top_model.get("bigg_id", "")
        if model_id:
            info, _ = bigg_get_model(model_id)
            pipeline["bigg_top_model"] = info

    # Step 2: BioModels search
    bm_df = biomodels_search(organism_query)
    pipeline["biomodels_models"] = len(bm_df)

    print(f"Metabolic models '{organism_query}': "
          f"BiGG={pipeline['bigg_models']}, "
          f"BioModels={pipeline['biomodels_models']}")
    return pipeline

References

Output Files

ファイル形式
results/bigg_search.csvCSV
results/bigg_model.jsonJSON
results/bigg_reaction.jsonJSON
results/biomodels_search.csvCSV
results/biomodels_model.jsonJSON

利用可能ツール

カテゴリ主要ツール用途
BiGGBiGG_searchモデル/反応/代謝物検索
BiGGBiGG_list_modelsモデル一覧
BiGGBiGG_get_modelモデル詳細
BiGGBiGG_get_model_reactionsモデル反応一覧
BiGGBiGG_get_reaction反応詳細
BiGGBiGG_get_metabolite代謝物詳細
BiGGBiGG_get_database_versionDB バージョン
BioModelsbiomodels_searchモデル検索
BioModelsBioModels_get_modelモデル詳細
BioModelsBioModels_list_filesファイル一覧
BioModelsBioModels_download_modelモデル DL
BioModelsBioModels_search_parametersパラメータ検索

参照スキル

スキル関連
scientific-pathway-enrichmentパスウェイ解析
scientific-systems-biologyシステム生物学
scientific-gene-expression-transcriptomics発現データ
scientific-biothings-idmappingID マッピング

依存パッケージ

requests, pandas