@nahisaho/satori 0.10.0 → 0.11.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.
@@ -0,0 +1,342 @@
1
+ ---
2
+ name: scientific-pharmacogenomics
3
+ description: |
4
+ ファーマコゲノミクス (薬理ゲノム学) 解析スキル。PharmGKB/ClinPGx による
5
+ 遺伝子-薬物相互作用照会、CPIC ガイドライン取得・解釈、Star アレル分類、
6
+ 代謝酵素表現型判定 (PM/IM/NM/RM/UM)、FDA 薬理ゲノムバイオマーカー、
7
+ 投与量レコメンデーション、PGx レポート生成を統合した
8
+ 個別化薬物療法支援パイプライン。
9
+ ---
10
+
11
+ # Scientific Pharmacogenomics
12
+
13
+ 遺伝子型に基づく薬物選択・用量調整を支援する
14
+ ファーマコゲノミクスパイプライン。CPIC/DPWG ガイドライン・PharmGKB・
15
+ FDA PGx バイオマーカーのデータベース照会と解釈を統合。
16
+
17
+ ## When to Use
18
+
19
+ - 遺伝子型に基づく薬物選択・投与量調整が必要なとき
20
+ - CPIC/DPWG ガイドラインの系統的照会が必要なとき
21
+ - Star アレル分類・代謝酵素表現型 (PM/IM/NM/RM/UM) を判定するとき
22
+ - FDA 承認ファーマコゲノミクスバイオマーカーを確認するとき
23
+ - 個別化薬物療法レポートを生成するとき
24
+
25
+ ---
26
+
27
+ ## Quick Start
28
+
29
+ ## 1. 遺伝子-薬物相互作用照会
30
+
31
+ ```python
32
+ import pandas as pd
33
+ import json
34
+
35
+
36
+ def query_gene_drug_interactions(gene_symbol, data_source="PharmGKB"):
37
+ """
38
+ 遺伝子-薬物相互作用の照会。
39
+
40
+ 主要 PGx 遺伝子:
41
+ - CYP2D6: コデイン, タモキシフェン, トラマドール
42
+ - CYP2C19: クロピドグレル, エスシタロプラム, オメプラゾール
43
+ - CYP2C9: ワルファリン, フェニトイン
44
+ - CYP3A5: タクロリムス
45
+ - DPYD: フルオロウラシル, カペシタビン
46
+ - TPMT/NUDT15: アザチオプリン, 6-MP
47
+ - UGT1A1: イリノテカン
48
+ - SLCO1B1: シンバスタチン
49
+ - HLA-B: アバカビル (*57:01), カルバマゼピン (*15:02)
50
+ - VKORC1: ワルファリン
51
+ """
52
+ print(f" Querying {data_source} for gene: {gene_symbol}")
53
+
54
+ # PharmGKB の主要フィールド
55
+ query_fields = {
56
+ "gene": gene_symbol,
57
+ "clinical_annotations": "Tier 1A-3",
58
+ "drug_labels": "FDA/EMA/PMDA/HCSC",
59
+ "guideline_annotations": "CPIC/DPWG/CPNDS",
60
+ "variant_annotations": "Clinical significance",
61
+ "pathway_annotations": "PK/PD pathways",
62
+ }
63
+
64
+ return query_fields
65
+
66
+
67
+ def get_cpic_guidelines(gene_symbol=None, drug_name=None):
68
+ """
69
+ CPIC ガイドラインの取得。
70
+
71
+ CPIC Level:
72
+ - Level A: 処方変更を義務付ける強力なエビデンス
73
+ - Level A/B: 処方変更を推奨するエビデンス
74
+ - Level B: 考慮すべきエビデンス
75
+ - Level C: 情報提供レベル
76
+ - Level D: 有用なデータなし
77
+ """
78
+ print(f" Querying CPIC guidelines:")
79
+ if gene_symbol:
80
+ print(f" Gene: {gene_symbol}")
81
+ if drug_name:
82
+ print(f" Drug: {drug_name}")
83
+
84
+ return {"gene": gene_symbol, "drug": drug_name, "level": "pending"}
85
+ ```
86
+
87
+ ## 2. Star アレル分類・表現型判定
88
+
89
+ ```python
90
+ import pandas as pd
91
+ import numpy as np
92
+
93
+
94
+ def star_allele_annotation(gene, genotype_variants):
95
+ """
96
+ Star アレル分類パイプライン。
97
+
98
+ PharmCAT (Pharmacogenomics Clinical Annotation Tool) 互換の
99
+ Star アレルコール → 表現型変換。
100
+
101
+ Parameters:
102
+ gene: 対象遺伝子 (e.g., "CYP2D6")
103
+ genotype_variants: {rsID: genotype} 辞書
104
+ """
105
+ # CYP2D6 Star アレル例
106
+ cyp2d6_alleles = {
107
+ "*1": {"function": "Normal", "activity_score": 1.0},
108
+ "*2": {"function": "Normal", "activity_score": 1.0},
109
+ "*3": {"function": "No function", "activity_score": 0.0},
110
+ "*4": {"function": "No function", "activity_score": 0.0},
111
+ "*5": {"function": "No function (gene deletion)", "activity_score": 0.0},
112
+ "*6": {"function": "No function", "activity_score": 0.0},
113
+ "*9": {"function": "Decreased", "activity_score": 0.5},
114
+ "*10": {"function": "Decreased", "activity_score": 0.25},
115
+ "*17": {"function": "Decreased", "activity_score": 0.5},
116
+ "*41": {"function": "Decreased", "activity_score": 0.5},
117
+ }
118
+
119
+ print(f" Gene: {gene}")
120
+ print(f" Variants provided: {len(genotype_variants)}")
121
+ print(f" Reference: PharmCAT + PharmVar")
122
+
123
+ return cyp2d6_alleles
124
+
125
+
126
+ def determine_metabolizer_phenotype(gene, diplotype, activity_scores):
127
+ """
128
+ Activity Score ベースの代謝酵素表現型判定。
129
+
130
+ 表現型分類:
131
+ - PM (Poor Metabolizer): AS = 0
132
+ - IM (Intermediate Metabolizer): 0 < AS < 1.25
133
+ - NM (Normal Metabolizer): 1.25 ≤ AS ≤ 2.25
134
+ - RM (Rapid Metabolizer): 2.25 < AS ≤ 3.0 (CYP2C19 のみ)
135
+ - UM (Ultra-rapid Metabolizer): AS > 3.0 or gene duplication
136
+ """
137
+ as1, as2 = activity_scores
138
+ total_as = as1 + as2
139
+
140
+ if total_as == 0:
141
+ phenotype = "PM (Poor Metabolizer)"
142
+ elif total_as < 1.25:
143
+ phenotype = "IM (Intermediate Metabolizer)"
144
+ elif total_as <= 2.25:
145
+ phenotype = "NM (Normal Metabolizer)"
146
+ elif total_as <= 3.0:
147
+ phenotype = "RM (Rapid Metabolizer)"
148
+ else:
149
+ phenotype = "UM (Ultra-rapid Metabolizer)"
150
+
151
+ print(f" Gene: {gene}")
152
+ print(f" Diplotype: {diplotype}")
153
+ print(f" Activity Score: {as1} + {as2} = {total_as}")
154
+ print(f" Phenotype: {phenotype}")
155
+
156
+ # CPIC 投与量レコメンデーション
157
+ if gene == "CYP2D6" and "PM" in phenotype:
158
+ print(" ⚠ CPIC: コデイン禁忌 (モルフィンへの変換不可)")
159
+ print(" ⚠ CPIC: タモキシフェン → 代替薬を推奨")
160
+
161
+ return {"gene": gene, "diplotype": diplotype,
162
+ "activity_score": total_as, "phenotype": phenotype}
163
+ ```
164
+
165
+ ## 3. FDA PGx バイオマーカー照会
166
+
167
+ ```python
168
+ import pandas as pd
169
+
170
+
171
+ def query_fda_pgx_biomarkers(drug_name=None, gene_name=None,
172
+ biomarker_type=None):
173
+ """
174
+ FDA 承認ファーマコゲノミクスバイオマーカーの照会。
175
+
176
+ FDA PGx Labeling Categories:
177
+ - Required: テスト必須 (e.g., HLA-B*57:01 for abacavir)
178
+ - Recommended: テスト推奨
179
+ - Actionable: PGx 情報あり
180
+ - Informative: 参考情報
181
+
182
+ 300+ の遺伝子-薬物ペアが FDA ラベルに記載。
183
+ """
184
+ print(" Querying FDA Pharmacogenomic Biomarkers:")
185
+ if drug_name:
186
+ print(f" Drug: {drug_name}")
187
+ if gene_name:
188
+ print(f" Gene: {gene_name}")
189
+ if biomarker_type:
190
+ print(f" Type: {biomarker_type}")
191
+
192
+ # FDA 主要バイオマーカー例
193
+ key_biomarkers = [
194
+ {"gene": "HLA-B*57:01", "drug": "Abacavir", "action": "Required",
195
+ "recommendation": "HLA-B*57:01 陽性 → 禁忌 (過敏反応リスク)"},
196
+ {"gene": "CYP2C19", "drug": "Clopidogrel", "action": "Actionable",
197
+ "recommendation": "PM → 代替抗血小板薬 (ticagrelor/prasugrel)"},
198
+ {"gene": "DPYD", "drug": "5-FU/Capecitabine", "action": "Recommended",
199
+ "recommendation": "PM → 用量 50% 減量 or 代替薬"},
200
+ {"gene": "UGT1A1*28", "drug": "Irinotecan", "action": "Recommended",
201
+ "recommendation": "TA7/TA7 → 初回投与量減量"},
202
+ {"gene": "TPMT/NUDT15", "drug": "Azathioprine", "action": "Recommended",
203
+ "recommendation": "PM → 10%用量 or 代替薬"},
204
+ ]
205
+
206
+ return pd.DataFrame(key_biomarkers)
207
+
208
+
209
+ def pgx_dosing_recommendation(gene, phenotype, drug):
210
+ """
211
+ 表現型に基づく CPIC 投与量レコメンデーション生成。
212
+ """
213
+ # CPIC 投与量テーブル例 (CYP2C19 × Clopidogrel)
214
+ cpic_table = {
215
+ ("CYP2C19", "UM", "Clopidogrel"): "標準用量 75 mg/day",
216
+ ("CYP2C19", "RM", "Clopidogrel"): "標準用量 75 mg/day",
217
+ ("CYP2C19", "NM", "Clopidogrel"): "標準用量 75 mg/day",
218
+ ("CYP2C19", "IM", "Clopidogrel"): "代替抗血小板薬を推奨 (ticagrelor/prasugrel)",
219
+ ("CYP2C19", "PM", "Clopidogrel"): "代替抗血小板薬を推奨 (ticagrelor/prasugrel)",
220
+ }
221
+
222
+ key = (gene, phenotype.split(" ")[0], drug)
223
+ recommendation = cpic_table.get(key, "ガイドライン情報なし")
224
+
225
+ result = {
226
+ "gene": gene,
227
+ "phenotype": phenotype,
228
+ "drug": drug,
229
+ "recommendation": recommendation,
230
+ "source": "CPIC",
231
+ "evidence_level": "Level A",
232
+ }
233
+
234
+ print(f" PGx Dosing Recommendation:")
235
+ print(f" Gene: {gene} | Phenotype: {phenotype}")
236
+ print(f" Drug: {drug}")
237
+ print(f" Recommendation: {recommendation}")
238
+
239
+ return result
240
+ ```
241
+
242
+ ## 4. PGx レポート生成
243
+
244
+ ```python
245
+ import json
246
+ import pandas as pd
247
+ from datetime import datetime
248
+
249
+
250
+ def generate_pgx_report(patient_results, output_file="results/pgx_report.json"):
251
+ """
252
+ 包括的 PGx レポート生成。
253
+
254
+ 含まれる情報:
255
+ - 患者遺伝子型サマリ
256
+ - Star アレル → 表現型マッピング
257
+ - 各薬物の CPIC/DPWG レコメンデーション
258
+ - FDA バイオマーカーステータス
259
+ - アクショナブル所見ハイライト
260
+ """
261
+ import os
262
+ os.makedirs(os.path.dirname(output_file), exist_ok=True)
263
+
264
+ report = {
265
+ "report_type": "Pharmacogenomics Report",
266
+ "generated_at": datetime.now().isoformat(),
267
+ "patient_id": patient_results.get("patient_id", "anonymous"),
268
+ "genes_tested": [],
269
+ "actionable_findings": [],
270
+ "drug_recommendations": [],
271
+ }
272
+
273
+ for gene_result in patient_results.get("gene_results", []):
274
+ gene_entry = {
275
+ "gene": gene_result["gene"],
276
+ "diplotype": gene_result["diplotype"],
277
+ "phenotype": gene_result["phenotype"],
278
+ "activity_score": gene_result.get("activity_score"),
279
+ }
280
+ report["genes_tested"].append(gene_entry)
281
+
282
+ # アクショナブル所見の抽出
283
+ if "PM" in gene_result["phenotype"] or "UM" in gene_result["phenotype"]:
284
+ report["actionable_findings"].append({
285
+ "gene": gene_result["gene"],
286
+ "phenotype": gene_result["phenotype"],
287
+ "clinical_significance": "Actionable — 投与量調整/代替薬検討を推奨",
288
+ })
289
+
290
+ with open(output_file, "w") as f:
291
+ json.dump(report, f, ensure_ascii=False, indent=2)
292
+
293
+ print(f" PGx Report generated: {output_file}")
294
+ print(f" Genes tested: {len(report['genes_tested'])}")
295
+ print(f" Actionable findings: {len(report['actionable_findings'])}")
296
+
297
+ return report
298
+ ```
299
+
300
+ ## References
301
+
302
+ ### Output Files
303
+
304
+ | ファイル | 形式 |
305
+ |---|---|
306
+ | `results/pgx_report.json` | JSON |
307
+ | `results/gene_drug_interactions.csv` | CSV |
308
+ | `results/star_allele_calls.csv` | CSV |
309
+ | `results/dosing_recommendations.csv` | CSV |
310
+ | `figures/pgx_phenotype_summary.png` | PNG |
311
+
312
+ ### 利用可能ツール
313
+
314
+ > [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
315
+
316
+ | カテゴリ | 主要ツール | 用途 |
317
+ |---|---|---|
318
+ | PharmGKB | `PharmGKB_search_drugs` | 薬物検索 (遺伝子関連) |
319
+ | PharmGKB | `PharmGKB_search_genes` | PGx 遺伝子検索 |
320
+ | PharmGKB | `PharmGKB_get_drug_details` | 薬物詳細 (クロスリファレンス) |
321
+ | PharmGKB | `PharmGKB_get_gene_details` | 遺伝子詳細 (アレル情報) |
322
+ | PharmGKB | `PharmGKB_get_clinical_annotations` | 遺伝子-薬物臨床アノテーション |
323
+ | PharmGKB | `PharmGKB_get_dosing_guidelines` | CPIC/DPWG 用量ガイドライン |
324
+ | PharmGKB | `PharmGKB_search_variants` | 遺伝的変異検索 |
325
+ | FDA | `fda_pharmacogenomic_biomarkers` | FDA PGx バイオマーカー一覧 |
326
+ | FDA | `FDA_get_pharmacogenomics_info_by_drug_name` | 薬物名で PGx 情報取得 |
327
+ | FDA | `FDA_get_drug_name_by_pharmacogenomics` | PGx から薬物名取得 |
328
+ | OpenTargets | `OpenTargets_drug_pharmacogenomics_data` | 薬物 PGx データ |
329
+
330
+ ### 参照スキル
331
+
332
+ | スキル | 関連 |
333
+ |---|---|
334
+ | `scientific-variant-interpretation` | ACMG/AMP バリアント解釈 |
335
+ | `scientific-pharmacovigilance` | 市販後安全性監視 |
336
+ | `scientific-clinical-decision-support` | 臨床意思決定 |
337
+ | `scientific-precision-oncology` | 腫瘍 PGx (OncoKB) |
338
+ | `scientific-population-genetics` | 集団間アレル頻度差 |
339
+
340
+ ### 依存パッケージ
341
+
342
+ `pandas`, `numpy`, `json`