@nahisaho/satori 0.15.0 → 0.17.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 +67 -29
- package/package.json +1 -1
- package/src/.github/skills/scientific-data-submission/SKILL.md +357 -0
- package/src/.github/skills/scientific-encode-screen/SKILL.md +315 -0
- package/src/.github/skills/scientific-environmental-geodata/SKILL.md +255 -0
- package/src/.github/skills/scientific-geo-expression/SKILL.md +274 -0
- package/src/.github/skills/scientific-gpu-singlecell/SKILL.md +296 -0
- package/src/.github/skills/scientific-human-cell-atlas/SKILL.md +294 -0
- package/src/.github/skills/scientific-marine-ecology/SKILL.md +429 -0
- package/src/.github/skills/scientific-metabolic-atlas/SKILL.md +263 -0
- package/src/.github/skills/scientific-nci60-screening/SKILL.md +307 -0
- package/src/.github/skills/scientific-paleobiology/SKILL.md +265 -0
- package/src/.github/skills/scientific-parasite-genomics/SKILL.md +280 -0
- package/src/.github/skills/scientific-plant-biology/SKILL.md +321 -0
- package/src/.github/skills/scientific-rrna-taxonomy/SKILL.md +379 -0
- package/src/.github/skills/scientific-scatac-signac/SKILL.md +300 -0
- package/src/.github/skills/scientific-squidpy-advanced/SKILL.md +251 -0
- package/src/.github/skills/scientific-toxicology-env/SKILL.md +309 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scientific-human-cell-atlas
|
|
3
|
+
description: |
|
|
4
|
+
Human Cell Atlas (HCA) データポータルスキル。HCA Data Portal API
|
|
5
|
+
プロジェクト検索・ファイルダウンロード・CELLxGENE Census 統合・
|
|
6
|
+
細胞型アノテーション・アトラス構築。ToolUniverse 連携: hca_tools。
|
|
7
|
+
tu_tools:
|
|
8
|
+
- key: hca_tools
|
|
9
|
+
name: Human Cell Atlas Tools
|
|
10
|
+
description: HCA データポータル プロジェクト・バンドル・ファイル検索
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Scientific Human Cell Atlas
|
|
14
|
+
|
|
15
|
+
HCA Data Portal / CELLxGENE Census を活用した大規模シングルセル
|
|
16
|
+
アトラスデータアクセス・解析パイプラインを提供する。
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
- HCA Data Portal からプロジェクト・実験データを検索するとき
|
|
21
|
+
- CELLxGENE Census で大規模シングルセルアトラスを照会するとき
|
|
22
|
+
- 特定組織/疾患の細胞型構成を調べるとき
|
|
23
|
+
- 複数 HCA プロジェクト間で細胞型を比較するとき
|
|
24
|
+
- シングルセルアトラスのリファレンスマッピングを行うとき
|
|
25
|
+
- 希少細胞型の発見・アノテーションを実施するとき
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
## 1. HCA Data Portal プロジェクト検索
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import requests
|
|
35
|
+
import pandas as pd
|
|
36
|
+
import json
|
|
37
|
+
|
|
38
|
+
HCA_BASE = "https://service.azul.data.humancellatlas.org"
|
|
39
|
+
HCA_CATALOG = "dcp44"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def hca_search_projects(keyword=None, organ=None, disease=None,
|
|
43
|
+
species="Homo sapiens", limit=25):
|
|
44
|
+
"""
|
|
45
|
+
HCA Data Portal — プロジェクト検索。
|
|
46
|
+
|
|
47
|
+
Parameters:
|
|
48
|
+
keyword: str — キーワード検索
|
|
49
|
+
organ: str — 臓器 (例: "lung", "heart")
|
|
50
|
+
disease: str — 疾患 (例: "COVID-19")
|
|
51
|
+
species: str — 生物種
|
|
52
|
+
limit: int — 最大結果数
|
|
53
|
+
"""
|
|
54
|
+
url = f"{HCA_BASE}/index/projects"
|
|
55
|
+
params = {"catalog": HCA_CATALOG, "size": limit}
|
|
56
|
+
|
|
57
|
+
filters = {}
|
|
58
|
+
if organ:
|
|
59
|
+
filters["organ"] = {"is": [organ]}
|
|
60
|
+
if disease:
|
|
61
|
+
filters["disease"] = {"is": [disease]}
|
|
62
|
+
if species:
|
|
63
|
+
filters["genusSpecies"] = {"is": [species]}
|
|
64
|
+
if keyword:
|
|
65
|
+
params["q"] = keyword
|
|
66
|
+
if filters:
|
|
67
|
+
params["filters"] = json.dumps(filters)
|
|
68
|
+
|
|
69
|
+
resp = requests.get(url, params=params, timeout=30)
|
|
70
|
+
resp.raise_for_status()
|
|
71
|
+
data = resp.json()
|
|
72
|
+
|
|
73
|
+
projects = []
|
|
74
|
+
for hit in data.get("hits", []):
|
|
75
|
+
proj = hit.get("projects", [{}])[0]
|
|
76
|
+
samples = hit.get("samples", [{}])[0]
|
|
77
|
+
protocols = hit.get("protocols", [{}])[0]
|
|
78
|
+
projects.append({
|
|
79
|
+
"project_id": proj.get("projectId", ""),
|
|
80
|
+
"title": proj.get("projectTitle", ""),
|
|
81
|
+
"organ": ", ".join(samples.get("organ", [])),
|
|
82
|
+
"disease": ", ".join(samples.get("disease", [])),
|
|
83
|
+
"species": ", ".join(samples.get("genusSpecies", [])),
|
|
84
|
+
"cell_count": hit.get("cellSuspensions", [{}])[0].get(
|
|
85
|
+
"totalCells", 0),
|
|
86
|
+
"library_method": ", ".join(protocols.get(
|
|
87
|
+
"libraryConstructionApproach", [])),
|
|
88
|
+
"donor_count": samples.get("donorCount", 0),
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
df = pd.DataFrame(projects)
|
|
92
|
+
print(f"HCA: {len(df)} projects found")
|
|
93
|
+
return df
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 2. HCA ファイル取得
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
def hca_get_project_files(project_id, file_format=None):
|
|
100
|
+
"""
|
|
101
|
+
HCA — プロジェクトのファイル一覧取得。
|
|
102
|
+
|
|
103
|
+
Parameters:
|
|
104
|
+
project_id: str — プロジェクト UUID
|
|
105
|
+
file_format: str — ファイル形式 (例: "h5ad", "loom", "csv")
|
|
106
|
+
"""
|
|
107
|
+
url = f"{HCA_BASE}/index/files"
|
|
108
|
+
filters = {"projectId": {"is": [project_id]}}
|
|
109
|
+
if file_format:
|
|
110
|
+
filters["fileFormat"] = {"is": [file_format]}
|
|
111
|
+
|
|
112
|
+
params = {
|
|
113
|
+
"catalog": HCA_CATALOG,
|
|
114
|
+
"filters": json.dumps(filters),
|
|
115
|
+
"size": 100,
|
|
116
|
+
}
|
|
117
|
+
resp = requests.get(url, params=params, timeout=30)
|
|
118
|
+
resp.raise_for_status()
|
|
119
|
+
data = resp.json()
|
|
120
|
+
|
|
121
|
+
files = []
|
|
122
|
+
for hit in data.get("hits", []):
|
|
123
|
+
for f in hit.get("files", []):
|
|
124
|
+
files.append({
|
|
125
|
+
"file_id": f.get("uuid", ""),
|
|
126
|
+
"name": f.get("name", ""),
|
|
127
|
+
"format": f.get("format", ""),
|
|
128
|
+
"size_bytes": f.get("size", 0),
|
|
129
|
+
"url": f.get("url", ""),
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
df = pd.DataFrame(files)
|
|
133
|
+
print(f"HCA files ({project_id[:8]}): {len(df)} files")
|
|
134
|
+
return df
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 3. CELLxGENE Census アトラスクエリ
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
def cellxgene_census_query(organism="homo_sapiens", tissue=None,
|
|
141
|
+
disease=None, cell_type=None,
|
|
142
|
+
gene_list=None, max_cells=50000):
|
|
143
|
+
"""
|
|
144
|
+
CELLxGENE Census — 大規模シングルセルアトラスクエリ。
|
|
145
|
+
|
|
146
|
+
Parameters:
|
|
147
|
+
organism: str — 生物種
|
|
148
|
+
tissue: str — 組織
|
|
149
|
+
disease: str — 疾患
|
|
150
|
+
cell_type: str — 細胞型
|
|
151
|
+
gene_list: list[str] — 取得遺伝子リスト
|
|
152
|
+
max_cells: int — 最大細胞数
|
|
153
|
+
"""
|
|
154
|
+
import cellxgene_census
|
|
155
|
+
|
|
156
|
+
census = cellxgene_census.open_soma()
|
|
157
|
+
|
|
158
|
+
# 観察フィルタ構築
|
|
159
|
+
obs_filters = []
|
|
160
|
+
if tissue:
|
|
161
|
+
obs_filters.append(f"tissue == '{tissue}'")
|
|
162
|
+
if disease:
|
|
163
|
+
obs_filters.append(f"disease == '{disease}'")
|
|
164
|
+
if cell_type:
|
|
165
|
+
obs_filters.append(f"cell_type == '{cell_type}'")
|
|
166
|
+
|
|
167
|
+
obs_filter = " and ".join(obs_filters) if obs_filters else None
|
|
168
|
+
|
|
169
|
+
# 遺伝子フィルタ
|
|
170
|
+
var_filter = None
|
|
171
|
+
if gene_list:
|
|
172
|
+
genes_str = "', '".join(gene_list)
|
|
173
|
+
var_filter = f"feature_name in ['{genes_str}']"
|
|
174
|
+
|
|
175
|
+
adata = cellxgene_census.get_anndata(
|
|
176
|
+
census,
|
|
177
|
+
organism=organism,
|
|
178
|
+
obs_value_filter=obs_filter,
|
|
179
|
+
var_value_filter=var_filter,
|
|
180
|
+
obs_column_names=[
|
|
181
|
+
"cell_type", "tissue", "disease",
|
|
182
|
+
"donor_id", "dataset_id", "assay",
|
|
183
|
+
],
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
if adata.n_obs > max_cells:
|
|
187
|
+
import numpy as np
|
|
188
|
+
idx = np.random.choice(adata.n_obs, max_cells, replace=False)
|
|
189
|
+
adata = adata[idx].copy()
|
|
190
|
+
|
|
191
|
+
census.close()
|
|
192
|
+
print(f"CELLxGENE Census: {adata.n_obs} cells × {adata.n_vars} genes")
|
|
193
|
+
return adata
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 4. 細胞型構成解析
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
import scanpy as sc
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def cell_type_composition(adata, groupby="tissue", cell_type_col="cell_type"):
|
|
203
|
+
"""
|
|
204
|
+
細胞型構成の定量比較。
|
|
205
|
+
|
|
206
|
+
Parameters:
|
|
207
|
+
adata: AnnData — シングルセルデータ
|
|
208
|
+
groupby: str — グループ変数
|
|
209
|
+
cell_type_col: str — 細胞型カラム名
|
|
210
|
+
"""
|
|
211
|
+
# 構成比計算
|
|
212
|
+
composition = (
|
|
213
|
+
adata.obs.groupby([groupby, cell_type_col])
|
|
214
|
+
.size()
|
|
215
|
+
.unstack(fill_value=0)
|
|
216
|
+
)
|
|
217
|
+
composition_pct = composition.div(composition.sum(axis=1), axis=0) * 100
|
|
218
|
+
|
|
219
|
+
print(f"Cell type composition: {composition.shape[0]} groups × "
|
|
220
|
+
f"{composition.shape[1]} cell types")
|
|
221
|
+
return composition_pct
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 5. HCA 統合パイプライン
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
def hca_atlas_pipeline(organ, disease=None, output_dir="results"):
|
|
228
|
+
"""
|
|
229
|
+
HCA + CELLxGENE 統合アトラスパイプライン。
|
|
230
|
+
|
|
231
|
+
Parameters:
|
|
232
|
+
organ: str — 対象臓器
|
|
233
|
+
disease: str — 対象疾患
|
|
234
|
+
output_dir: str — 出力ディレクトリ
|
|
235
|
+
"""
|
|
236
|
+
from pathlib import Path
|
|
237
|
+
output_dir = Path(output_dir)
|
|
238
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
239
|
+
|
|
240
|
+
# 1) HCA プロジェクト検索
|
|
241
|
+
projects = hca_search_projects(organ=organ, disease=disease)
|
|
242
|
+
projects.to_csv(output_dir / "hca_projects.csv", index=False)
|
|
243
|
+
|
|
244
|
+
# 2) CELLxGENE Census クエリ
|
|
245
|
+
adata = cellxgene_census_query(tissue=organ, disease=disease)
|
|
246
|
+
|
|
247
|
+
# 3) 前処理
|
|
248
|
+
sc.pp.normalize_total(adata, target_sum=1e4)
|
|
249
|
+
sc.pp.log1p(adata)
|
|
250
|
+
sc.pp.highly_variable_genes(adata, n_top_genes=2000)
|
|
251
|
+
adata = adata[:, adata.var["highly_variable"]].copy()
|
|
252
|
+
sc.pp.pca(adata)
|
|
253
|
+
sc.pp.neighbors(adata)
|
|
254
|
+
sc.tl.umap(adata)
|
|
255
|
+
|
|
256
|
+
# 4) 細胞型構成
|
|
257
|
+
composition = cell_type_composition(adata)
|
|
258
|
+
composition.to_csv(output_dir / "cell_type_composition.csv")
|
|
259
|
+
|
|
260
|
+
# 5) 保存
|
|
261
|
+
adata.write(output_dir / "hca_atlas.h5ad")
|
|
262
|
+
|
|
263
|
+
print(f"HCA atlas pipeline: {output_dir}")
|
|
264
|
+
return {"projects": projects, "adata": adata, "composition": composition}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## ToolUniverse 連携
|
|
270
|
+
|
|
271
|
+
| TU Key | ツール名 | 連携内容 |
|
|
272
|
+
|--------|---------|---------|
|
|
273
|
+
| `hca_tools` | HCA Tools | プロジェクト検索・ファイルダウンロード |
|
|
274
|
+
|
|
275
|
+
## パイプライン統合
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
single-cell-genomics → human-cell-atlas → scvi-integration
|
|
279
|
+
(scanpy 標準) (HCA/CELLxGENE) (scVI 統合)
|
|
280
|
+
│ │ ↓
|
|
281
|
+
spatial-transcriptomics ───┘ cell-type-annotation
|
|
282
|
+
(Visium/MERFISH) │ (リファレンスマッピング)
|
|
283
|
+
↓
|
|
284
|
+
gpu-singlecell
|
|
285
|
+
(大規模処理)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## パイプライン出力
|
|
289
|
+
|
|
290
|
+
| ファイル | 説明 | 次スキル |
|
|
291
|
+
|---------|------|---------|
|
|
292
|
+
| `results/hca_projects.csv` | HCA プロジェクト一覧 | → single-cell-genomics |
|
|
293
|
+
| `results/hca_atlas.h5ad` | アトラス AnnData | → scvi-integration |
|
|
294
|
+
| `results/cell_type_composition.csv` | 細胞型構成比 | → spatial-transcriptomics |
|