@nahisaho/satori 0.8.0 → 0.10.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.
Files changed (34) hide show
  1. package/README.md +138 -2
  2. package/package.json +1 -1
  3. package/src/.github/skills/scientific-admet-pharmacokinetics/SKILL.md +14 -0
  4. package/src/.github/skills/scientific-bioinformatics/SKILL.md +13 -0
  5. package/src/.github/skills/scientific-cheminformatics/SKILL.md +13 -0
  6. package/src/.github/skills/scientific-citation-checker/SKILL.md +12 -0
  7. package/src/.github/skills/scientific-clinical-decision-support/SKILL.md +14 -0
  8. package/src/.github/skills/scientific-deep-research/SKILL.md +15 -0
  9. package/src/.github/skills/scientific-disease-research/SKILL.md +14 -0
  10. package/src/.github/skills/scientific-drug-repurposing/SKILL.md +14 -0
  11. package/src/.github/skills/scientific-drug-target-profiling/SKILL.md +14 -0
  12. package/src/.github/skills/scientific-environmental-ecology/SKILL.md +295 -0
  13. package/src/.github/skills/scientific-epidemiology-public-health/SKILL.md +332 -0
  14. package/src/.github/skills/scientific-grant-writing/SKILL.md +12 -0
  15. package/src/.github/skills/scientific-graph-neural-networks/SKILL.md +12 -0
  16. package/src/.github/skills/scientific-immunoinformatics/SKILL.md +341 -0
  17. package/src/.github/skills/scientific-infectious-disease/SKILL.md +342 -0
  18. package/src/.github/skills/scientific-meta-analysis/SKILL.md +11 -0
  19. package/src/.github/skills/scientific-metabolomics/SKILL.md +13 -0
  20. package/src/.github/skills/scientific-microbiome-metagenomics/SKILL.md +349 -0
  21. package/src/.github/skills/scientific-multi-omics/SKILL.md +13 -0
  22. package/src/.github/skills/scientific-network-analysis/SKILL.md +13 -0
  23. package/src/.github/skills/scientific-pharmacovigilance/SKILL.md +15 -0
  24. package/src/.github/skills/scientific-population-genetics/SKILL.md +336 -0
  25. package/src/.github/skills/scientific-precision-oncology/SKILL.md +14 -0
  26. package/src/.github/skills/scientific-protein-design/SKILL.md +13 -0
  27. package/src/.github/skills/scientific-protein-structure-analysis/SKILL.md +13 -0
  28. package/src/.github/skills/scientific-sequence-analysis/SKILL.md +13 -0
  29. package/src/.github/skills/scientific-single-cell-genomics/SKILL.md +361 -0
  30. package/src/.github/skills/scientific-spatial-transcriptomics/SKILL.md +281 -0
  31. package/src/.github/skills/scientific-survival-clinical/SKILL.md +12 -0
  32. package/src/.github/skills/scientific-systems-biology/SKILL.md +310 -0
  33. package/src/.github/skills/scientific-text-mining-nlp/SKILL.md +358 -0
  34. package/src/.github/skills/scientific-variant-interpretation/SKILL.md +14 -0
