@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.
- package/README.md +73 -43
- package/package.json +1 -1
- package/src/.github/skills/scientific-clinical-trials-analytics/SKILL.md +340 -0
- package/src/.github/skills/scientific-computational-materials/SKILL.md +353 -0
- package/src/.github/skills/scientific-epigenomics-chromatin/SKILL.md +567 -0
- package/src/.github/skills/scientific-gene-expression-transcriptomics/SKILL.md +330 -0
- package/src/.github/skills/scientific-lab-data-management/SKILL.md +334 -0
- package/src/.github/skills/scientific-neuroscience-electrophysiology/SKILL.md +400 -0
- package/src/.github/skills/scientific-pharmacogenomics/SKILL.md +342 -0
- package/src/.github/skills/scientific-proteomics-mass-spectrometry/SKILL.md +401 -0
- package/src/.github/skills/scientific-regulatory-science/SKILL.md +256 -0
- package/src/.github/skills/scientific-scientific-schematics/SKILL.md +336 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-scientific-schematics
|
|
3
|
+
description: |
|
|
4
|
+
科学図式・作図スキル。CONSORT フロー図 (臨床試験)、実験プロトコルフロー、
|
|
5
|
+
ニューラルネットワークアーキテクチャ図、分子パスウェイ図、
|
|
6
|
+
TikZ/SVG/Mermaid ベースの出版品質ベクター図の生成、
|
|
7
|
+
AI レビューによる図の反復改善。
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Scientific Schematics
|
|
11
|
+
|
|
12
|
+
研究論文・プレゼンテーション向けの科学図式を
|
|
13
|
+
プログラマティックに生成するパイプライン。
|
|
14
|
+
CONSORT フロー図、NN アーキテクチャ図、パスウェイ図等を
|
|
15
|
+
TikZ / SVG / Mermaid で出版品質のベクター形式として出力する。
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- 臨床試験の CONSORT フロー図を作成するとき
|
|
20
|
+
- ニューラルネットワークアーキテクチャの図を生成するとき
|
|
21
|
+
- 分子パスウェイ・シグナル伝達経路図を描くとき
|
|
22
|
+
- 実験プロトコルのフローチャートが必要なとき
|
|
23
|
+
- 出版品質の SVG/PDF ベクター図を作成するとき
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
## 1. CONSORT フロー図
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
import json
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def generate_consort_diagram(enrollment, allocation_arms,
|
|
36
|
+
followup_lost, analyzed,
|
|
37
|
+
output_file="figures/consort_flow.svg"):
|
|
38
|
+
"""
|
|
39
|
+
CONSORT (Consolidated Standards of Reporting Trials) フロー図。
|
|
40
|
+
|
|
41
|
+
CONSORT 2010 チェックリスト準拠:
|
|
42
|
+
- Enrollment: 適格性評価 → 除外/ランダム化
|
|
43
|
+
- Allocation: 各群への割付
|
|
44
|
+
- Follow-up: 追跡 (脱落・中止)
|
|
45
|
+
- Analysis: 解析対象
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
# SVG 生成
|
|
49
|
+
svg_width = 800
|
|
50
|
+
svg_height = 900
|
|
51
|
+
box_width = 200
|
|
52
|
+
box_height = 60
|
|
53
|
+
|
|
54
|
+
svg_elements = []
|
|
55
|
+
svg_elements.append(
|
|
56
|
+
f'<svg xmlns="http://www.w3.org/2000/svg" '
|
|
57
|
+
f'width="{svg_width}" height="{svg_height}" '
|
|
58
|
+
f'viewBox="0 0 {svg_width} {svg_height}">'
|
|
59
|
+
)
|
|
60
|
+
svg_elements.append(
|
|
61
|
+
'<style>'
|
|
62
|
+
'.box { fill: white; stroke: black; stroke-width: 1.5; }'
|
|
63
|
+
'.text { font-family: Arial; font-size: 12px; text-anchor: middle; }'
|
|
64
|
+
'.label { font-family: Arial; font-size: 14px; font-weight: bold; }'
|
|
65
|
+
'.arrow { stroke: black; stroke-width: 1.5; marker-end: url(#arrowhead); }'
|
|
66
|
+
'</style>'
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Arrowhead marker
|
|
70
|
+
svg_elements.append(
|
|
71
|
+
'<defs><marker id="arrowhead" markerWidth="10" markerHeight="7" '
|
|
72
|
+
'refX="10" refY="3.5" orient="auto">'
|
|
73
|
+
'<polygon points="0 0, 10 3.5, 0 7" fill="black"/>'
|
|
74
|
+
'</marker></defs>'
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Enrollment box
|
|
78
|
+
cx = svg_width // 2
|
|
79
|
+
y = 30
|
|
80
|
+
svg_elements.append(
|
|
81
|
+
f'<rect class="box" x="{cx - box_width//2}" y="{y}" '
|
|
82
|
+
f'width="{box_width}" height="{box_height}" rx="5"/>'
|
|
83
|
+
)
|
|
84
|
+
svg_elements.append(
|
|
85
|
+
f'<text class="text" x="{cx}" y="{y + 25}">Assessed for eligibility</text>'
|
|
86
|
+
)
|
|
87
|
+
svg_elements.append(
|
|
88
|
+
f'<text class="text" x="{cx}" y="{y + 42}">(n={enrollment})</text>'
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
print(f" CONSORT flow diagram generated: {output_file}")
|
|
92
|
+
print(f" Enrollment: {enrollment}")
|
|
93
|
+
print(f" Arms: {len(allocation_arms)}")
|
|
94
|
+
print(f" Analyzed: {analyzed}")
|
|
95
|
+
|
|
96
|
+
svg_elements.append('</svg>')
|
|
97
|
+
svg_content = '\n'.join(svg_elements)
|
|
98
|
+
|
|
99
|
+
with open(output_file, 'w') as f:
|
|
100
|
+
f.write(svg_content)
|
|
101
|
+
|
|
102
|
+
return output_file
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 2. ニューラルネットワークアーキテクチャ図
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import json
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def generate_nn_architecture(layers, title="Neural Network Architecture",
|
|
112
|
+
output_file="figures/nn_architecture.svg"):
|
|
113
|
+
"""
|
|
114
|
+
ニューラルネットワークアーキテクチャ図の SVG 生成。
|
|
115
|
+
|
|
116
|
+
レイヤー定義例:
|
|
117
|
+
layers = [
|
|
118
|
+
{"name": "Input", "type": "input", "shape": "(B, 3, 224, 224)"},
|
|
119
|
+
{"name": "Conv1", "type": "conv", "params": "64 filters, 3×3"},
|
|
120
|
+
{"name": "BatchNorm", "type": "norm", "params": "64"},
|
|
121
|
+
{"name": "ReLU", "type": "activation"},
|
|
122
|
+
{"name": "MaxPool", "type": "pool", "params": "2×2"},
|
|
123
|
+
{"name": "FC", "type": "dense", "params": "512 → 10"},
|
|
124
|
+
{"name": "Softmax", "type": "output", "shape": "(B, 10)"},
|
|
125
|
+
]
|
|
126
|
+
"""
|
|
127
|
+
# 色マッピング
|
|
128
|
+
type_colors = {
|
|
129
|
+
"input": "#E8F5E9",
|
|
130
|
+
"conv": "#BBDEFB",
|
|
131
|
+
"norm": "#F3E5F5",
|
|
132
|
+
"activation": "#FFF9C4",
|
|
133
|
+
"pool": "#FFE0B2",
|
|
134
|
+
"dense": "#B2DFDB",
|
|
135
|
+
"attention": "#F8BBD0",
|
|
136
|
+
"residual": "#D1C4E9",
|
|
137
|
+
"output": "#FFCDD2",
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
svg_width = 300
|
|
141
|
+
box_height = 50
|
|
142
|
+
box_width = 240
|
|
143
|
+
gap = 15
|
|
144
|
+
svg_height = len(layers) * (box_height + gap) + 80
|
|
145
|
+
|
|
146
|
+
svg_parts = []
|
|
147
|
+
svg_parts.append(
|
|
148
|
+
f'<svg xmlns="http://www.w3.org/2000/svg" '
|
|
149
|
+
f'width="{svg_width}" height="{svg_height}">'
|
|
150
|
+
)
|
|
151
|
+
svg_parts.append(
|
|
152
|
+
'<style>.lbl{font-family:monospace;font-size:11px;text-anchor:middle;}</style>'
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
y = 40
|
|
156
|
+
cx = svg_width // 2
|
|
157
|
+
|
|
158
|
+
# Title
|
|
159
|
+
svg_parts.append(f'<text x="{cx}" y="20" '
|
|
160
|
+
f'style="font-family:Arial;font-size:14px;font-weight:bold;'
|
|
161
|
+
f'text-anchor:middle;">{title}</text>')
|
|
162
|
+
|
|
163
|
+
for i, layer in enumerate(layers):
|
|
164
|
+
color = type_colors.get(layer.get("type", ""), "#FFFFFF")
|
|
165
|
+
svg_parts.append(
|
|
166
|
+
f'<rect x="{cx - box_width//2}" y="{y}" '
|
|
167
|
+
f'width="{box_width}" height="{box_height}" '
|
|
168
|
+
f'rx="5" fill="{color}" stroke="#333" stroke-width="1"/>'
|
|
169
|
+
)
|
|
170
|
+
svg_parts.append(
|
|
171
|
+
f'<text class="lbl" x="{cx}" y="{y + 20}">{layer["name"]}</text>'
|
|
172
|
+
)
|
|
173
|
+
extra = layer.get("params", layer.get("shape", ""))
|
|
174
|
+
if extra:
|
|
175
|
+
svg_parts.append(
|
|
176
|
+
f'<text class="lbl" x="{cx}" y="{y + 36}" '
|
|
177
|
+
f'style="font-size:9px;fill:#666;">{extra}</text>'
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
# Arrow
|
|
181
|
+
if i < len(layers) - 1:
|
|
182
|
+
arrow_y = y + box_height
|
|
183
|
+
svg_parts.append(
|
|
184
|
+
f'<line x1="{cx}" y1="{arrow_y}" '
|
|
185
|
+
f'x2="{cx}" y2="{arrow_y + gap}" '
|
|
186
|
+
f'stroke="#333" stroke-width="1.5" marker-end="url(#arrowhead)"/>'
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
y += box_height + gap
|
|
190
|
+
|
|
191
|
+
svg_parts.append('</svg>')
|
|
192
|
+
|
|
193
|
+
with open(output_file, 'w') as f:
|
|
194
|
+
f.write('\n'.join(svg_parts))
|
|
195
|
+
|
|
196
|
+
print(f" NN architecture diagram: {output_file}")
|
|
197
|
+
print(f" Layers: {len(layers)}")
|
|
198
|
+
|
|
199
|
+
return output_file
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 3. 分子パスウェイ図 (Mermaid)
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
def generate_pathway_mermaid(pathway_name, nodes, edges,
|
|
206
|
+
output_file="figures/pathway.md"):
|
|
207
|
+
"""
|
|
208
|
+
分子パスウェイ / シグナル伝達経路の Mermaid 図生成。
|
|
209
|
+
|
|
210
|
+
ノードタイプ:
|
|
211
|
+
- receptor: 受容体 (細胞膜)
|
|
212
|
+
- kinase: キナーゼ
|
|
213
|
+
- tf: 転写因子
|
|
214
|
+
- gene: 標的遺伝子
|
|
215
|
+
- metabolite: 代謝産物
|
|
216
|
+
"""
|
|
217
|
+
mermaid_lines = ["```mermaid", "graph TD"]
|
|
218
|
+
|
|
219
|
+
# ノード定義
|
|
220
|
+
node_shapes = {
|
|
221
|
+
"receptor": ("([", "])"), # Stadium
|
|
222
|
+
"kinase": ("{{", "}}"), # Hexagon
|
|
223
|
+
"tf": ("[[", "]]"), # Subroutine
|
|
224
|
+
"gene": ("[/", "/]"), # Parallelogram
|
|
225
|
+
"metabolite": ("((", "))"), # Circle
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
for node in nodes:
|
|
229
|
+
nid = node["id"]
|
|
230
|
+
label = node["label"]
|
|
231
|
+
ntype = node.get("type", "default")
|
|
232
|
+
l_bracket, r_bracket = node_shapes.get(ntype, ("[", "]"))
|
|
233
|
+
mermaid_lines.append(f" {nid}{l_bracket}{label}{r_bracket}")
|
|
234
|
+
|
|
235
|
+
# エッジ定義
|
|
236
|
+
for edge in edges:
|
|
237
|
+
src = edge["from"]
|
|
238
|
+
tgt = edge["to"]
|
|
239
|
+
label = edge.get("label", "")
|
|
240
|
+
etype = edge.get("type", "activate")
|
|
241
|
+
|
|
242
|
+
if etype == "activate":
|
|
243
|
+
arrow = f"-->|{label}|" if label else "-->"
|
|
244
|
+
elif etype == "inhibit":
|
|
245
|
+
arrow = f"-.->|{label}|" if label else "-.->"
|
|
246
|
+
elif etype == "phosphorylate":
|
|
247
|
+
arrow = f"==>|{label}|" if label else "==>"
|
|
248
|
+
else:
|
|
249
|
+
arrow = "-->"
|
|
250
|
+
|
|
251
|
+
mermaid_lines.append(f" {src} {arrow} {tgt}")
|
|
252
|
+
|
|
253
|
+
mermaid_lines.append("```")
|
|
254
|
+
|
|
255
|
+
content = '\n'.join(mermaid_lines)
|
|
256
|
+
|
|
257
|
+
with open(output_file, 'w') as f:
|
|
258
|
+
f.write(content)
|
|
259
|
+
|
|
260
|
+
print(f" Pathway diagram: {output_file}")
|
|
261
|
+
print(f" Nodes: {len(nodes)}, Edges: {len(edges)}")
|
|
262
|
+
|
|
263
|
+
return output_file
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## 4. TikZ 出版品質図
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
def generate_tikz_figure(tikz_code, output_file="figures/tikz_figure.tex",
|
|
270
|
+
compile_pdf=True):
|
|
271
|
+
"""
|
|
272
|
+
TikZ (LaTeX) ベースの出版品質ベクター図。
|
|
273
|
+
|
|
274
|
+
テンプレート:
|
|
275
|
+
- 実験プロトコルフロー
|
|
276
|
+
- 統計解析ワークフロー
|
|
277
|
+
- 比較テーブル
|
|
278
|
+
- タイムライン (研究計画)
|
|
279
|
+
"""
|
|
280
|
+
latex_template = r"""\documentclass[border=5pt]{standalone}
|
|
281
|
+
\usepackage{tikz}
|
|
282
|
+
\usetikzlibrary{arrows.meta, positioning, shapes.geometric, calc}
|
|
283
|
+
\begin{document}
|
|
284
|
+
%s
|
|
285
|
+
\end{document}""" % tikz_code
|
|
286
|
+
|
|
287
|
+
with open(output_file, 'w') as f:
|
|
288
|
+
f.write(latex_template)
|
|
289
|
+
|
|
290
|
+
if compile_pdf:
|
|
291
|
+
import subprocess
|
|
292
|
+
import os
|
|
293
|
+
out_dir = os.path.dirname(output_file)
|
|
294
|
+
subprocess.run(
|
|
295
|
+
["pdflatex", "-output-directory", out_dir, output_file],
|
|
296
|
+
capture_output=True, timeout=30
|
|
297
|
+
)
|
|
298
|
+
pdf_file = output_file.replace(".tex", ".pdf")
|
|
299
|
+
print(f" TikZ compiled: {pdf_file}")
|
|
300
|
+
else:
|
|
301
|
+
print(f" TikZ source: {output_file}")
|
|
302
|
+
|
|
303
|
+
return output_file
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## References
|
|
307
|
+
|
|
308
|
+
### Output Files
|
|
309
|
+
|
|
310
|
+
| ファイル | 形式 |
|
|
311
|
+
|---|---|
|
|
312
|
+
| `figures/consort_flow.svg` | SVG |
|
|
313
|
+
| `figures/nn_architecture.svg` | SVG |
|
|
314
|
+
| `figures/pathway.md` | Mermaid Markdown |
|
|
315
|
+
| `figures/tikz_figure.tex` | LaTeX/TikZ |
|
|
316
|
+
| `figures/tikz_figure.pdf` | PDF |
|
|
317
|
+
|
|
318
|
+
### 利用可能ツール
|
|
319
|
+
|
|
320
|
+
> [ToolUniverse](https://github.com/mims-harvard/ToolUniverse) SMCP 経由で利用可能な外部ツール。
|
|
321
|
+
|
|
322
|
+
なし — ローカル SVG/TikZ/Mermaid 生成。
|
|
323
|
+
|
|
324
|
+
### 参照スキル
|
|
325
|
+
|
|
326
|
+
| スキル | 関連 |
|
|
327
|
+
|---|---|
|
|
328
|
+
| `scientific-visualization` | データ可視化全般 |
|
|
329
|
+
| `scientific-clinical-trials-analytics` | CONSORT 図のデータソース |
|
|
330
|
+
| `scientific-grant-writing` | 研究計画図 |
|
|
331
|
+
| `scientific-network-analysis` | ネットワーク図 |
|
|
332
|
+
| `scientific-presentation` | プレゼン素材 |
|
|
333
|
+
|
|
334
|
+
### 依存パッケージ
|
|
335
|
+
|
|
336
|
+
`json`, `os`, `subprocess` (TikZ コンパイル時のみ `texlive`)
|