@nahisaho/satori 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -56
- package/package.json +1 -1
- package/src/.github/skills/scientific-biothings-idmapping/SKILL.md +298 -0
- package/src/.github/skills/scientific-cancer-genomics/SKILL.md +287 -0
- package/src/.github/skills/scientific-clinical-reporting/SKILL.md +324 -0
- package/src/.github/skills/scientific-compound-screening/SKILL.md +245 -0
- package/src/.github/skills/scientific-genome-sequence-tools/SKILL.md +304 -0
- package/src/.github/skills/scientific-healthcare-ai/SKILL.md +273 -0
- package/src/.github/skills/scientific-human-protein-atlas/SKILL.md +244 -0
- package/src/.github/skills/scientific-literature-search/SKILL.md +443 -0
- package/src/.github/skills/scientific-metabolic-modeling/SKILL.md +288 -0
- package/src/.github/skills/scientific-metabolomics-databases/SKILL.md +288 -0
- package/src/.github/skills/scientific-molecular-docking/SKILL.md +303 -0
- package/src/.github/skills/scientific-noncoding-rna/SKILL.md +262 -0
- package/src/.github/skills/scientific-pathway-enrichment/SKILL.md +449 -0
- package/src/.github/skills/scientific-pharmacology-targets/SKILL.md +323 -0
- package/src/.github/skills/scientific-protein-domain-family/SKILL.md +369 -0
- package/src/.github/skills/scientific-protein-interaction-network/SKILL.md +352 -0
- package/src/.github/skills/scientific-rare-disease-genetics/SKILL.md +327 -0
- package/src/.github/skills/scientific-structural-proteomics/SKILL.md +317 -0
- package/src/.github/skills/scientific-systematic-review/SKILL.md +361 -0
- package/src/.github/skills/scientific-variant-effect-prediction/SKILL.md +325 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-metabolic-modeling
|
|
3
|
+
description: |
|
|
4
|
+
代謝モデリングスキル。BiGG Models ゲノムスケール代謝モデル、
|
|
5
|
+
BioModels SBML リポジトリを統合した代謝ネットワーク解析・
|
|
6
|
+
モデル検索パイプライン。
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Scientific Metabolic Modeling
|
|
10
|
+
|
|
11
|
+
BiGG Models と BioModels を活用したゲノムスケール代謝モデルの
|
|
12
|
+
検索・探索・解析パイプラインを提供する。
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- ゲノムスケール代謝モデル (GEM) を検索・取得するとき
|
|
17
|
+
- BiGG Models の反応・代謝物データを調べるとき
|
|
18
|
+
- BioModels リポジトリから SBML モデルを取得するとき
|
|
19
|
+
- 代謝パスウェイのフラックス解析の準備を行うとき
|
|
20
|
+
- 複数生物種の代謝モデルを比較するとき
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
## 1. BiGG Models 検索
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import requests
|
|
30
|
+
import pandas as pd
|
|
31
|
+
|
|
32
|
+
BIGG_API = "http://bigg.ucsd.edu/api/v2"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def bigg_search(query, search_type="models"):
|
|
36
|
+
"""
|
|
37
|
+
BiGG Models データベースを検索。
|
|
38
|
+
|
|
39
|
+
Parameters:
|
|
40
|
+
query: str — search term
|
|
41
|
+
search_type: str — "models", "reactions", "metabolites"
|
|
42
|
+
|
|
43
|
+
ToolUniverse:
|
|
44
|
+
BiGG_search(query=query, search_type=search_type)
|
|
45
|
+
BiGG_list_models()
|
|
46
|
+
"""
|
|
47
|
+
url = f"{BIGG_API}/search"
|
|
48
|
+
params = {
|
|
49
|
+
"query": query,
|
|
50
|
+
"search_type": search_type,
|
|
51
|
+
}
|
|
52
|
+
resp = requests.get(url, params=params)
|
|
53
|
+
resp.raise_for_status()
|
|
54
|
+
data = resp.json()
|
|
55
|
+
|
|
56
|
+
results = data.get("results", [])
|
|
57
|
+
df = pd.DataFrame(results)
|
|
58
|
+
print(f"BiGG search '{query}' ({search_type}): {len(df)} results")
|
|
59
|
+
return df
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 2. BiGG モデル詳細取得
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
def bigg_get_model(model_id):
|
|
66
|
+
"""
|
|
67
|
+
BiGG Models からゲノムスケール代謝モデルの詳細を取得。
|
|
68
|
+
|
|
69
|
+
Parameters:
|
|
70
|
+
model_id: str — BiGG model ID (e.g., "iJO1366")
|
|
71
|
+
|
|
72
|
+
ToolUniverse:
|
|
73
|
+
BiGG_get_model(model_id=model_id)
|
|
74
|
+
BiGG_get_model_reactions(model_id=model_id)
|
|
75
|
+
BiGG_get_database_version()
|
|
76
|
+
"""
|
|
77
|
+
url = f"{BIGG_API}/models/{model_id}"
|
|
78
|
+
resp = requests.get(url)
|
|
79
|
+
resp.raise_for_status()
|
|
80
|
+
data = resp.json()
|
|
81
|
+
|
|
82
|
+
info = {
|
|
83
|
+
"model_id": data.get("bigg_id", ""),
|
|
84
|
+
"organism": data.get("organism", ""),
|
|
85
|
+
"genome_name": data.get("genome_name", ""),
|
|
86
|
+
"num_reactions": data.get("reaction_count", 0),
|
|
87
|
+
"num_metabolites": data.get("metabolite_count", 0),
|
|
88
|
+
"num_genes": data.get("gene_count", 0),
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
print(f"BiGG model {model_id}: {info['organism']}, "
|
|
92
|
+
f"{info['num_reactions']} reactions, "
|
|
93
|
+
f"{info['num_metabolites']} metabolites, "
|
|
94
|
+
f"{info['num_genes']} genes")
|
|
95
|
+
return info, data
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 3. BiGG 反応・代謝物データ
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
def bigg_get_reaction(reaction_id):
|
|
102
|
+
"""
|
|
103
|
+
BiGG 反応の詳細 (反応式, 関連モデル) を取得。
|
|
104
|
+
|
|
105
|
+
ToolUniverse:
|
|
106
|
+
BiGG_get_reaction(reaction_id=reaction_id)
|
|
107
|
+
"""
|
|
108
|
+
url = f"{BIGG_API}/universal/reactions/{reaction_id}"
|
|
109
|
+
resp = requests.get(url)
|
|
110
|
+
resp.raise_for_status()
|
|
111
|
+
data = resp.json()
|
|
112
|
+
|
|
113
|
+
info = {
|
|
114
|
+
"reaction_id": data.get("bigg_id", ""),
|
|
115
|
+
"name": data.get("name", ""),
|
|
116
|
+
"reaction_string": data.get("reaction_string", ""),
|
|
117
|
+
"pseudoreaction": data.get("pseudoreaction", False),
|
|
118
|
+
"model_count": len(data.get("models_containing_reaction", [])),
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
print(f"BiGG reaction {reaction_id}: {info['name']}")
|
|
122
|
+
return info, data
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def bigg_get_metabolite(metabolite_id):
|
|
126
|
+
"""
|
|
127
|
+
BiGG 代謝物の詳細を取得。
|
|
128
|
+
|
|
129
|
+
ToolUniverse:
|
|
130
|
+
BiGG_get_metabolite(metabolite_id=metabolite_id)
|
|
131
|
+
"""
|
|
132
|
+
url = f"{BIGG_API}/universal/metabolites/{metabolite_id}"
|
|
133
|
+
resp = requests.get(url)
|
|
134
|
+
resp.raise_for_status()
|
|
135
|
+
data = resp.json()
|
|
136
|
+
|
|
137
|
+
info = {
|
|
138
|
+
"metabolite_id": data.get("bigg_id", ""),
|
|
139
|
+
"name": data.get("name", ""),
|
|
140
|
+
"formulae": data.get("formulae", []),
|
|
141
|
+
"charges": data.get("charges", []),
|
|
142
|
+
"model_count": len(data.get("models_containing_metabolite", [])),
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
print(f"BiGG metabolite {metabolite_id}: {info['name']}")
|
|
146
|
+
return info, data
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 4. BioModels リポジトリ検索
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
BIOMODELS_API = "https://www.ebi.ac.uk/biomodels"
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def biomodels_search(query, num_results=10):
|
|
156
|
+
"""
|
|
157
|
+
BioModels (SBML) リポジトリからモデルを検索。
|
|
158
|
+
|
|
159
|
+
Parameters:
|
|
160
|
+
query: str — search term
|
|
161
|
+
|
|
162
|
+
ToolUniverse:
|
|
163
|
+
biomodels_search(query=query)
|
|
164
|
+
BioModels_search_parameters(query=query)
|
|
165
|
+
"""
|
|
166
|
+
url = f"{BIOMODELS_API}/search"
|
|
167
|
+
params = {"query": query, "numResults": num_results}
|
|
168
|
+
resp = requests.get(url, params=params)
|
|
169
|
+
resp.raise_for_status()
|
|
170
|
+
data = resp.json()
|
|
171
|
+
|
|
172
|
+
models = data.get("models", [])
|
|
173
|
+
results = []
|
|
174
|
+
for m in models:
|
|
175
|
+
results.append({
|
|
176
|
+
"model_id": m.get("id", ""),
|
|
177
|
+
"name": m.get("name", ""),
|
|
178
|
+
"format": m.get("format", {}).get("name", ""),
|
|
179
|
+
"submission_date": m.get("submissionDate", ""),
|
|
180
|
+
"publication": m.get("publication", {}).get("title", ""),
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
df = pd.DataFrame(results)
|
|
184
|
+
print(f"BioModels '{query}': {data.get('matches', 0)} total, "
|
|
185
|
+
f"{len(df)} returned")
|
|
186
|
+
return df
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def biomodels_get_model(model_id):
|
|
190
|
+
"""
|
|
191
|
+
BioModels モデル詳細取得。
|
|
192
|
+
|
|
193
|
+
ToolUniverse:
|
|
194
|
+
BioModels_get_model(model_id=model_id)
|
|
195
|
+
BioModels_list_files(model_id=model_id)
|
|
196
|
+
BioModels_download_model(model_id=model_id)
|
|
197
|
+
"""
|
|
198
|
+
url = f"{BIOMODELS_API}/{model_id}"
|
|
199
|
+
resp = requests.get(url, headers={"Accept": "application/json"})
|
|
200
|
+
resp.raise_for_status()
|
|
201
|
+
data = resp.json()
|
|
202
|
+
|
|
203
|
+
info = {
|
|
204
|
+
"model_id": data.get("publicationId", model_id),
|
|
205
|
+
"name": data.get("name", ""),
|
|
206
|
+
"description": data.get("description", ""),
|
|
207
|
+
"format": data.get("format", {}).get("name", ""),
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
print(f"BioModels {model_id}: {info['name']}")
|
|
211
|
+
return info, data
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## 5. 統合代謝モデル探索パイプライン
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
def metabolic_model_exploration(organism_query):
|
|
218
|
+
"""
|
|
219
|
+
BiGG + BioModels を横断した代謝モデル探索。
|
|
220
|
+
|
|
221
|
+
ToolUniverse (横断):
|
|
222
|
+
BiGG_search(query=organism_query) → BiGG_get_model(model_id)
|
|
223
|
+
biomodels_search(query=organism_query) → BioModels_get_model(model_id)
|
|
224
|
+
"""
|
|
225
|
+
pipeline = {"query": organism_query}
|
|
226
|
+
|
|
227
|
+
# Step 1: BiGG search
|
|
228
|
+
bigg_df = bigg_search(organism_query, search_type="models")
|
|
229
|
+
pipeline["bigg_models"] = len(bigg_df)
|
|
230
|
+
|
|
231
|
+
if not bigg_df.empty:
|
|
232
|
+
top_model = bigg_df.iloc[0]
|
|
233
|
+
model_id = top_model.get("bigg_id", "")
|
|
234
|
+
if model_id:
|
|
235
|
+
info, _ = bigg_get_model(model_id)
|
|
236
|
+
pipeline["bigg_top_model"] = info
|
|
237
|
+
|
|
238
|
+
# Step 2: BioModels search
|
|
239
|
+
bm_df = biomodels_search(organism_query)
|
|
240
|
+
pipeline["biomodels_models"] = len(bm_df)
|
|
241
|
+
|
|
242
|
+
print(f"Metabolic models '{organism_query}': "
|
|
243
|
+
f"BiGG={pipeline['bigg_models']}, "
|
|
244
|
+
f"BioModels={pipeline['biomodels_models']}")
|
|
245
|
+
return pipeline
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## References
|
|
249
|
+
|
|
250
|
+
### Output Files
|
|
251
|
+
|
|
252
|
+
| ファイル | 形式 |
|
|
253
|
+
|---|---|
|
|
254
|
+
| `results/bigg_search.csv` | CSV |
|
|
255
|
+
| `results/bigg_model.json` | JSON |
|
|
256
|
+
| `results/bigg_reaction.json` | JSON |
|
|
257
|
+
| `results/biomodels_search.csv` | CSV |
|
|
258
|
+
| `results/biomodels_model.json` | JSON |
|
|
259
|
+
|
|
260
|
+
### 利用可能ツール
|
|
261
|
+
|
|
262
|
+
| カテゴリ | 主要ツール | 用途 |
|
|
263
|
+
|---|---|---|
|
|
264
|
+
| BiGG | `BiGG_search` | モデル/反応/代謝物検索 |
|
|
265
|
+
| BiGG | `BiGG_list_models` | モデル一覧 |
|
|
266
|
+
| BiGG | `BiGG_get_model` | モデル詳細 |
|
|
267
|
+
| BiGG | `BiGG_get_model_reactions` | モデル反応一覧 |
|
|
268
|
+
| BiGG | `BiGG_get_reaction` | 反応詳細 |
|
|
269
|
+
| BiGG | `BiGG_get_metabolite` | 代謝物詳細 |
|
|
270
|
+
| BiGG | `BiGG_get_database_version` | DB バージョン |
|
|
271
|
+
| BioModels | `biomodels_search` | モデル検索 |
|
|
272
|
+
| BioModels | `BioModels_get_model` | モデル詳細 |
|
|
273
|
+
| BioModels | `BioModels_list_files` | ファイル一覧 |
|
|
274
|
+
| BioModels | `BioModels_download_model` | モデル DL |
|
|
275
|
+
| BioModels | `BioModels_search_parameters` | パラメータ検索 |
|
|
276
|
+
|
|
277
|
+
### 参照スキル
|
|
278
|
+
|
|
279
|
+
| スキル | 関連 |
|
|
280
|
+
|---|---|
|
|
281
|
+
| `scientific-pathway-enrichment` | パスウェイ解析 |
|
|
282
|
+
| `scientific-systems-biology` | システム生物学 |
|
|
283
|
+
| `scientific-gene-expression-transcriptomics` | 発現データ |
|
|
284
|
+
| `scientific-biothings-idmapping` | ID マッピング |
|
|
285
|
+
|
|
286
|
+
### 依存パッケージ
|
|
287
|
+
|
|
288
|
+
`requests`, `pandas`
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-metabolomics-databases
|
|
3
|
+
description: |
|
|
4
|
+
メタボロミクスデータベース統合スキル。HMDB (Human Metabolome Database、
|
|
5
|
+
220,000+ 代謝物)、MetaCyc (代謝パスウェイ)、Metabolomics Workbench
|
|
6
|
+
(NIH メタボロミクスリポジトリ) の 3 大メタボロミクス DB を統合した
|
|
7
|
+
代謝物同定、パスウェイマッピング、バイオマーカー発見、
|
|
8
|
+
RefMet 標準化命名パイプライン。13 の ToolUniverse SMCP ツールと連携。
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Scientific Metabolomics Databases
|
|
12
|
+
|
|
13
|
+
HMDB / MetaCyc / Metabolomics Workbench の 3 大メタボロミクスデータベースを統合した
|
|
14
|
+
代謝物同定・パスウェイマッピング・バイオマーカー発見パイプラインを提供する。
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- 質量 (m/z) から代謝物を同定するとき
|
|
19
|
+
- HMDB で代謝物の生物学的コンテキストを調べるとき
|
|
20
|
+
- MetaCyc で代謝パスウェイの詳細を確認するとき
|
|
21
|
+
- Metabolomics Workbench の公開データセットを検索するとき
|
|
22
|
+
- 複数 DB を横断した代謝物アノテーションが必要なとき
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
## 1. HMDB 代謝物検索
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import requests
|
|
32
|
+
import pandas as pd
|
|
33
|
+
import xml.etree.ElementTree as ET
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def hmdb_search(query, search_type="name", max_results=50):
|
|
37
|
+
"""
|
|
38
|
+
HMDB (Human Metabolome Database) 検索。
|
|
39
|
+
|
|
40
|
+
Parameters:
|
|
41
|
+
query: str — 検索クエリ (代謝物名, HMDB ID, 化学式)
|
|
42
|
+
search_type: "name", "hmdb_id", "formula", "mass"
|
|
43
|
+
"""
|
|
44
|
+
# ToolUniverse 経由: HMDB_search, HMDB_get_metabolite, HMDB_get_diseases
|
|
45
|
+
|
|
46
|
+
base_url = "https://hmdb.ca/metabolites"
|
|
47
|
+
|
|
48
|
+
if search_type == "hmdb_id":
|
|
49
|
+
url = f"{base_url}/{query}.xml"
|
|
50
|
+
resp = requests.get(url, timeout=30)
|
|
51
|
+
if resp.status_code == 200:
|
|
52
|
+
root = ET.fromstring(resp.text)
|
|
53
|
+
ns = {"hmdb": "http://www.hmdb.ca"}
|
|
54
|
+
result = {
|
|
55
|
+
"hmdb_id": root.findtext("hmdb:accession", "", ns),
|
|
56
|
+
"name": root.findtext("hmdb:name", "", ns),
|
|
57
|
+
"chemical_formula": root.findtext("hmdb:chemical_formula", "", ns),
|
|
58
|
+
"monoisotopic_mass": float(root.findtext(
|
|
59
|
+
"hmdb:monisotopic_molecular_weight", "0", ns) or 0),
|
|
60
|
+
"description": (root.findtext("hmdb:description", "", ns) or "")[:300],
|
|
61
|
+
"status": root.findtext("hmdb:status", "", ns),
|
|
62
|
+
"biological_role": root.findtext(
|
|
63
|
+
"hmdb:ontology/hmdb:root/hmdb:term", "", ns),
|
|
64
|
+
}
|
|
65
|
+
return pd.DataFrame([result])
|
|
66
|
+
|
|
67
|
+
# 名前検索
|
|
68
|
+
results = []
|
|
69
|
+
params = {"query": query, "search_type": search_type}
|
|
70
|
+
print(f"HMDB search: '{query}' (type={search_type})")
|
|
71
|
+
# 実際の検索は ToolUniverse SMCP 経由で実行
|
|
72
|
+
return pd.DataFrame(results)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 2. MetaCyc 代謝パスウェイ検索
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
def metacyc_pathway_search(query, organism="Homo sapiens"):
|
|
79
|
+
"""
|
|
80
|
+
MetaCyc 代謝パスウェイ検索。
|
|
81
|
+
|
|
82
|
+
Parameters:
|
|
83
|
+
query: str — パスウェイ名/代謝物名/酵素名
|
|
84
|
+
organism: str — 生物種フィルタ
|
|
85
|
+
"""
|
|
86
|
+
# ToolUniverse 経由:
|
|
87
|
+
# MetaCyc_search_pathways, MetaCyc_get_pathway
|
|
88
|
+
# MetaCyc_get_compound, MetaCyc_get_reaction
|
|
89
|
+
|
|
90
|
+
results = {
|
|
91
|
+
"query": query,
|
|
92
|
+
"organism": organism,
|
|
93
|
+
"database": "MetaCyc",
|
|
94
|
+
"tools": [
|
|
95
|
+
"MetaCyc_search_pathways — パスウェイ検索",
|
|
96
|
+
"MetaCyc_get_pathway — パスウェイ詳細 (反応・酵素・代謝物)",
|
|
97
|
+
"MetaCyc_get_compound — 化合物詳細 (構造・特性)",
|
|
98
|
+
"MetaCyc_get_reaction — 反応詳細 (基質・生成物・酵素)",
|
|
99
|
+
],
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
print(f"MetaCyc: querying '{query}' for {organism}")
|
|
103
|
+
return results
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 3. Metabolomics Workbench データ取得
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
def metabolomics_workbench_search(query, search_type="compound_name",
|
|
110
|
+
exact_mass=None, mz_tolerance=0.01):
|
|
111
|
+
"""
|
|
112
|
+
NIH Metabolomics Workbench REST API 検索。
|
|
113
|
+
|
|
114
|
+
Parameters:
|
|
115
|
+
query: str — 検索クエリ
|
|
116
|
+
search_type: "compound_name", "refmet", "study", "exact_mass", "mz"
|
|
117
|
+
exact_mass: float — 厳密質量 (search_type="exact_mass" 時)
|
|
118
|
+
mz_tolerance: float — m/z 許容誤差 (Da)
|
|
119
|
+
"""
|
|
120
|
+
base_url = "https://www.metabolomicsworkbench.org/rest"
|
|
121
|
+
|
|
122
|
+
# ToolUniverse 経由:
|
|
123
|
+
# MetabolomicsWorkbench_search_compound_by_name
|
|
124
|
+
# MetabolomicsWorkbench_get_refmet_info
|
|
125
|
+
# MetabolomicsWorkbench_get_study
|
|
126
|
+
# MetabolomicsWorkbench_search_by_exact_mass
|
|
127
|
+
# MetabolomicsWorkbench_search_by_mz
|
|
128
|
+
# MetabolomicsWorkbench_get_compound_by_pubchem_cid
|
|
129
|
+
|
|
130
|
+
if search_type == "compound_name":
|
|
131
|
+
url = f"{base_url}/compound/name/{query}/all/"
|
|
132
|
+
elif search_type == "refmet":
|
|
133
|
+
url = f"{base_url}/refmet/name/{query}/all/"
|
|
134
|
+
elif search_type == "study":
|
|
135
|
+
url = f"{base_url}/study/study_id/{query}/summary/"
|
|
136
|
+
elif search_type == "exact_mass":
|
|
137
|
+
url = f"{base_url}/compound/exact_mass/{exact_mass}/tolerance/{mz_tolerance}/"
|
|
138
|
+
elif search_type == "mz":
|
|
139
|
+
url = f"{base_url}/compound/mz_value/{query}/tolerance/{mz_tolerance}/"
|
|
140
|
+
else:
|
|
141
|
+
raise ValueError(f"Unknown search_type: {search_type}")
|
|
142
|
+
|
|
143
|
+
resp = requests.get(url, timeout=30)
|
|
144
|
+
if resp.status_code == 200:
|
|
145
|
+
try:
|
|
146
|
+
data = resp.json()
|
|
147
|
+
if isinstance(data, list):
|
|
148
|
+
df = pd.DataFrame(data)
|
|
149
|
+
elif isinstance(data, dict):
|
|
150
|
+
df = pd.DataFrame([data])
|
|
151
|
+
else:
|
|
152
|
+
df = pd.DataFrame()
|
|
153
|
+
except Exception:
|
|
154
|
+
df = pd.DataFrame()
|
|
155
|
+
else:
|
|
156
|
+
df = pd.DataFrame()
|
|
157
|
+
|
|
158
|
+
print(f"Metabolomics Workbench ({search_type}): {len(df)} results")
|
|
159
|
+
return df
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 4. m/z ベース代謝物同定 (マルチ DB)
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
def identify_metabolites_by_mass(mz_values, adducts=None,
|
|
166
|
+
tolerance_ppm=10,
|
|
167
|
+
databases=None):
|
|
168
|
+
"""
|
|
169
|
+
m/z 値から複数 DB を横断して代謝物を同定。
|
|
170
|
+
|
|
171
|
+
Parameters:
|
|
172
|
+
mz_values: list[float] — 観測 m/z 値リスト
|
|
173
|
+
adducts: list — アダクトイオン (e.g., ["[M+H]+", "[M+Na]+", "[M-H]-"])
|
|
174
|
+
tolerance_ppm: float — 質量許容誤差 (ppm)
|
|
175
|
+
databases: list — 検索対象 DB ("hmdb", "metacyc", "mwb")
|
|
176
|
+
"""
|
|
177
|
+
import numpy as np
|
|
178
|
+
|
|
179
|
+
if adducts is None:
|
|
180
|
+
adducts = [
|
|
181
|
+
{"name": "[M+H]+", "mass_diff": 1.007276, "mode": "positive"},
|
|
182
|
+
{"name": "[M+Na]+", "mass_diff": 22.989218, "mode": "positive"},
|
|
183
|
+
{"name": "[M-H]-", "mass_diff": -1.007276, "mode": "negative"},
|
|
184
|
+
{"name": "[M+NH4]+", "mass_diff": 18.034164, "mode": "positive"},
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
if databases is None:
|
|
188
|
+
databases = ["hmdb", "mwb"]
|
|
189
|
+
|
|
190
|
+
all_results = []
|
|
191
|
+
|
|
192
|
+
for mz in mz_values:
|
|
193
|
+
for adduct in adducts:
|
|
194
|
+
neutral_mass = mz - adduct["mass_diff"]
|
|
195
|
+
tolerance_da = neutral_mass * tolerance_ppm / 1e6
|
|
196
|
+
|
|
197
|
+
result = {
|
|
198
|
+
"query_mz": mz,
|
|
199
|
+
"adduct": adduct["name"],
|
|
200
|
+
"neutral_mass": round(neutral_mass, 6),
|
|
201
|
+
"tolerance_da": round(tolerance_da, 6),
|
|
202
|
+
"databases_queried": databases,
|
|
203
|
+
}
|
|
204
|
+
all_results.append(result)
|
|
205
|
+
|
|
206
|
+
df = pd.DataFrame(all_results)
|
|
207
|
+
print(f"Mass-based ID: {len(mz_values)} m/z values × "
|
|
208
|
+
f"{len(adducts)} adducts = {len(df)} queries "
|
|
209
|
+
f"across {databases}")
|
|
210
|
+
return df
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 5. RefMet 標準化命名
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
def refmet_standardize(metabolite_names):
|
|
217
|
+
"""
|
|
218
|
+
RefMet (Reference Metabolomics) 標準化命名。
|
|
219
|
+
|
|
220
|
+
Parameters:
|
|
221
|
+
metabolite_names: list — 代謝物名リスト (非標準化)
|
|
222
|
+
"""
|
|
223
|
+
results = []
|
|
224
|
+
|
|
225
|
+
for name in metabolite_names:
|
|
226
|
+
# ToolUniverse 経由: MetabolomicsWorkbench_get_refmet_info
|
|
227
|
+
result = {
|
|
228
|
+
"input_name": name,
|
|
229
|
+
"refmet_name": None,
|
|
230
|
+
"super_class": None,
|
|
231
|
+
"main_class": None,
|
|
232
|
+
"sub_class": None,
|
|
233
|
+
"formula": None,
|
|
234
|
+
"exact_mass": None,
|
|
235
|
+
}
|
|
236
|
+
results.append(result)
|
|
237
|
+
|
|
238
|
+
df = pd.DataFrame(results)
|
|
239
|
+
print(f"RefMet standardization: {len(df)} metabolites queried")
|
|
240
|
+
return df
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## References
|
|
244
|
+
|
|
245
|
+
### Output Files
|
|
246
|
+
|
|
247
|
+
| ファイル | 形式 |
|
|
248
|
+
|---|---|
|
|
249
|
+
| `results/hmdb_metabolites.csv` | CSV |
|
|
250
|
+
| `results/metacyc_pathways.json` | JSON |
|
|
251
|
+
| `results/mwb_compounds.csv` | CSV |
|
|
252
|
+
| `results/mass_id_results.csv` | CSV |
|
|
253
|
+
| `results/refmet_standardized.csv` | CSV |
|
|
254
|
+
| `figures/metabolite_class_distribution.png` | PNG |
|
|
255
|
+
|
|
256
|
+
### 利用可能ツール
|
|
257
|
+
|
|
258
|
+
> [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
|
|
259
|
+
|
|
260
|
+
| カテゴリ | 主要ツール | 用途 |
|
|
261
|
+
|---|---|---|
|
|
262
|
+
| HMDB | `HMDB_get_metabolite` | 代謝物詳細取得 |
|
|
263
|
+
| HMDB | `HMDB_search` | 代謝物検索 |
|
|
264
|
+
| HMDB | `HMDB_get_diseases` | 疾患関連代謝物 |
|
|
265
|
+
| MetaCyc | `MetaCyc_search_pathways` | 代謝パスウェイ検索 |
|
|
266
|
+
| MetaCyc | `MetaCyc_get_pathway` | パスウェイ詳細 |
|
|
267
|
+
| MetaCyc | `MetaCyc_get_compound` | 化合物詳細 |
|
|
268
|
+
| MetaCyc | `MetaCyc_get_reaction` | 反応詳細 |
|
|
269
|
+
| MWB | `MetabolomicsWorkbench_search_compound_by_name` | 化合物名検索 |
|
|
270
|
+
| MWB | `MetabolomicsWorkbench_get_refmet_info` | RefMet 標準化情報 |
|
|
271
|
+
| MWB | `MetabolomicsWorkbench_get_study` | 研究データ取得 |
|
|
272
|
+
| MWB | `MetabolomicsWorkbench_search_by_exact_mass` | 厳密質量検索 |
|
|
273
|
+
| MWB | `MetabolomicsWorkbench_search_by_mz` | m/z 値検索 |
|
|
274
|
+
| MWB | `MetabolomicsWorkbench_get_compound_by_pubchem_cid` | PubChem CID 検索 |
|
|
275
|
+
|
|
276
|
+
### 参照スキル
|
|
277
|
+
|
|
278
|
+
| スキル | 関連 |
|
|
279
|
+
|---|---|
|
|
280
|
+
| `scientific-metabolomics` | PLS-DA/VIP 統計解析 |
|
|
281
|
+
| `scientific-pathway-enrichment` | 代謝物 → パスウェイ富化 |
|
|
282
|
+
| `scientific-cheminformatics` | 分子記述子・構造解析 |
|
|
283
|
+
| `scientific-systems-biology` | FBA 代謝フラックス |
|
|
284
|
+
| `scientific-multi-omics` | メタボロミクス ↔ オミクス統合 |
|
|
285
|
+
|
|
286
|
+
### 依存パッケージ
|
|
287
|
+
|
|
288
|
+
`requests`, `pandas`, `numpy`, `xml.etree.ElementTree` (stdlib)
|