@@ -321,6 +321,19 @@ def metabolite_correlation_network(df, metabolite_cols, method="spearman",
321
321
  | `figures/vip_barplot.png` | PNG |
322
322
  | `figures/metabolite_network.png` | PNG |
323
323
 
324
+ ### 利用可能ツール
325
+
326
+ > [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
327
+
328
+ | カテゴリ | 主要ツール | 用途 |
329
+ |---|---|---|
330
+ | HMDB | `HMDB_search` | 代謝物検索 |
331
+ | HMDB | `HMDB_get_metabolite` | 代謝物詳細取得 |
332
+ | HMDB | `HMDB_get_diseases` | 代謝物-疾患関連 |
333
+ | KEGG | `kegg_get_pathway_info` | 代謝パスウェイ情報 |
334
+ | MetaCyc | `MetaCyc_search_pathways` | 代謝経路検索 |
335
+ | MetabolomicsWB | `MetabolomicsWorkbench_search_compound_by_name` | 代謝物データベース検索 |
336
+
324
337
  #### 参照実験
325
338
 
326
339
  - **Exp-07**: PLS-DA + VIP、Pareto スケーリング、パスウェイ濃縮、相関ネットワーク
@@ -0,0 +1,349 @@
1
+ ---
2
+ name: scientific-microbiome-metagenomics
3
+ description: |
4
+ マイクロバイオーム・メタゲノミクス解析スキル。16S rRNA アンプリコン解析(DADA2)・
5
+ ショットガンメタゲノム解析(MetaPhlAn / HUMAnN)・α/β 多様性・
6
+ 差次存在量解析(DESeq2 / ANCOM-BC)・機能的プロファイリング・
7
+ 組成データ解析(CoDA)パイプライン。
8
+ ---
9
+
10
+ # Scientific Microbiome & Metagenomics
11
+
12
+ マイクロバイオーム解析の標準パイプラインを提供する。
13
+ 16S rRNA アンプリコンおよびショットガンメタゲノムデータの
14
+ 品質管理、分類学的プロファイリング、多様性評価、
15
+ 差次存在量解析、機能的アノテーションを体系的に扱う。
16
+
17
+ ## When to Use
18
+
19
+ - 16S rRNA アンプリコンシーケンスの解析が必要なとき
20
+ - ショットガンメタゲノムの分類学的・機能的プロファイリングを行うとき
21
+ - 群集の α / β 多様性を比較するとき
22
+ - 群間で差次存在量の微生物を同定するとき
23
+ - 組成データ(compositional data)の統計解析を行うとき
24
+
25
+ ---
26
+
27
+ ## Quick Start
28
+
29
+ ## 1. 16S rRNA アンプリコン解析(DADA2)
30
+
31
+ ```python
32
+ import numpy as np
33
+ import pandas as pd
34
+
35
+ def dada2_pipeline(fastq_dir, trim_left=20, trunc_len_f=240, trunc_len_r=200,
36
+ min_overlap=12):
37
+ """
38
+ DADA2 アンプリコン解析パイプライン。
39
+
40
+ 手順:
41
+ 1. filterAndTrim — 品質フィルタリング + プライマー除去
42
+ 2. learnErrors — エラーモデル学習
43
+ 3. dada — ASV(Amplicon Sequence Variant)推定
44
+ 4. mergePairs — ペアエンドマージ
45
+ 5. removeBimeraDenovo — キメラ除去
46
+ 6. assignTaxonomy — SILVA/GTDB による分類
47
+
48
+ ASV vs OTU:
49
+ ASV は 100% 配列同一性で分解(1 塩基差を区別)
50
+ OTU は 97% 類似度でクラスタリング(旧来法)
51
+ """
52
+ import subprocess
53
+
54
+ r_script = f"""
55
+ library(dada2)
56
+
57
+ path <- "{fastq_dir}"
58
+ fnFs <- sort(list.files(path, pattern="_R1_001.fastq.gz", full.names=TRUE))
59
+ fnRs <- sort(list.files(path, pattern="_R2_001.fastq.gz", full.names=TRUE))
60
+
61
+ # Filter and trim
62
+ filtFs <- file.path(path, "filtered", basename(fnFs))
63
+ filtRs <- file.path(path, "filtered", basename(fnRs))
64
+ out <- filterAndTrim(fnFs, filtFs, fnRs, filtRs,
65
+ trimLeft={trim_left}, truncLen=c({trunc_len_f},{trunc_len_r}),
66
+ maxN=0, maxEE=c(2,2), truncQ=2, rm.phix=TRUE)
67
+
68
+ # Error learning
69
+ errF <- learnErrors(filtFs, multithread=TRUE)
70
+ errR <- learnErrors(filtRs, multithread=TRUE)
71
+
72
+ # Denoise
73
+ dadaFs <- dada(filtFs, err=errF, multithread=TRUE)
74
+ dadaRs <- dada(filtRs, err=errR, multithread=TRUE)
75
+
76
+ # Merge
77
+ merged <- mergePairs(dadaFs, filtFs, dadaRs, filtRs, minOverlap={min_overlap})
78
+
79
+ # ASV table
80
+ seqtab <- makeSequenceTable(merged)
81
+ seqtab.nochim <- removeBimeraDenovo(seqtab, method="consensus")
82
+
83
+ # Taxonomy
84
+ taxa <- assignTaxonomy(seqtab.nochim, "silva_nr99_v138.1_train_set.fa.gz")
85
+
86
+ write.csv(seqtab.nochim, "results/asv_table.csv")
87
+ write.csv(taxa, "results/taxonomy.csv")
88
+ """
89
+
90
+ with open("_dada2_pipeline.R", "w") as f:
91
+ f.write(r_script)
92
+ subprocess.run(["Rscript", "_dada2_pipeline.R"], check=True)
93
+
94
+ asv_table = pd.read_csv("results/asv_table.csv", index_col=0)
95
+ taxonomy = pd.read_csv("results/taxonomy.csv", index_col=0)
96
+ print(f" DADA2: {asv_table.shape[1]} ASVs from {asv_table.shape[0]} samples")
97
+ return asv_table, taxonomy
98
+ ```
99
+
100
+ ## 2. ショットガン分類学的プロファイリング
101
+
102
+ ```python
103
+ def shotgun_taxonomic_profiling(fastq_files, method="metaphlan"):
104
+ """
105
+ ショットガンメタゲノム分類学的プロファイリング。
106
+
107
+ method:
108
+ - "metaphlan": MetaPhlAn 4 — clade-specific marker 遺伝子ベース
109
+ - "kraken2": Kraken2 — k-mer ベース(高速、メモリ大)
110
+ - "sourmash": sourmash — MinHash ベース
111
+
112
+ MetaPhlAn: 精度重視(微量種の検出に優れる)
113
+ Kraken2: 速度重視(大規模データ向け)
114
+ """
115
+ import subprocess
116
+
117
+ profiles = []
118
+ for fq in fastq_files:
119
+ sample = fq.split("/")[-1].replace(".fastq.gz", "")
120
+
121
+ if method == "metaphlan":
122
+ cmd = (f"metaphlan {fq} --input_type fastq "
123
+ f"--nproc 8 -o {sample}_profile.txt "
124
+ f"--bowtie2out {sample}.bt2out")
125
+ elif method == "kraken2":
126
+ cmd = (f"kraken2 --db kraken2_db --threads 8 "
127
+ f"--report {sample}_report.txt "
128
+ f"--output {sample}_kraken.txt {fq}")
129
+
130
+ subprocess.run(cmd, shell=True, check=True)
131
+ profile = pd.read_csv(f"{sample}_profile.txt", sep="\t",
132
+ comment="#", header=None)
133
+ profile["sample"] = sample
134
+ profiles.append(profile)
135
+
136
+ merged = pd.concat(profiles, ignore_index=True)
137
+ print(f" Profiling ({method}): {len(fastq_files)} samples processed")
138
+ return merged
139
+ ```
140
+
141
+ ## 3. α / β 多様性解析
142
+
143
+ ```python
144
+ from scipy.spatial.distance import braycurtis, pdist, squareform
145
+ from scipy.stats import mannwhitneyu, kruskal
146
+ from skbio.diversity import alpha_diversity, beta_diversity
147
+
148
+ def alpha_diversity_analysis(asv_table, metadata, group_col,
149
+ metrics=None):
150
+ """
151
+ α 多様性(群集内多様性)解析。
152
+
153
+ 指標:
154
+ - observed_features: 観察種数(Richness)
155
+ - shannon: Shannon entropy H' = -Σ pᵢ ln(pᵢ)
156
+ - simpson: Simpson index D = 1 - Σ pᵢ²
157
+ - chao1: Chao1 推定種数 S_est = S_obs + f₁²/(2·f₂)
158
+ - faith_pd: Faith's Phylogenetic Diversity(系統的多様性)
159
+ """
160
+ if metrics is None:
161
+ metrics = ["observed_features", "shannon", "simpson", "chao1"]
162
+
163
+ results = {}
164
+ for metric in metrics:
165
+ values = alpha_diversity(metric, asv_table.values, asv_table.index)
166
+ results[metric] = values
167
+
168
+ alpha_df = pd.DataFrame(results, index=asv_table.index)
169
+ alpha_df = alpha_df.join(metadata[[group_col]])
170
+
171
+ # 群間比較
172
+ groups = alpha_df[group_col].unique()
173
+ comparisons = {}
174
+ for metric in metrics:
175
+ if len(groups) == 2:
176
+ g1 = alpha_df[alpha_df[group_col] == groups[0]][metric]
177
+ g2 = alpha_df[alpha_df[group_col] == groups[1]][metric]
178
+ stat, pval = mannwhitneyu(g1, g2)
179
+ else:
180
+ group_data = [alpha_df[alpha_df[group_col] == g][metric] for g in groups]
181
+ stat, pval = kruskal(*group_data)
182
+ comparisons[metric] = {"statistic": stat, "p_value": pval}
183
+
184
+ print(f" α diversity: {len(metrics)} indices computed for {len(alpha_df)} samples")
185
+ return alpha_df, comparisons
186
+
187
+
188
+ def beta_diversity_analysis(asv_table, metadata, group_col,
189
+ metric="braycurtis", n_perms=999):
190
+ """
191
+ β 多様性(群集間距離)解析。
192
+
193
+ 距離指標:
194
+ - braycurtis: Bray-Curtis dissimilarity
195
+ - jaccard: Jaccard distance
196
+ - unifrac: UniFrac(系統考慮、ツリー必要)
197
+ - aitchison: Aitchison distance(CoDA 推奨)
198
+
199
+ 統計検定:
200
+ - PERMANOVA (adonis2): 群間距離の有意差
201
+ - PERMDISP: 分散均一性検定
202
+ """
203
+ dm = beta_diversity(metric, asv_table.values, asv_table.index)
204
+
205
+ # PERMANOVA
206
+ from skbio.stats.distance import permanova
207
+ groups = metadata.loc[asv_table.index, group_col]
208
+ permanova_result = permanova(dm, groups, permutations=n_perms)
209
+
210
+ # PCoA
211
+ from skbio.stats.ordination import pcoa
212
+ pcoa_result = pcoa(dm)
213
+
214
+ print(f" β diversity ({metric}): PERMANOVA R²={permanova_result['test statistic']:.4f}, "
215
+ f"p={permanova_result['p-value']:.4f}")
216
+ return dm, pcoa_result, permanova_result
217
+ ```
218
+
219
+ ## 4. 差次存在量解析
220
+
221
+ ```python
222
+ def differential_abundance(asv_table, metadata, group_col,
223
+ formula="~group", method="ancombc"):
224
+ """
225
+ 差次存在量解析 — 群間で有意に異なる微生物の同定。
226
+
227
+ method:
228
+ - "ancombc": ANCOM-BC2 — バイアス補正・組成データ対応(推奨)
229
+ - "deseq2": DESeq2 — 負の二項分布(RNA-seq 由来)
230
+ - "aldex2": ALDEx2 — CLR 変換 + 効果量
231
+
232
+ 組成データの問題:
233
+ 相対存在量は合計=1 の制約がありスプリアス相関を生む。
234
+ CLR 変換: clr(x) = log(xᵢ / geometric_mean(x))
235
+ """
236
+ import subprocess
237
+
238
+ if method == "ancombc":
239
+ r_script = f"""
240
+ library(ANCOMBC)
241
+ library(phyloseq)
242
+ # ANCOM-BC2 analysis
243
+ res <- ancombc2(data=ps, fix_formula="{formula}",
244
+ p_adj_method="holm", alpha=0.05)
245
+ write.csv(res$res, "results/da_results.csv")
246
+ """
247
+ with open("_da_analysis.R", "w") as f:
248
+ f.write(r_script)
249
+ subprocess.run(["Rscript", "_da_analysis.R"], check=True)
250
+ results = pd.read_csv("results/da_results.csv", index_col=0)
251
+
252
+ elif method == "deseq2":
253
+ r_script = f"""
254
+ library(DESeq2)
255
+ dds <- DESeqDataSetFromMatrix(countData=asv_counts,
256
+ colData=sample_data,
257
+ design={formula})
258
+ dds <- DESeq(dds)
259
+ res <- results(dds)
260
+ write.csv(as.data.frame(res), "results/da_results.csv")
261
+ """
262
+ with open("_da_analysis.R", "w") as f:
263
+ f.write(r_script)
264
+ subprocess.run(["Rscript", "_da_analysis.R"], check=True)
265
+ results = pd.read_csv("results/da_results.csv", index_col=0)
266
+
267
+ n_sig = (results.get("padj", results.get("q_val", pd.Series())) < 0.05).sum()
268
+ print(f" DA ({method}): {n_sig} differentially abundant taxa")
269
+ return results
270
+ ```
271
+
272
+ ## 5. 機能的プロファイリング
273
+
274
+ ```python
275
+ def functional_profiling(fastq_files, method="humann"):
276
+ """
277
+ メタゲノム機能的プロファイリング。
278
+
279
+ method:
280
+ - "humann": HUMAnN 3 — UniRef90/MetaCyc パスウェイ
281
+ - "picrust2": PICRUSt2 — 16S から機能予測
282
+
283
+ HUMAnN 出力:
284
+ 1. Gene families (UniRef90/UniRef50)
285
+ 2. Pathway abundance (MetaCyc)
286
+ 3. Pathway coverage
287
+ """
288
+ import subprocess
289
+
290
+ for fq in fastq_files:
291
+ sample = fq.split("/")[-1].replace(".fastq.gz", "")
292
+ cmd = (f"humann --input {fq} --output humann_results/{sample}/ "
293
+ f"--threads 8 --nucleotide-database chocophlan "
294
+ f"--protein-database uniref")
295
+ subprocess.run(cmd, shell=True, check=True)
296
+
297
+ # 結果のマージ
298
+ subprocess.run("humann_join_tables -i humann_results/ -o results/pathway_abundance.tsv "
299
+ "--file_name pathabundance", shell=True, check=True)
300
+ subprocess.run("humann_join_tables -i humann_results/ -o results/genefamilies.tsv "
301
+ "--file_name genefamilies", shell=True, check=True)
302
+
303
+ pathways = pd.read_csv("results/pathway_abundance.tsv", sep="\t", index_col=0)
304
+ print(f" HUMAnN: {pathways.shape[0]} pathways across {pathways.shape[1]} samples")
305
+ return pathways
306
+ ```
307
+
308
+ ## References
309
+
310
+ ### Output Files
311
+
312
+ | ファイル | 形式 |
313
+ |---|---|
314
+ | `results/asv_table.csv` | CSV |
315
+ | `results/taxonomy.csv` | CSV |
316
+ | `results/alpha_diversity.csv` | CSV |
317
+ | `results/beta_distance_matrix.csv` | CSV |
318
+ | `results/da_results.csv` | CSV |
319
+ | `results/pathway_abundance.tsv` | TSV |
320
+ | `figures/alpha_boxplot.png` | PNG |
321
+ | `figures/pcoa_plot.png` | PNG |
322
+ | `figures/barplot_taxonomy.png` | PNG |
323
+
324
+ ### 利用可能ツール
325
+
326
+ > [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
327
+
328
+ | カテゴリ | 主要ツール | 用途 |
329
+ |---|---|---|
330
+ | MGnify | `MGnify_search_studies` | メタゲノム研究検索 |
331
+ | MGnify | `MGnify_list_analyses` | メタゲノム解析一覧 |
332
+ | KEGG | `kegg_get_pathway_info` | 代謝パスウェイ情報 |
333
+ | KEGG | `kegg_search_pathway` | パスウェイ検索 |
334
+ | MetaCyc | `MetaCyc_search_pathways` | 代謝経路検索 |
335
+ | PubMed | `PubMed_search_articles` | マイクロバイオーム文献検索 |
336
+
337
+ ### 参照スキル
338
+
339
+ | スキル | 連携内容 |
340
+ |---|---|
341
+ | [scientific-metabolomics](../scientific-metabolomics/SKILL.md) | 代謝物-微生物相関 |
342
+ | [scientific-network-analysis](../scientific-network-analysis/SKILL.md) | 微生物共起ネットワーク |
343
+ | [scientific-statistical-testing](../scientific-statistical-testing/SKILL.md) | 多重検定補正 |
344
+ | [scientific-multi-omics](../scientific-multi-omics/SKILL.md) | マルチオミクス統合 |
345
+ | [scientific-causal-inference](../scientific-causal-inference/SKILL.md) | 因果推論(微生物-表現型) |
346
+
347
+ #### 依存パッケージ
348
+
349
+ - scikit-bio, biom-format, qiime2, dada2 (R), ANCOM-BC (R), DESeq2 (R), HUMAnN, MetaPhlAn
@@ -295,6 +295,19 @@ def multiomics_clustering(fused_similarity, n_clusters, labels_true=None):
295
295
  | `figures/snf_heatmap.png` | PNG |
296
296
  | `figures/multiomics_umap.png` | PNG |
297
297
 
298
+ ### 利用可能ツール
299
+
300
+ > [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
301
+
302
+ | カテゴリ | 主要ツール | 用途 |
303
+ |---|---|---|
304
+ | HPA | `HPA_get_rna_expression_by_source` | 組織別 RNA 発現 |
305
+ | GEO | `geo_search_datasets` | オミクスデータセット検索 |
306
+ | CELLxGENE | `CELLxGENE_get_expression_data` | 単一細胞発現データ |
307
+ | Reactome | `Reactome_map_uniprot_to_pathways` | パスウェイマッピング |
308
+ | KEGG | `kegg_get_pathway_info` | パスウェイ情報 |
309
+ | UniProt | `UniProt_search` | タンパク質検索 |
310
+
298
311
  #### 依存パッケージ
299
312
 
300
313
  ```
@@ -250,6 +250,19 @@ def psp_path_diagram(ps_corr, sp_corr, pp_corr,
250
250
  | `figures/network_visualization.png` | PNG |
251
251
  | `figures/psp_path_diagram.png` | PNG |
252
252
 
253
+ ### 利用可能ツール
254
+
255
+ > [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
256
+
257
+ | カテゴリ | 主要ツール | 用途 |
258
+ |---|---|---|
259
+ | STRING | `STRING_get_protein_interactions` | タンパク質相互作用ネットワーク |
260
+ | IntAct | `intact_search_interactions` | 分子相互作用検索 |
261
+ | IntAct | `intact_get_interaction_network` | PPI ネットワーク取得 |
262
+ | Reactome | `Reactome_map_uniprot_to_pathways` | パスウェイマッピング |
263
+ | KEGG | `kegg_get_pathway_info` | パスウェイ情報 |
264
+ | GO | `GO_get_annotations_for_gene` | GO アノテーション |
265
+
253
266
  #### 参照実験
254
267
 
255
268
  - **Exp-04**: PPI ネットワーク(71 タンパク質、4 種中心性、Louvain コミュニティ)
@@ -489,6 +489,21 @@ def generate_pv_report(target_drug, signals_df, ebgm_df, output_dir="results"):
489
489
  | `figures/pv_temporal_trend.png` | 時系列トレンド図 | トレンド分析時 |
490
490
  | `figures/pv_demographics.png` | 人口統計分布図 | 層別化分析時 |
491
491
 
492
+ ### 利用可能ツール
493
+
494
+ > [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
495
+
496
+ | カテゴリ | 主要ツール | 用途 |
497
+ |---|---|---|
498
+ | FAERS | `FAERS_count_reactions_by_drug_event` | 有害事象カウント |
499
+ | FAERS | `FAERS_calculate_disproportionality` | PRR/ROR/IC 不均衡分析 |
500
+ | FAERS | `FAERS_stratify_by_demographics` | 年齢・性別・国別層別化 |
501
+ | FDA | `FDA_get_adverse_reactions_by_drug_name` | 添付文書副作用情報 |
502
+ | DailyMed | `DailyMed_search_spls` | 添付文書検索 |
503
+ | DailyMed | `DailyMed_parse_adverse_reactions` | 副作用テーブル抽出 |
504
+ | PharmGKB | `PharmGKB_get_dosing_guidelines` | PGx 用量ガイドライン |
505
+ | CPIC | `CPIC_get_guidelines` | CPIC ガイドライン取得 |
506
+
492
507
  ### 参照スキル
493
508
 
494
509
  | スキル | 連携 |