@nahisaho/satori 0.11.0 → 0.12.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 +111 -45
- package/package.json +1 -1
- package/src/.github/skills/scientific-admet-pharmacokinetics/SKILL.md +1 -0
- package/src/.github/skills/scientific-cancer-genomics/SKILL.md +287 -0
- package/src/.github/skills/scientific-clinical-decision-support/SKILL.md +2 -0
- package/src/.github/skills/scientific-clinical-reporting/SKILL.md +324 -0
- package/src/.github/skills/scientific-computational-materials/SKILL.md +4 -4
- package/src/.github/skills/scientific-deep-learning/SKILL.md +1 -0
- package/src/.github/skills/scientific-epidemiology-public-health/SKILL.md +1 -0
- package/src/.github/skills/scientific-grant-writing/SKILL.md +2 -0
- package/src/.github/skills/scientific-lab-data-management/SKILL.md +2 -2
- package/src/.github/skills/scientific-literature-search/SKILL.md +443 -0
- package/src/.github/skills/scientific-meta-analysis/SKILL.md +10 -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-pathway-enrichment/SKILL.md +449 -0
- package/src/.github/skills/scientific-pharmacovigilance/SKILL.md +3 -0
- package/src/.github/skills/scientific-population-genetics/SKILL.md +2 -0
- package/src/.github/skills/scientific-precision-oncology/SKILL.md +1 -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-scientific-schematics/SKILL.md +2 -2
- package/src/.github/skills/scientific-single-cell-genomics/SKILL.md +2 -0
- package/src/.github/skills/scientific-survival-clinical/SKILL.md +11 -0
- package/src/.github/skills/scientific-systematic-review/SKILL.md +361 -0
- package/src/.github/skills/scientific-variant-effect-prediction/SKILL.md +325 -0
- package/src/.github/skills/scientific-variant-interpretation/SKILL.md +1 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-cancer-genomics
|
|
3
|
+
description: |
|
|
4
|
+
がんゲノミクスポータル統合スキル。COSMIC (体細胞変異カタログ)、
|
|
5
|
+
cBioPortal (がんゲノミクスデータ解析)、DepMap (がん細胞依存性) の
|
|
6
|
+
3 大がんゲノミクスデータベースを統合した変異プロファイリング、
|
|
7
|
+
変異シグネチャー解析、遺伝子依存性 (essentiality) 評価、
|
|
8
|
+
コピー数変化・がん種横断解析パイプライン。
|
|
9
|
+
13 の ToolUniverse SMCP ツールと連携。
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Scientific Cancer Genomics
|
|
13
|
+
|
|
14
|
+
COSMIC / cBioPortal / DepMap の 3 大がんゲノミクスポータルを統合した
|
|
15
|
+
体細胞変異プロファイリング・機能解析パイプラインを提供する。
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- がん関連遺伝子の体細胞変異をカタログ検索するとき
|
|
20
|
+
- cBioPortal でがん種横断の遺伝子変異頻度を調べるとき
|
|
21
|
+
- DepMap で遺伝子依存性 (essentiality) を評価するとき
|
|
22
|
+
- 変異シグネチャー解析 (SBS/DBS/ID) を行うとき
|
|
23
|
+
- コピー数変化 (CNA) のドライバー・パッセンジャー分類が必要なとき
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
## 1. COSMIC 体細胞変異検索
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import pandas as pd
|
|
33
|
+
import numpy as np
|
|
34
|
+
import requests
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def cosmic_search_mutations(gene, cancer_type=None, mutation_type=None):
|
|
38
|
+
"""
|
|
39
|
+
COSMIC (Catalogue Of Somatic Mutations In Cancer) 変異検索。
|
|
40
|
+
|
|
41
|
+
Parameters:
|
|
42
|
+
gene: str — 遺伝子シンボル (e.g., "BRAF", "TP53")
|
|
43
|
+
cancer_type: str — がん種フィルタ (e.g., "melanoma")
|
|
44
|
+
mutation_type: str — 変異タイプ ("missense", "nonsense", "frameshift")
|
|
45
|
+
"""
|
|
46
|
+
# ToolUniverse 経由: COSMIC_search_mutations, COSMIC_get_mutations_by_gene
|
|
47
|
+
# COSMIC API は認証が必要 (Academic 無料)
|
|
48
|
+
|
|
49
|
+
# Cancer Gene Census (CGC) チェック
|
|
50
|
+
cgc_genes = {
|
|
51
|
+
"TP53": {"role": "TSG", "tier": 1},
|
|
52
|
+
"BRAF": {"role": "oncogene", "tier": 1},
|
|
53
|
+
"KRAS": {"role": "oncogene", "tier": 1},
|
|
54
|
+
"EGFR": {"role": "oncogene", "tier": 1},
|
|
55
|
+
"PIK3CA": {"role": "oncogene", "tier": 1},
|
|
56
|
+
"BRCA1": {"role": "TSG", "tier": 1},
|
|
57
|
+
"BRCA2": {"role": "TSG", "tier": 1},
|
|
58
|
+
"ALK": {"role": "oncogene", "tier": 1},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
gene_info = cgc_genes.get(gene.upper(), {})
|
|
62
|
+
|
|
63
|
+
result = {
|
|
64
|
+
"gene": gene,
|
|
65
|
+
"cgc_role": gene_info.get("role", "unknown"),
|
|
66
|
+
"cgc_tier": gene_info.get("tier", None),
|
|
67
|
+
"cancer_type_filter": cancer_type,
|
|
68
|
+
"mutation_type_filter": mutation_type,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
print(f"COSMIC query: {gene} "
|
|
72
|
+
f"(CGC: {gene_info.get('role', 'N/A')}, "
|
|
73
|
+
f"Tier {gene_info.get('tier', 'N/A')})")
|
|
74
|
+
return result
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 2. cBioPortal がんゲノミクスデータ取得
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
def cbioportal_query(genes, study_id=None, cancer_type=None,
|
|
81
|
+
data_types=None):
|
|
82
|
+
"""
|
|
83
|
+
cBioPortal REST API によるがんゲノミクスデータ取得。
|
|
84
|
+
|
|
85
|
+
Parameters:
|
|
86
|
+
genes: list — 遺伝子シンボルリスト
|
|
87
|
+
study_id: str — cBioPortal 研究 ID (e.g., "tcga_brca_pan_can_atlas_2018")
|
|
88
|
+
cancer_type: str — がん種 (e.g., "Breast Cancer")
|
|
89
|
+
data_types: list — ["mutations", "cna", "mrna", "methylation"]
|
|
90
|
+
"""
|
|
91
|
+
base_url = "https://www.cbioportal.org/api"
|
|
92
|
+
|
|
93
|
+
if data_types is None:
|
|
94
|
+
data_types = ["mutations", "cna"]
|
|
95
|
+
|
|
96
|
+
results = {}
|
|
97
|
+
|
|
98
|
+
# 研究一覧取得
|
|
99
|
+
if study_id is None:
|
|
100
|
+
resp = requests.get(f"{base_url}/studies")
|
|
101
|
+
studies = resp.json()
|
|
102
|
+
if cancer_type:
|
|
103
|
+
studies = [s for s in studies
|
|
104
|
+
if cancer_type.lower() in
|
|
105
|
+
s.get("cancerType", {}).get("name", "").lower()]
|
|
106
|
+
print(f"cBioPortal: {len(studies)} studies for '{cancer_type}'")
|
|
107
|
+
results["studies"] = pd.DataFrame([{
|
|
108
|
+
"study_id": s["studyId"],
|
|
109
|
+
"name": s["name"],
|
|
110
|
+
"cancer_type": s.get("cancerType", {}).get("name", ""),
|
|
111
|
+
"sample_count": s.get("allSampleCount", 0),
|
|
112
|
+
} for s in studies[:20]])
|
|
113
|
+
else:
|
|
114
|
+
# 変異データ取得
|
|
115
|
+
if "mutations" in data_types:
|
|
116
|
+
url = f"{base_url}/molecular-profiles/{study_id}_mutations/mutations"
|
|
117
|
+
params = {"projection": "DETAILED"}
|
|
118
|
+
resp = requests.get(url, params=params)
|
|
119
|
+
if resp.status_code == 200:
|
|
120
|
+
mutations = resp.json()
|
|
121
|
+
mut_df = pd.DataFrame([{
|
|
122
|
+
"gene": m.get("gene", {}).get("hugoGeneSymbol", ""),
|
|
123
|
+
"mutation": m.get("proteinChange", ""),
|
|
124
|
+
"mutation_type": m.get("mutationType", ""),
|
|
125
|
+
"chromosome": m.get("chr", ""),
|
|
126
|
+
"position": m.get("startPosition", ""),
|
|
127
|
+
"allele_freq": m.get("tumorAltCount", 0) /
|
|
128
|
+
max(m.get("tumorRefCount", 1) +
|
|
129
|
+
m.get("tumorAltCount", 1), 1),
|
|
130
|
+
} for m in mutations
|
|
131
|
+
if m.get("gene", {}).get("hugoGeneSymbol", "") in genes])
|
|
132
|
+
results["mutations"] = mut_df
|
|
133
|
+
print(f" Mutations: {len(mut_df)} found in {genes}")
|
|
134
|
+
|
|
135
|
+
return results
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 3. DepMap 遺伝子依存性解析
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
def depmap_gene_dependency(genes, cell_lineage=None):
|
|
142
|
+
"""
|
|
143
|
+
DepMap (Cancer Dependency Map) 遺伝子依存性解析。
|
|
144
|
+
|
|
145
|
+
Parameters:
|
|
146
|
+
genes: list — 遺伝子シンボルリスト
|
|
147
|
+
cell_lineage: str — 細胞系統フィルタ (e.g., "Lung", "Breast")
|
|
148
|
+
"""
|
|
149
|
+
# ToolUniverse 経由:
|
|
150
|
+
# DepMap_search_genes, DepMap_get_gene_dependencies
|
|
151
|
+
# DepMap_get_cell_line, DepMap_get_cell_lines, DepMap_search_cell_lines
|
|
152
|
+
|
|
153
|
+
# DepMap CRISPR (Chronos) dependency score:
|
|
154
|
+
# negative = essential (依存), ~0 = non-essential
|
|
155
|
+
# Common Essential: mean < -0.5 across 90% of lines
|
|
156
|
+
# Selective Dependency: mean < -0.5 in specific lineages
|
|
157
|
+
|
|
158
|
+
results = []
|
|
159
|
+
for gene in genes:
|
|
160
|
+
result = {
|
|
161
|
+
"gene": gene,
|
|
162
|
+
"cell_lineage": cell_lineage,
|
|
163
|
+
"query_type": "CRISPR_dependency",
|
|
164
|
+
# 実際のスコアは ToolUniverse 経由で取得
|
|
165
|
+
"interpretation": (
|
|
166
|
+
"Chronos score < 0: gene essentiality increases. "
|
|
167
|
+
"score < -0.5: likely essential in this lineage. "
|
|
168
|
+
"score ~ 0: non-essential."
|
|
169
|
+
),
|
|
170
|
+
}
|
|
171
|
+
results.append(result)
|
|
172
|
+
|
|
173
|
+
df = pd.DataFrame(results)
|
|
174
|
+
print(f"DepMap: queried {len(genes)} genes "
|
|
175
|
+
f"(lineage: {cell_lineage or 'pan-cancer'})")
|
|
176
|
+
return df
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 4. 変異シグネチャー解析
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
def mutational_signature_analysis(mutations_df, genome="GRCh38",
|
|
183
|
+
n_signatures=None):
|
|
184
|
+
"""
|
|
185
|
+
体細胞変異シグネチャー解析 (COSMIC SBS signatures)。
|
|
186
|
+
|
|
187
|
+
Parameters:
|
|
188
|
+
mutations_df: DataFrame — columns: [chr, pos, ref, alt, sample]
|
|
189
|
+
genome: str — 参照ゲノム
|
|
190
|
+
n_signatures: int — 抽出シグネチャー数 (None=自動推定)
|
|
191
|
+
"""
|
|
192
|
+
from itertools import product
|
|
193
|
+
|
|
194
|
+
# 96 トリヌクレオチドコンテキスト
|
|
195
|
+
bases = ["C", "T"]
|
|
196
|
+
contexts = []
|
|
197
|
+
for ref in bases:
|
|
198
|
+
for alt in ["A", "C", "G", "T"]:
|
|
199
|
+
if ref == alt:
|
|
200
|
+
continue
|
|
201
|
+
for five in "ACGT":
|
|
202
|
+
for three in "ACGT":
|
|
203
|
+
contexts.append(f"{five}[{ref}>{alt}]{three}")
|
|
204
|
+
|
|
205
|
+
# サンプルごとのカタログ構築
|
|
206
|
+
samples = mutations_df["sample"].unique()
|
|
207
|
+
catalog = pd.DataFrame(0, index=contexts, columns=samples)
|
|
208
|
+
|
|
209
|
+
for _, row in mutations_df.iterrows():
|
|
210
|
+
ref = row["ref"]
|
|
211
|
+
alt = row["alt"]
|
|
212
|
+
sample = row["sample"]
|
|
213
|
+
context = row.get("trinucleotide_context", "N[N>N]N")
|
|
214
|
+
if context in catalog.index:
|
|
215
|
+
catalog.loc[context, sample] += 1
|
|
216
|
+
|
|
217
|
+
print(f"Mutation catalog: {len(contexts)} contexts, "
|
|
218
|
+
f"{len(samples)} samples, "
|
|
219
|
+
f"{catalog.sum().sum():.0f} total mutations")
|
|
220
|
+
|
|
221
|
+
# NMF 分解 (SigProfilerExtractor 代替)
|
|
222
|
+
from sklearn.decomposition import NMF
|
|
223
|
+
|
|
224
|
+
X = catalog.values.T # samples × contexts
|
|
225
|
+
if n_signatures is None:
|
|
226
|
+
n_signatures = min(5, len(samples))
|
|
227
|
+
|
|
228
|
+
model = NMF(n_components=n_signatures, random_state=42, max_iter=1000)
|
|
229
|
+
W = model.fit_transform(X) # exposure matrix
|
|
230
|
+
H = model.components_ # signature profiles
|
|
231
|
+
|
|
232
|
+
signatures = pd.DataFrame(H.T, index=contexts,
|
|
233
|
+
columns=[f"SBS_{i+1}" for i in range(n_signatures)])
|
|
234
|
+
exposures = pd.DataFrame(W, index=samples,
|
|
235
|
+
columns=[f"SBS_{i+1}" for i in range(n_signatures)])
|
|
236
|
+
|
|
237
|
+
print(f"Extracted {n_signatures} mutational signatures")
|
|
238
|
+
return signatures, exposures
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## References
|
|
242
|
+
|
|
243
|
+
### Output Files
|
|
244
|
+
|
|
245
|
+
| ファイル | 形式 |
|
|
246
|
+
|---|---|
|
|
247
|
+
| `results/cosmic_mutations.csv` | CSV |
|
|
248
|
+
| `results/cbioportal_mutations.csv` | CSV |
|
|
249
|
+
| `results/depmap_dependencies.csv` | CSV |
|
|
250
|
+
| `results/mutation_signatures.csv` | CSV |
|
|
251
|
+
| `results/signature_exposures.csv` | CSV |
|
|
252
|
+
| `figures/mutation_spectrum.png` | PNG |
|
|
253
|
+
| `figures/signature_profiles.png` | PNG |
|
|
254
|
+
|
|
255
|
+
### 利用可能ツール
|
|
256
|
+
|
|
257
|
+
> [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
|
|
258
|
+
|
|
259
|
+
| カテゴリ | 主要ツール | 用途 |
|
|
260
|
+
|---|---|---|
|
|
261
|
+
| COSMIC | `COSMIC_search_mutations` | 体細胞変異検索 |
|
|
262
|
+
| COSMIC | `COSMIC_get_mutations_by_gene` | 遺伝子別変異取得 |
|
|
263
|
+
| cBioPortal | `cBioPortal_get_cancer_studies` | がん研究一覧 |
|
|
264
|
+
| cBioPortal | `cBioPortal_get_mutations` | 変異データ取得 |
|
|
265
|
+
| cBioPortal | `cBioPortal_get_molecular_profiles` | 分子プロファイル |
|
|
266
|
+
| cBioPortal | `cBioPortal_get_patients` | 患者データ取得 |
|
|
267
|
+
| cBioPortal | `cBioPortal_get_sample_lists` | サンプルリスト |
|
|
268
|
+
| cBioPortal | `cBioPortal_get_samples` | サンプル詳細 |
|
|
269
|
+
| DepMap | `DepMap_get_gene_dependencies` | 遺伝子依存性スコア |
|
|
270
|
+
| DepMap | `DepMap_get_cell_line` | 細胞株情報 |
|
|
271
|
+
| DepMap | `DepMap_get_cell_lines` | 細胞株一覧 |
|
|
272
|
+
| DepMap | `DepMap_search_cell_lines` | 細胞株検索 |
|
|
273
|
+
| DepMap | `DepMap_search_genes` | 遺伝子検索 |
|
|
274
|
+
|
|
275
|
+
### 参照スキル
|
|
276
|
+
|
|
277
|
+
| スキル | 関連 |
|
|
278
|
+
|---|---|
|
|
279
|
+
| `scientific-precision-oncology` | 腫瘍プロファイル → 治療選択 |
|
|
280
|
+
| `scientific-variant-interpretation` | バリアント臨床解釈 |
|
|
281
|
+
| `scientific-variant-effect-prediction` | 計算病原性予測 |
|
|
282
|
+
| `scientific-disease-research` | GWAS → がんリスク |
|
|
283
|
+
| `scientific-drug-target-profiling` | 標的同定 → 依存性 |
|
|
284
|
+
|
|
285
|
+
### 依存パッケージ
|
|
286
|
+
|
|
287
|
+
`pandas`, `numpy`, `requests`, `scikit-learn`, `matplotlib`
|
|
@@ -300,3 +300,5 @@ Clinical decisions must be made by qualified healthcare professionals.
|
|
|
300
300
|
| `scientific-deep-research` | ← 最新エビデンスの収集 |
|
|
301
301
|
| `scientific-presentation-design` | → 臨床結果のプレゼンテーション |
|
|
302
302
|
| `scientific-academic-writing` | → 研究成果の論文化 |
|
|
303
|
+
| `scientific-clinical-trials-analytics` | ← 臨床試験マッチング・競合解析 |
|
|
304
|
+
| `scientific-pharmacogenomics` | ← PGx バイオマーカー・投与量調整 |
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-clinical-reporting
|
|
3
|
+
description: |
|
|
4
|
+
臨床レポート自動生成スキル。検査結果サマリー (SOAP ノート)、バイオマーカー
|
|
5
|
+
プロファイルレポート、薬理ゲノミクスレポート、臨床試験要約を構造化テンプレート
|
|
6
|
+
(PDF/LaTeX/HTML) で出力。HL7 FHIR DiagnosticReport 形式にも対応。
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Scientific Clinical Reporting
|
|
10
|
+
|
|
11
|
+
臨床データから構造化レポートを自動生成するパイプラインを提供する。
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- 検査結果を SOAP ノート形式でまとめるとき
|
|
16
|
+
- バイオマーカープロファイルレポートを作成するとき
|
|
17
|
+
- ファーマコゲノミクスレポート (CPIC ガイドライン準拠) が必要なとき
|
|
18
|
+
- 臨床試験の CSR (Clinical Study Report) サマリーを生成するとき
|
|
19
|
+
- HL7 FHIR DiagnosticReport 形式で出力するとき
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
## 1. SOAP ノート生成
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import json
|
|
29
|
+
from datetime import datetime
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def generate_soap_note(patient_data, findings, assessment, plan):
|
|
33
|
+
"""
|
|
34
|
+
SOAP ノート形式の臨床レポートを生成。
|
|
35
|
+
|
|
36
|
+
Parameters:
|
|
37
|
+
patient_data: dict — {"id": "...", "age": 45, "sex": "M", ...}
|
|
38
|
+
findings: dict — {"subjective": [...], "objective": [...]}
|
|
39
|
+
assessment: list — 評価・診断リスト
|
|
40
|
+
plan: list — 治療計画リスト
|
|
41
|
+
"""
|
|
42
|
+
soap = {
|
|
43
|
+
"report_type": "SOAP_Note",
|
|
44
|
+
"generated_at": datetime.now().isoformat(),
|
|
45
|
+
"patient": {
|
|
46
|
+
"id": patient_data.get("id", "ANON"),
|
|
47
|
+
"age": patient_data.get("age"),
|
|
48
|
+
"sex": patient_data.get("sex"),
|
|
49
|
+
},
|
|
50
|
+
"S": { # Subjective
|
|
51
|
+
"chief_complaint": findings.get("chief_complaint", ""),
|
|
52
|
+
"history": findings.get("subjective", []),
|
|
53
|
+
},
|
|
54
|
+
"O": { # Objective
|
|
55
|
+
"vitals": findings.get("vitals", {}),
|
|
56
|
+
"lab_results": findings.get("lab_results", []),
|
|
57
|
+
"imaging": findings.get("imaging", []),
|
|
58
|
+
"physical_exam": findings.get("objective", []),
|
|
59
|
+
},
|
|
60
|
+
"A": { # Assessment
|
|
61
|
+
"diagnoses": assessment,
|
|
62
|
+
"differential": findings.get("differential", []),
|
|
63
|
+
},
|
|
64
|
+
"P": { # Plan
|
|
65
|
+
"treatment": plan,
|
|
66
|
+
"follow_up": findings.get("follow_up", ""),
|
|
67
|
+
"referrals": findings.get("referrals", []),
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
print(f"SOAP note: patient={soap['patient']['id']}, "
|
|
72
|
+
f"diagnoses={len(assessment)}, plans={len(plan)}")
|
|
73
|
+
return soap
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 2. バイオマーカープロファイルレポート
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import pandas as pd
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def biomarker_profile_report(biomarkers_df, reference_ranges=None):
|
|
83
|
+
"""
|
|
84
|
+
バイオマーカープロファイルレポート生成。
|
|
85
|
+
|
|
86
|
+
Parameters:
|
|
87
|
+
biomarkers_df: DataFrame — columns: [marker, value, unit, specimen]
|
|
88
|
+
reference_ranges: dict — {"marker": {"low": x, "high": y, "unit": "..."}}
|
|
89
|
+
"""
|
|
90
|
+
if reference_ranges is None:
|
|
91
|
+
reference_ranges = {
|
|
92
|
+
"CEA": {"low": 0, "high": 5.0, "unit": "ng/mL"},
|
|
93
|
+
"AFP": {"low": 0, "high": 10.0, "unit": "ng/mL"},
|
|
94
|
+
"CA19-9": {"low": 0, "high": 37.0, "unit": "U/mL"},
|
|
95
|
+
"CA125": {"low": 0, "high": 35.0, "unit": "U/mL"},
|
|
96
|
+
"PSA": {"low": 0, "high": 4.0, "unit": "ng/mL"},
|
|
97
|
+
"HER2": {"low": 0, "high": 1, "unit": "IHC score"},
|
|
98
|
+
"Ki-67": {"low": 0, "high": 14, "unit": "%"},
|
|
99
|
+
"PD-L1 TPS": {"low": 0, "high": 1, "unit": "%"},
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
results = []
|
|
103
|
+
for _, row in biomarkers_df.iterrows():
|
|
104
|
+
marker = row["marker"]
|
|
105
|
+
value = float(row["value"])
|
|
106
|
+
ref = reference_ranges.get(marker, {})
|
|
107
|
+
|
|
108
|
+
status = "normal"
|
|
109
|
+
if ref:
|
|
110
|
+
if value > ref.get("high", float("inf")):
|
|
111
|
+
status = "HIGH"
|
|
112
|
+
elif value < ref.get("low", float("-inf")):
|
|
113
|
+
status = "LOW"
|
|
114
|
+
|
|
115
|
+
results.append({
|
|
116
|
+
"marker": marker,
|
|
117
|
+
"value": value,
|
|
118
|
+
"unit": row.get("unit", ref.get("unit", "")),
|
|
119
|
+
"reference": f"{ref.get('low', '?')}-{ref.get('high', '?')}",
|
|
120
|
+
"status": status,
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
report_df = pd.DataFrame(results)
|
|
124
|
+
abnormal = report_df[report_df["status"] != "normal"]
|
|
125
|
+
|
|
126
|
+
report = {
|
|
127
|
+
"report_type": "Biomarker_Profile",
|
|
128
|
+
"total_markers": len(report_df),
|
|
129
|
+
"abnormal_count": len(abnormal),
|
|
130
|
+
"results": report_df.to_dict("records"),
|
|
131
|
+
"summary": (
|
|
132
|
+
f"{len(abnormal)} of {len(report_df)} markers outside reference range"
|
|
133
|
+
if len(abnormal) > 0
|
|
134
|
+
else "All markers within reference range"
|
|
135
|
+
),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
print(f"Biomarker profile: {len(report_df)} markers, "
|
|
139
|
+
f"{len(abnormal)} abnormal")
|
|
140
|
+
return report
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 3. ファーマコゲノミクスレポート
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
def pharmacogenomics_report(genotypes, medications):
|
|
147
|
+
"""
|
|
148
|
+
CPIC ガイドライン準拠のファーマコゲノミクスレポート。
|
|
149
|
+
|
|
150
|
+
Parameters:
|
|
151
|
+
genotypes: dict — {"CYP2D6": "*1/*4", "CYP2C19": "*1/*2", ...}
|
|
152
|
+
medications: list — ["codeine", "clopidogrel", ...]
|
|
153
|
+
"""
|
|
154
|
+
# CPIC phenotype マッピング (簡略)
|
|
155
|
+
cpic_phenotypes = {
|
|
156
|
+
"CYP2D6": {
|
|
157
|
+
"*1/*1": "Normal Metabolizer",
|
|
158
|
+
"*1/*4": "Intermediate Metabolizer",
|
|
159
|
+
"*4/*4": "Poor Metabolizer",
|
|
160
|
+
"*1/*2xN": "Ultrarapid Metabolizer",
|
|
161
|
+
},
|
|
162
|
+
"CYP2C19": {
|
|
163
|
+
"*1/*1": "Normal Metabolizer",
|
|
164
|
+
"*1/*2": "Intermediate Metabolizer",
|
|
165
|
+
"*2/*2": "Poor Metabolizer",
|
|
166
|
+
"*1/*17": "Rapid Metabolizer",
|
|
167
|
+
"*17/*17": "Ultrarapid Metabolizer",
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
# 推奨アクション (簡略)
|
|
172
|
+
drug_gene_map = {
|
|
173
|
+
"codeine": {"gene": "CYP2D6", "action": {
|
|
174
|
+
"Poor Metabolizer": "AVOID — use alternative analgesic",
|
|
175
|
+
"Ultrarapid Metabolizer": "AVOID — toxicity risk",
|
|
176
|
+
"Intermediate Metabolizer": "Use with caution, consider alternative",
|
|
177
|
+
}},
|
|
178
|
+
"clopidogrel": {"gene": "CYP2C19", "action": {
|
|
179
|
+
"Poor Metabolizer": "Use alternative antiplatelet (e.g., prasugrel)",
|
|
180
|
+
"Intermediate Metabolizer": "Consider alternative antiplatelet",
|
|
181
|
+
}},
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
recommendations = []
|
|
185
|
+
for drug in medications:
|
|
186
|
+
entry = drug_gene_map.get(drug, {})
|
|
187
|
+
gene = entry.get("gene", "Unknown")
|
|
188
|
+
genotype = genotypes.get(gene, "Unknown")
|
|
189
|
+
phenotype_map = cpic_phenotypes.get(gene, {})
|
|
190
|
+
phenotype = phenotype_map.get(genotype, "Indeterminate")
|
|
191
|
+
|
|
192
|
+
action = entry.get("action", {}).get(phenotype, "Standard dosing")
|
|
193
|
+
recommendations.append({
|
|
194
|
+
"drug": drug,
|
|
195
|
+
"gene": gene,
|
|
196
|
+
"genotype": genotype,
|
|
197
|
+
"phenotype": phenotype,
|
|
198
|
+
"recommendation": action,
|
|
199
|
+
"cpic_level": "A" if drug in drug_gene_map else "N/A",
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
report = {
|
|
203
|
+
"report_type": "Pharmacogenomics",
|
|
204
|
+
"genotypes_tested": genotypes,
|
|
205
|
+
"medications_queried": medications,
|
|
206
|
+
"recommendations": recommendations,
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
print(f"PGx report: {len(genotypes)} genes, {len(medications)} drugs, "
|
|
210
|
+
f"{len(recommendations)} recommendations")
|
|
211
|
+
return report
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## 4. 構造化レポート出力 (LaTeX/HTML)
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
def export_clinical_report(report, output_format="html",
|
|
218
|
+
output_path="reports/clinical_report"):
|
|
219
|
+
"""
|
|
220
|
+
臨床レポートを LaTeX/HTML/FHIR JSON 形式で出力。
|
|
221
|
+
|
|
222
|
+
Parameters:
|
|
223
|
+
report: dict — SOAP, Biomarker, PGx レポート
|
|
224
|
+
output_format: "html", "latex", "fhir_json"
|
|
225
|
+
output_path: str — 出力先パス (拡張子なし)
|
|
226
|
+
"""
|
|
227
|
+
import os
|
|
228
|
+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
229
|
+
report_type = report.get("report_type", "Clinical")
|
|
230
|
+
|
|
231
|
+
if output_format == "html":
|
|
232
|
+
filepath = f"{output_path}.html"
|
|
233
|
+
html_parts = [
|
|
234
|
+
"<!DOCTYPE html><html><head>",
|
|
235
|
+
f"<title>{report_type} Report</title>",
|
|
236
|
+
"<style>body{font-family:Arial;margin:2em;}"
|
|
237
|
+
"table{border-collapse:collapse;width:100%;}"
|
|
238
|
+
"td,th{border:1px solid #ddd;padding:8px;}</style>",
|
|
239
|
+
"</head><body>",
|
|
240
|
+
f"<h1>{report_type} Report</h1>",
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
if report_type == "SOAP_Note":
|
|
244
|
+
for section in ["S", "O", "A", "P"]:
|
|
245
|
+
html_parts.append(f"<h2>{section}</h2>")
|
|
246
|
+
html_parts.append(f"<pre>{json.dumps(report.get(section, {}), indent=2, ensure_ascii=False)}</pre>")
|
|
247
|
+
|
|
248
|
+
elif report_type == "Biomarker_Profile":
|
|
249
|
+
html_parts.append("<table><tr><th>Marker</th><th>Value</th>"
|
|
250
|
+
"<th>Reference</th><th>Status</th></tr>")
|
|
251
|
+
for r in report.get("results", []):
|
|
252
|
+
status_color = "red" if r["status"] != "normal" else "green"
|
|
253
|
+
html_parts.append(
|
|
254
|
+
f"<tr><td>{r['marker']}</td><td>{r['value']} {r['unit']}</td>"
|
|
255
|
+
f"<td>{r['reference']}</td>"
|
|
256
|
+
f"<td style='color:{status_color}'>{r['status']}</td></tr>"
|
|
257
|
+
)
|
|
258
|
+
html_parts.append("</table>")
|
|
259
|
+
|
|
260
|
+
html_parts.append("</body></html>")
|
|
261
|
+
with open(filepath, "w") as f:
|
|
262
|
+
f.write("\n".join(html_parts))
|
|
263
|
+
|
|
264
|
+
elif output_format == "fhir_json":
|
|
265
|
+
filepath = f"{output_path}.fhir.json"
|
|
266
|
+
fhir = {
|
|
267
|
+
"resourceType": "DiagnosticReport",
|
|
268
|
+
"status": "final",
|
|
269
|
+
"category": [{"coding": [{"system": "http://terminology.hl7.org/CodeSystem/v2-0074",
|
|
270
|
+
"code": "LAB"}]}],
|
|
271
|
+
"code": {"text": report_type},
|
|
272
|
+
"issued": report.get("generated_at", datetime.now().isoformat()),
|
|
273
|
+
"result": [],
|
|
274
|
+
}
|
|
275
|
+
with open(filepath, "w") as f:
|
|
276
|
+
json.dump(fhir, f, indent=2)
|
|
277
|
+
|
|
278
|
+
elif output_format == "latex":
|
|
279
|
+
filepath = f"{output_path}.tex"
|
|
280
|
+
with open(filepath, "w") as f:
|
|
281
|
+
f.write(f"\\documentclass{{article}}\n")
|
|
282
|
+
f.write(f"\\title{{{report_type} Report}}\n")
|
|
283
|
+
f.write("\\begin{document}\n\\maketitle\n")
|
|
284
|
+
f.write(f"Report type: {report_type}\n")
|
|
285
|
+
f.write("\\end{document}\n")
|
|
286
|
+
|
|
287
|
+
print(f"Report exported: {filepath}")
|
|
288
|
+
return filepath
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## References
|
|
292
|
+
|
|
293
|
+
### Output Files
|
|
294
|
+
|
|
295
|
+
| ファイル | 形式 |
|
|
296
|
+
|---|---|
|
|
297
|
+
| `reports/soap_note.json` | JSON |
|
|
298
|
+
| `reports/biomarker_profile.json` | JSON |
|
|
299
|
+
| `reports/pgx_report.json` | JSON |
|
|
300
|
+
| `reports/clinical_report.html` | HTML |
|
|
301
|
+
| `reports/clinical_report.tex` | LaTeX |
|
|
302
|
+
| `reports/clinical_report.fhir.json` | FHIR JSON |
|
|
303
|
+
|
|
304
|
+
### 利用可能ツール
|
|
305
|
+
|
|
306
|
+
> 本スキルは ToolUniverse ツールに直接依存しない。
|
|
307
|
+
|
|
308
|
+
| カテゴリ | 主要ツール | 用途 |
|
|
309
|
+
|---|---|---|
|
|
310
|
+
| — | — | — |
|
|
311
|
+
|
|
312
|
+
### 参照スキル
|
|
313
|
+
|
|
314
|
+
| スキル | 関連 |
|
|
315
|
+
|---|---|
|
|
316
|
+
| `scientific-variant-interpretation` | バリアント解釈レポート |
|
|
317
|
+
| `scientific-variant-effect-prediction` | バリアント病原性スコア |
|
|
318
|
+
| `scientific-pharmacogenomics` | PGx ガイドライン |
|
|
319
|
+
| `scientific-precision-oncology` | 精密腫瘍学レポート |
|
|
320
|
+
| `scientific-disease-research` | 疾患情報統合 |
|
|
321
|
+
|
|
322
|
+
### 依存パッケージ
|
|
323
|
+
|
|
324
|
+
`pandas`, `json` (stdlib), `datetime` (stdlib)
|
|
@@ -343,10 +343,10 @@ def parse_vasp_output(vasprun_file="vasprun.xml"):
|
|
|
343
343
|
|
|
344
344
|
| スキル | 関連 |
|
|
345
345
|
|---|---|
|
|
346
|
-
| `scientific-quantum-
|
|
347
|
-
| `scientific-
|
|
348
|
-
| `scientific-
|
|
349
|
-
| `scientific-
|
|
346
|
+
| `scientific-quantum-computing` | 量子計算・VQE・量子化学 |
|
|
347
|
+
| `scientific-cheminformatics` | 分子記述子・構造解析 |
|
|
348
|
+
| `scientific-publication-figures` | 構造・相図可視化 |
|
|
349
|
+
| `scientific-materials-characterization` | XRD・SEM・実験材料特性 |
|
|
350
350
|
|
|
351
351
|
### 依存パッケージ
|
|
352
352
|
|
|
@@ -373,3 +373,4 @@ def export_model(model, sample_input, export_dir="models"):
|
|
|
373
373
|
| `scientific-image-analysis` | ← 画像データの CNN 応用 |
|
|
374
374
|
| `scientific-medical-imaging` | → 医用画像の DL モデル |
|
|
375
375
|
| `scientific-quantum-computing` | ← 量子-古典ハイブリッド ML |
|
|
376
|
+
| `scientific-neuroscience-electrophysiology` | ← 神経デコーディング・スパイクソート DL |
|
|
@@ -326,6 +326,7 @@ def blocks_all_backdoor(G, X, Y, Z):
|
|
|
326
326
|
| [scientific-meta-analysis](../scientific-meta-analysis/SKILL.md) | メタアナリシス・系統的レビュー |
|
|
327
327
|
| [scientific-infectious-disease](../scientific-infectious-disease/SKILL.md) | 感染症疫学 |
|
|
328
328
|
| [scientific-bayesian-statistics](../scientific-bayesian-statistics/SKILL.md) | ベイズ空間モデル |
|
|
329
|
+
| [scientific-clinical-trials-analytics](../scientific-clinical-trials-analytics/SKILL.md) | 臨床試験レジストリ |
|
|
329
330
|
|
|
330
331
|
#### 依存パッケージ
|
|
331
332
|
|
|
@@ -313,3 +313,5 @@ BUDGET_JUSTIFICATION_TEMPLATE = """
|
|
|
313
313
|
| `scientific-hypothesis-pipeline` | ← 仮説定義・課題設定 |
|
|
314
314
|
| `scientific-deep-research` | ← 文献レビュー・先行研究調査 |
|
|
315
315
|
| `scientific-academic-writing` | ← アカデミックライティングスキル |
|
|
316
|
+
| `scientific-scientific-schematics` | ← 研究計画図・フロー図生成 |
|
|
317
|
+
| `scientific-regulatory-science` | ← 規制戦略セクション |
|
|
@@ -324,10 +324,10 @@ def fork_protocol(original_protocol_id, modifications):
|
|
|
324
324
|
| スキル | 関連 |
|
|
325
325
|
|---|---|
|
|
326
326
|
| `scientific-bioinformatics` | ゲノミクスデータ解析 |
|
|
327
|
-
| `scientific-
|
|
327
|
+
| `scientific-image-analysis` | 顯微鏡画像解析 |
|
|
328
328
|
| `scientific-gene-expression-transcriptomics` | RNA-seq データ管理 |
|
|
329
329
|
| `scientific-single-cell-genomics` | scRNA-seq データ管理 |
|
|
330
|
-
| `scientific-data-
|
|
330
|
+
| `scientific-data-preprocessing` | データ前処理 |
|
|
331
331
|
|
|
332
332
|
### 依存パッケージ
|
|
333
333
|
|