@nahisaho/satori 0.17.0 → 0.19.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 +85 -38
- package/package.json +1 -1
- package/src/.github/skills/scientific-alphafold-structures/SKILL.md +256 -0
- package/src/.github/skills/scientific-arrayexpress-expression/SKILL.md +264 -0
- package/src/.github/skills/scientific-civic-evidence/SKILL.md +292 -0
- package/src/.github/skills/scientific-compound-screening/SKILL.md +4 -0
- package/src/.github/skills/scientific-crossref-metadata/SKILL.md +313 -0
- package/src/.github/skills/scientific-depmap-dependencies/SKILL.md +239 -0
- package/src/.github/skills/scientific-disease-research/SKILL.md +4 -0
- package/src/.github/skills/scientific-drugbank-resources/SKILL.md +269 -0
- package/src/.github/skills/scientific-gnomad-variants/SKILL.md +356 -0
- package/src/.github/skills/scientific-gtex-tissue-expression/SKILL.md +271 -0
- package/src/.github/skills/scientific-gwas-catalog/SKILL.md +267 -0
- package/src/.github/skills/scientific-icgc-cancer-data/SKILL.md +351 -0
- package/src/.github/skills/scientific-metabolomics-databases/SKILL.md +4 -0
- package/src/.github/skills/scientific-opentargets-genetics/SKILL.md +299 -0
- package/src/.github/skills/scientific-pharmgkb-pgx/SKILL.md +306 -0
- package/src/.github/skills/scientific-protein-interaction-network/SKILL.md +4 -0
- package/src/.github/skills/scientific-rare-disease-genetics/SKILL.md +4 -0
- package/src/.github/skills/scientific-rcsb-pdb-search/SKILL.md +280 -0
- package/src/.github/skills/scientific-reactome-pathways/SKILL.md +242 -0
- package/src/.github/skills/scientific-semantic-scholar/SKILL.md +298 -0
- package/src/.github/skills/scientific-uniprot-proteome/SKILL.md +273 -0
- package/src/.github/skills/scientific-variant-interpretation/SKILL.md +4 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-reactome-pathways
|
|
3
|
+
description: |
|
|
4
|
+
Reactome パスウェイスキル。Reactome Content Service
|
|
5
|
+
REST API によるパスウェイ検索・階層取得・UniProt マッピング・
|
|
6
|
+
パスウェイ図データ取得。ToolUniverse 連携: reactome。
|
|
7
|
+
tu_tools:
|
|
8
|
+
- key: reactome
|
|
9
|
+
name: Reactome
|
|
10
|
+
description: パスウェイデータベース REST API
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Scientific Reactome Pathways
|
|
14
|
+
|
|
15
|
+
Reactome Content Service REST API を活用したパスウェイ検索・
|
|
16
|
+
階層構造取得・UniProt アクセッション→パスウェイマッピング・
|
|
17
|
+
パスウェイ図データ取得パイプラインを提供する。
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
20
|
+
|
|
21
|
+
- 生物学パスウェイを名前やキーワードで検索するとき
|
|
22
|
+
- パスウェイ階層ツリーを取得するとき
|
|
23
|
+
- UniProt アクセッションからパスウェイをマッピングするとき
|
|
24
|
+
- パスウェイの参加者 (タンパク質/化合物) を列挙するとき
|
|
25
|
+
- パスウェイ図のレイアウトデータを取得するとき
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
## 1. パスウェイ検索・詳細取得
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import requests
|
|
35
|
+
import pandas as pd
|
|
36
|
+
|
|
37
|
+
REACTOME = "https://reactome.org/ContentService"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def reactome_search(query, species="Homo sapiens",
|
|
41
|
+
limit=25):
|
|
42
|
+
"""
|
|
43
|
+
Reactome — パスウェイ検索。
|
|
44
|
+
|
|
45
|
+
Parameters:
|
|
46
|
+
query: str — 検索クエリ (例: "apoptosis", "MAPK")
|
|
47
|
+
species: str — 種名 (例: "Homo sapiens")
|
|
48
|
+
limit: int — 最大結果数
|
|
49
|
+
"""
|
|
50
|
+
url = f"{REACTOME}/search/query"
|
|
51
|
+
params = {
|
|
52
|
+
"query": query,
|
|
53
|
+
"species": species,
|
|
54
|
+
"types": "Pathway",
|
|
55
|
+
"cluster": "true",
|
|
56
|
+
}
|
|
57
|
+
resp = requests.get(url, params=params, timeout=30)
|
|
58
|
+
resp.raise_for_status()
|
|
59
|
+
data = resp.json()
|
|
60
|
+
|
|
61
|
+
rows = []
|
|
62
|
+
for group in data.get("results", []):
|
|
63
|
+
for entry in group.get("entries", [])[:limit]:
|
|
64
|
+
rows.append({
|
|
65
|
+
"stId": entry.get("stId", ""),
|
|
66
|
+
"name": entry.get("name", ""),
|
|
67
|
+
"species": entry.get("species", ""),
|
|
68
|
+
"exact_type": entry.get(
|
|
69
|
+
"exactType", ""),
|
|
70
|
+
"compartments": "; ".join(
|
|
71
|
+
entry.get("compartmentNames", [])),
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
df = pd.DataFrame(rows[:limit])
|
|
75
|
+
print(f"Reactome search: '{query}' → {len(df)} "
|
|
76
|
+
f"pathways")
|
|
77
|
+
return df
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def reactome_pathway_detail(pathway_id):
|
|
81
|
+
"""
|
|
82
|
+
Reactome — パスウェイ詳細取得。
|
|
83
|
+
|
|
84
|
+
Parameters:
|
|
85
|
+
pathway_id: str — Reactome Stable ID
|
|
86
|
+
(例: "R-HSA-109581")
|
|
87
|
+
"""
|
|
88
|
+
url = f"{REACTOME}/data/pathway/{pathway_id}"
|
|
89
|
+
resp = requests.get(url, timeout=30)
|
|
90
|
+
resp.raise_for_status()
|
|
91
|
+
data = resp.json()
|
|
92
|
+
|
|
93
|
+
result = {
|
|
94
|
+
"stId": data.get("stId", ""),
|
|
95
|
+
"name": data.get("displayName", ""),
|
|
96
|
+
"species": data.get("speciesName", ""),
|
|
97
|
+
"is_inferred": data.get("isInferred", False),
|
|
98
|
+
"has_diagram": data.get("hasDiagram", False),
|
|
99
|
+
"n_sub_events": len(
|
|
100
|
+
data.get("hasEvent", [])),
|
|
101
|
+
"n_compartments": len(
|
|
102
|
+
data.get("compartment", [])),
|
|
103
|
+
"release_date": data.get("releaseDate", ""),
|
|
104
|
+
}
|
|
105
|
+
return result
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 2. UniProt→パスウェイ マッピング
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
def reactome_uniprot_pathways(uniprot_id,
|
|
112
|
+
species="Homo sapiens"):
|
|
113
|
+
"""
|
|
114
|
+
Reactome — UniProt → パスウェイマッピング。
|
|
115
|
+
|
|
116
|
+
Parameters:
|
|
117
|
+
uniprot_id: str — UniProt アクセッション
|
|
118
|
+
(例: "P38398" = BRCA1)
|
|
119
|
+
species: str — 種名
|
|
120
|
+
"""
|
|
121
|
+
url = f"{REACTOME}/data/pathways/low/entity/{uniprot_id}"
|
|
122
|
+
params = {"species": species}
|
|
123
|
+
resp = requests.get(url, params=params, timeout=30)
|
|
124
|
+
resp.raise_for_status()
|
|
125
|
+
data = resp.json()
|
|
126
|
+
|
|
127
|
+
rows = []
|
|
128
|
+
for pw in data:
|
|
129
|
+
rows.append({
|
|
130
|
+
"pathway_id": pw.get("stId", ""),
|
|
131
|
+
"pathway_name": pw.get("displayName", ""),
|
|
132
|
+
"species": pw.get("speciesName", ""),
|
|
133
|
+
"has_diagram": pw.get("hasDiagram", False),
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
df = pd.DataFrame(rows)
|
|
137
|
+
print(f"Reactome UniProt→pathway: {uniprot_id} "
|
|
138
|
+
f"→ {len(df)} pathways")
|
|
139
|
+
return df
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 3. パスウェイ参加者取得
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
def reactome_participants(pathway_id):
|
|
146
|
+
"""
|
|
147
|
+
Reactome — パスウェイ参加者一覧。
|
|
148
|
+
|
|
149
|
+
Parameters:
|
|
150
|
+
pathway_id: str — Reactome Stable ID
|
|
151
|
+
"""
|
|
152
|
+
url = (f"{REACTOME}/data/participants/"
|
|
153
|
+
f"{pathway_id}")
|
|
154
|
+
resp = requests.get(url, timeout=30)
|
|
155
|
+
resp.raise_for_status()
|
|
156
|
+
data = resp.json()
|
|
157
|
+
|
|
158
|
+
rows = []
|
|
159
|
+
for item in data:
|
|
160
|
+
pe_name = item.get("displayName", "")
|
|
161
|
+
for ref in item.get("refEntities", []):
|
|
162
|
+
rows.append({
|
|
163
|
+
"pathway_id": pathway_id,
|
|
164
|
+
"participant": pe_name,
|
|
165
|
+
"db_name": ref.get("databaseName", ""),
|
|
166
|
+
"identifier": ref.get("identifier", ""),
|
|
167
|
+
"name": ref.get("displayName", ""),
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
df = pd.DataFrame(rows)
|
|
171
|
+
print(f"Reactome participants: {pathway_id} "
|
|
172
|
+
f"→ {len(df)} entities")
|
|
173
|
+
return df
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 4. Reactome 統合パイプライン
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
def reactome_pipeline(query_or_uniprot,
|
|
180
|
+
output_dir="results"):
|
|
181
|
+
"""
|
|
182
|
+
Reactome 統合パイプライン。
|
|
183
|
+
|
|
184
|
+
Parameters:
|
|
185
|
+
query_or_uniprot: str — 検索クエリ or UniProt ID
|
|
186
|
+
output_dir: str — 出力ディレクトリ
|
|
187
|
+
"""
|
|
188
|
+
from pathlib import Path
|
|
189
|
+
output_dir = Path(output_dir)
|
|
190
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
191
|
+
|
|
192
|
+
is_uniprot = (len(query_or_uniprot) == 6
|
|
193
|
+
and query_or_uniprot[0].isalpha())
|
|
194
|
+
|
|
195
|
+
if is_uniprot:
|
|
196
|
+
# UniProt → パスウェイ
|
|
197
|
+
pathways = reactome_uniprot_pathways(
|
|
198
|
+
query_or_uniprot)
|
|
199
|
+
else:
|
|
200
|
+
# テキスト検索
|
|
201
|
+
pathways = reactome_search(query_or_uniprot)
|
|
202
|
+
|
|
203
|
+
pathways.to_csv(output_dir / "reactome_pathways.csv",
|
|
204
|
+
index=False)
|
|
205
|
+
|
|
206
|
+
# トップパスウェイの参加者
|
|
207
|
+
if not pathways.empty:
|
|
208
|
+
top_id = (pathways.iloc[0].get("pathway_id")
|
|
209
|
+
or pathways.iloc[0].get("stId"))
|
|
210
|
+
parts = reactome_participants(top_id)
|
|
211
|
+
parts.to_csv(
|
|
212
|
+
output_dir / "reactome_participants.csv",
|
|
213
|
+
index=False)
|
|
214
|
+
|
|
215
|
+
print(f"Reactome pipeline: {output_dir}")
|
|
216
|
+
return {"pathways": pathways}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## ToolUniverse 連携
|
|
222
|
+
|
|
223
|
+
| TU Key | ツール名 | 連携内容 |
|
|
224
|
+
|--------|---------|---------|
|
|
225
|
+
| `reactome` | Reactome | パスウェイデータベース REST API |
|
|
226
|
+
|
|
227
|
+
## パイプライン統合
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
pathway-enrichment → reactome-pathways → systems-biology
|
|
231
|
+
(GO/パスウェイ) (Reactome API) (ネットワーク解析)
|
|
232
|
+
│ │ ↓
|
|
233
|
+
uniprot-proteome ──────────┘ metabolomics-databases
|
|
234
|
+
(UniProt ID) (MetaCyc 代謝)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## パイプライン出力
|
|
238
|
+
|
|
239
|
+
| ファイル | 説明 | 次スキル |
|
|
240
|
+
|---------|------|---------|
|
|
241
|
+
| `results/reactome_pathways.csv` | パスウェイ一覧 | → pathway-enrichment |
|
|
242
|
+
| `results/reactome_participants.csv` | 参加者 | → protein-interaction-network |
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-semantic-scholar
|
|
3
|
+
description: |
|
|
4
|
+
Semantic Scholar 学術グラフスキル。Semantic Scholar Academic
|
|
5
|
+
Graph API による論文検索・著者プロファイル・引用グラフ・
|
|
6
|
+
推薦・TLDR 要約。ToolUniverse 連携: semantic_scholar。
|
|
7
|
+
tu_tools:
|
|
8
|
+
- key: semantic_scholar
|
|
9
|
+
name: Semantic Scholar
|
|
10
|
+
description: 学術論文検索・引用解析・著者プロファイル
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Scientific Semantic Scholar
|
|
14
|
+
|
|
15
|
+
Semantic Scholar Academic Graph API を活用した学術論文検索・
|
|
16
|
+
引用ネットワーク解析・著者プロファイル・論文推薦パイプライン
|
|
17
|
+
を提供する。
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
20
|
+
|
|
21
|
+
- 学術論文を高精度で検索するとき
|
|
22
|
+
- 引用・被引用ネットワークを解析するとき
|
|
23
|
+
- 著者の h-index・論文数・研究領域を調べるとき
|
|
24
|
+
- 関連論文の推薦を受けるとき
|
|
25
|
+
- TLDR (自動要約) を取得するとき
|
|
26
|
+
- 特定分野の引用傾向を分析するとき
|
|
27
|
+
- PubMed/OpenAlex 以外の学術検索エンジンを使うとき
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
## 1. 論文検索
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import requests
|
|
37
|
+
import pandas as pd
|
|
38
|
+
|
|
39
|
+
S2_BASE = "https://api.semanticscholar.org/graph/v1"
|
|
40
|
+
S2_HEADERS = {} # API key: {"x-api-key": "YOUR_KEY"}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def semantic_scholar_search(query, limit=50,
|
|
44
|
+
year_range=None,
|
|
45
|
+
fields_of_study=None):
|
|
46
|
+
"""
|
|
47
|
+
Semantic Scholar — 論文検索。
|
|
48
|
+
|
|
49
|
+
Parameters:
|
|
50
|
+
query: str — 検索クエリ
|
|
51
|
+
limit: int — 最大結果数
|
|
52
|
+
year_range: str — 年範囲 (例: "2020-2024")
|
|
53
|
+
fields_of_study: list[str] — 分野フィルタ
|
|
54
|
+
"""
|
|
55
|
+
url = f"{S2_BASE}/paper/search"
|
|
56
|
+
params = {
|
|
57
|
+
"query": query,
|
|
58
|
+
"limit": min(limit, 100),
|
|
59
|
+
"fields": ("paperId,title,year,citationCount,"
|
|
60
|
+
"influentialCitationCount,authors,"
|
|
61
|
+
"journal,tldr,openAccessPdf,fieldsOfStudy"),
|
|
62
|
+
}
|
|
63
|
+
if year_range:
|
|
64
|
+
params["year"] = year_range
|
|
65
|
+
if fields_of_study:
|
|
66
|
+
params["fieldsOfStudy"] = ",".join(fields_of_study)
|
|
67
|
+
|
|
68
|
+
resp = requests.get(url, params=params,
|
|
69
|
+
headers=S2_HEADERS, timeout=30)
|
|
70
|
+
resp.raise_for_status()
|
|
71
|
+
data = resp.json()
|
|
72
|
+
|
|
73
|
+
results = []
|
|
74
|
+
for p in data.get("data", []):
|
|
75
|
+
authors = [a.get("name", "") for a in p.get("authors", [])]
|
|
76
|
+
tldr_text = ""
|
|
77
|
+
if p.get("tldr"):
|
|
78
|
+
tldr_text = p["tldr"].get("text", "")
|
|
79
|
+
results.append({
|
|
80
|
+
"paper_id": p.get("paperId", ""),
|
|
81
|
+
"title": p.get("title", ""),
|
|
82
|
+
"year": p.get("year"),
|
|
83
|
+
"citation_count": p.get("citationCount", 0),
|
|
84
|
+
"influential_citations": p.get(
|
|
85
|
+
"influentialCitationCount", 0),
|
|
86
|
+
"authors": "; ".join(authors[:5]),
|
|
87
|
+
"journal": (p.get("journal") or {}).get("name", ""),
|
|
88
|
+
"fields": ", ".join(p.get("fieldsOfStudy") or []),
|
|
89
|
+
"tldr": tldr_text[:300],
|
|
90
|
+
"pdf_url": (p.get("openAccessPdf") or {}).get("url", ""),
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
df = pd.DataFrame(results)
|
|
94
|
+
print(f"Semantic Scholar: {len(df)} papers "
|
|
95
|
+
f"(query='{query}')")
|
|
96
|
+
return df
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def semantic_scholar_get_paper(paper_id):
|
|
100
|
+
"""
|
|
101
|
+
Semantic Scholar — 論文詳細取得。
|
|
102
|
+
|
|
103
|
+
Parameters:
|
|
104
|
+
paper_id: str — S2 Paper ID / DOI / ArXiv ID
|
|
105
|
+
"""
|
|
106
|
+
url = f"{S2_BASE}/paper/{paper_id}"
|
|
107
|
+
params = {
|
|
108
|
+
"fields": ("paperId,title,year,abstract,citationCount,"
|
|
109
|
+
"influentialCitationCount,authors,references,"
|
|
110
|
+
"citations,journal,tldr,openAccessPdf,"
|
|
111
|
+
"fieldsOfStudy,publicationDate,venue"),
|
|
112
|
+
}
|
|
113
|
+
resp = requests.get(url, params=params,
|
|
114
|
+
headers=S2_HEADERS, timeout=30)
|
|
115
|
+
resp.raise_for_status()
|
|
116
|
+
return resp.json()
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 2. 著者プロファイル・引用解析
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
def semantic_scholar_author(author_id, paper_limit=100):
|
|
123
|
+
"""
|
|
124
|
+
Semantic Scholar — 著者プロファイル取得。
|
|
125
|
+
|
|
126
|
+
Parameters:
|
|
127
|
+
author_id: str — S2 Author ID
|
|
128
|
+
paper_limit: int — 取得論文数上限
|
|
129
|
+
"""
|
|
130
|
+
url = f"{S2_BASE}/author/{author_id}"
|
|
131
|
+
params = {
|
|
132
|
+
"fields": ("authorId,name,affiliations,homepage,"
|
|
133
|
+
"paperCount,citationCount,hIndex"),
|
|
134
|
+
}
|
|
135
|
+
resp = requests.get(url, params=params,
|
|
136
|
+
headers=S2_HEADERS, timeout=30)
|
|
137
|
+
resp.raise_for_status()
|
|
138
|
+
profile = resp.json()
|
|
139
|
+
|
|
140
|
+
# 論文一覧
|
|
141
|
+
papers_url = f"{S2_BASE}/author/{author_id}/papers"
|
|
142
|
+
p_params = {
|
|
143
|
+
"fields": "paperId,title,year,citationCount,venue",
|
|
144
|
+
"limit": min(paper_limit, 1000),
|
|
145
|
+
}
|
|
146
|
+
p_resp = requests.get(papers_url, params=p_params,
|
|
147
|
+
headers=S2_HEADERS, timeout=30)
|
|
148
|
+
p_resp.raise_for_status()
|
|
149
|
+
|
|
150
|
+
papers = []
|
|
151
|
+
for p in p_resp.json().get("data", []):
|
|
152
|
+
papers.append({
|
|
153
|
+
"paper_id": p.get("paperId", ""),
|
|
154
|
+
"title": p.get("title", ""),
|
|
155
|
+
"year": p.get("year"),
|
|
156
|
+
"citations": p.get("citationCount", 0),
|
|
157
|
+
"venue": p.get("venue", ""),
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
papers_df = pd.DataFrame(papers)
|
|
161
|
+
|
|
162
|
+
print(f"Author {profile.get('name', '')}: "
|
|
163
|
+
f"h-index={profile.get('hIndex', 0)}, "
|
|
164
|
+
f"{profile.get('paperCount', 0)} papers, "
|
|
165
|
+
f"{profile.get('citationCount', 0)} citations")
|
|
166
|
+
return profile, papers_df
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 3. 引用ネットワーク・影響度分析
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
def semantic_scholar_citation_graph(paper_id,
|
|
173
|
+
direction="both",
|
|
174
|
+
limit=100):
|
|
175
|
+
"""
|
|
176
|
+
Semantic Scholar — 引用グラフ取得。
|
|
177
|
+
|
|
178
|
+
Parameters:
|
|
179
|
+
paper_id: str — S2 Paper ID
|
|
180
|
+
direction: str — "citations", "references", "both"
|
|
181
|
+
limit: int — 各方向の上限
|
|
182
|
+
"""
|
|
183
|
+
graphs = {}
|
|
184
|
+
fields = "paperId,title,year,citationCount,authors"
|
|
185
|
+
|
|
186
|
+
if direction in ("citations", "both"):
|
|
187
|
+
url = f"{S2_BASE}/paper/{paper_id}/citations"
|
|
188
|
+
resp = requests.get(url, params={"fields": fields,
|
|
189
|
+
"limit": limit},
|
|
190
|
+
headers=S2_HEADERS, timeout=30)
|
|
191
|
+
resp.raise_for_status()
|
|
192
|
+
cites = []
|
|
193
|
+
for c in resp.json().get("data", []):
|
|
194
|
+
cp = c.get("citingPaper", {})
|
|
195
|
+
cites.append({
|
|
196
|
+
"paper_id": cp.get("paperId", ""),
|
|
197
|
+
"title": cp.get("title", ""),
|
|
198
|
+
"year": cp.get("year"),
|
|
199
|
+
"citations": cp.get("citationCount", 0),
|
|
200
|
+
})
|
|
201
|
+
graphs["citations"] = pd.DataFrame(cites)
|
|
202
|
+
|
|
203
|
+
if direction in ("references", "both"):
|
|
204
|
+
url = f"{S2_BASE}/paper/{paper_id}/references"
|
|
205
|
+
resp = requests.get(url, params={"fields": fields,
|
|
206
|
+
"limit": limit},
|
|
207
|
+
headers=S2_HEADERS, timeout=30)
|
|
208
|
+
resp.raise_for_status()
|
|
209
|
+
refs = []
|
|
210
|
+
for r in resp.json().get("data", []):
|
|
211
|
+
rp = r.get("citedPaper", {})
|
|
212
|
+
refs.append({
|
|
213
|
+
"paper_id": rp.get("paperId", ""),
|
|
214
|
+
"title": rp.get("title", ""),
|
|
215
|
+
"year": rp.get("year"),
|
|
216
|
+
"citations": rp.get("citationCount", 0),
|
|
217
|
+
})
|
|
218
|
+
graphs["references"] = pd.DataFrame(refs)
|
|
219
|
+
|
|
220
|
+
for k, v in graphs.items():
|
|
221
|
+
print(f" {k}: {len(v)} papers")
|
|
222
|
+
return graphs
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## 4. 学術文献統合パイプライン
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
def semantic_scholar_pipeline(query, year_range=None,
|
|
229
|
+
output_dir="results"):
|
|
230
|
+
"""
|
|
231
|
+
Semantic Scholar 統合パイプライン。
|
|
232
|
+
|
|
233
|
+
Parameters:
|
|
234
|
+
query: str — 検索クエリ
|
|
235
|
+
year_range: str — 年範囲
|
|
236
|
+
output_dir: str — 出力ディレクトリ
|
|
237
|
+
"""
|
|
238
|
+
from pathlib import Path
|
|
239
|
+
output_dir = Path(output_dir)
|
|
240
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
241
|
+
|
|
242
|
+
# 1) 論文検索
|
|
243
|
+
papers = semantic_scholar_search(query,
|
|
244
|
+
year_range=year_range)
|
|
245
|
+
papers.to_csv(output_dir / "papers.csv", index=False)
|
|
246
|
+
|
|
247
|
+
# 2) トップ被引用論文の引用グラフ
|
|
248
|
+
if not papers.empty:
|
|
249
|
+
top = papers.sort_values("citation_count",
|
|
250
|
+
ascending=False).iloc[0]
|
|
251
|
+
pid = top["paper_id"]
|
|
252
|
+
graphs = semantic_scholar_citation_graph(pid)
|
|
253
|
+
for k, df in graphs.items():
|
|
254
|
+
df.to_csv(output_dir / f"{k}.csv", index=False)
|
|
255
|
+
|
|
256
|
+
# 3) 年次引用傾向
|
|
257
|
+
if not papers.empty and "year" in papers.columns:
|
|
258
|
+
yearly = papers.groupby("year").agg(
|
|
259
|
+
papers_count=("paper_id", "count"),
|
|
260
|
+
total_citations=("citation_count", "sum"),
|
|
261
|
+
avg_citations=("citation_count", "mean"),
|
|
262
|
+
).reset_index()
|
|
263
|
+
yearly.to_csv(output_dir / "yearly_trend.csv",
|
|
264
|
+
index=False)
|
|
265
|
+
|
|
266
|
+
print(f"Semantic Scholar pipeline: {output_dir}")
|
|
267
|
+
return {"papers": papers}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## ToolUniverse 連携
|
|
273
|
+
|
|
274
|
+
| TU Key | ツール名 | 連携内容 |
|
|
275
|
+
|--------|---------|---------|
|
|
276
|
+
| `semantic_scholar` | Semantic Scholar | 論文検索・引用解析・著者・TLDR |
|
|
277
|
+
|
|
278
|
+
## パイプライン統合
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
literature-search → semantic-scholar → deep-research
|
|
282
|
+
(PubMed/NCBI) (Academic Graph API) (knowledge synthesis)
|
|
283
|
+
│ │ ↓
|
|
284
|
+
crossref-metadata ─────┘ citation-checker
|
|
285
|
+
(DOI/metadata) │ (引用品質検証)
|
|
286
|
+
↓
|
|
287
|
+
gene-expression-transcriptomics
|
|
288
|
+
(論文引用データからの解析)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## パイプライン出力
|
|
292
|
+
|
|
293
|
+
| ファイル | 説明 | 次スキル |
|
|
294
|
+
|---------|------|---------|
|
|
295
|
+
| `results/papers.csv` | 論文検索結果 | → deep-research |
|
|
296
|
+
| `results/citations.csv` | 被引用論文 | → citation-checker |
|
|
297
|
+
| `results/references.csv` | 引用論文 | → meta-analysis |
|
|
298
|
+
| `results/yearly_trend.csv` | 年次引用傾向 | → bibliometrics |
|