一、Spatial Domain vs Niche vs CN
| 概念 | 輸入 | 目的 | ||
|---|---|---|---|---|
| Spatial Domain | spot/cell 的 expression + 位置 | 把組織分成大區塊(皮層、髓質、腫瘤核心…) | spot/cell expression + position | Partition tissue into large regions (cortex, medulla, tumor core…) |
| Niche | 每個 cell 的鄰域 cell-type 組成 | 分類「微環境」(如「T-rich 邊界 niche」、「血管周圍 niche」) | Each cell's neighbor composition | Classify microenvironments ("T-rich margin niche", "perivascular niche") |
| Cellular Neighborhood (CN) | 同 niche,更強調免疫/腫瘤 immunology 場景 | 找出反覆出現的免疫架構(CODEX/MIBI 用詞) | Same as niche, immunology-focused term | Find recurrent immune architectures (term from CODEX/MIBI) |
二、主流工具
🧱 CellCharter
scvi-tools 系列出品。把 spatial graph 上的細胞先學成 latent embedding,再用 GMM 找 niche。支援 multi-omics(RNA + protein)整合。
From scvi-tools. Learns latent embeddings on the spatial graph, then GMM-clusters to find niches. Supports multi-omics (RNA + protein) integration.
🧭 NicheCompass
把已知 signaling pathway 當 prior 嵌入 GNN,學出來的 niche 帶 pathway-level 解釋性。
Uses known signaling pathways as prior in a GNN; resulting niches carry pathway-level interpretability.
🧪 scNiche
把 neighborhood cell-type 組成 + 影像衍生形態特徵一起學,特別針對 image-based ST。
Combines neighborhood cell-type composition with image-derived morphology — built for image-based ST.
📊 Squidpy nhood_enrichment
最簡單入門:用 permutation 檢定算「哪兩個 cluster 比隨機更常相鄰」。Squidpy 內建、零成本。
Simplest entry point: a permutation test for "which two clusters appear adjacent more than chance." Built into Squidpy, zero-cost.
三、典型 niche 分析步驟
先建細胞類型圖
image-based 直接 segmentation + clustering;spot-based 透過 deconvolution 取每 spot 的細胞類型分布。
image-based: segmentation + clustering; spot-based: get cell-type composition per spot via deconvolution.
建 spatial graph
k-NN 或 Delaunay;image-based 常用 r = 30 µm 內的鄰居。
k-NN or Delaunay; image-based usually picks neighbors within r = 30 µm.
計算 CN vector
每顆細胞 → 鄰居中各 cell-type 的比例向量。
For each cell → vector of cell-type fractions among its neighbors.
cluster CN vector
k-means / Leiden → 每群代表一種 niche。
k-means / Leiden → each cluster = a niche type.
解釋與比較
把 niche 標籤畫回組織,看是否符合解剖;組間(如治療 vs 對照)比較 niche 比例。
Project niche labels back onto tissue; compare niche frequencies across conditions (e.g. treated vs control).
互動:CN vector 的形成
下圖每個圓代表一顆細胞,顏色 = cell-type。把滑鼠移到某顆細胞上(或拖動半徑),看下方 bar chart:「該細胞的鄰居中有多少比例屬於 A、B、C 類」——這就是 CN vector。
Each dot is a cell; color = cell-type. Hover a cell (or change the radius) — the bar chart at the bottom shows "fraction of neighbors per type" = its CN vector.
移動滑鼠到任一細胞觀察其 CN vector
實作
# Seurat v5 內建 BuildNicheAssay (Visium / Xenium) vis <- BuildNicheAssay(object = vis, fov = "fov", group.by = "celltype", niches.k = 6) SpatialDimPlot(vis, group.by = "niches")
# 簡易:Squidpy nhood_enrichment sq.gr.spatial_neighbors(adata, coord_type="generic", delaunay=True) sq.gr.nhood_enrichment(adata, cluster_key="celltype") sq.pl.nhood_enrichment(adata, cluster_key="celltype") # 進階:CellCharter import cellcharter as cc cc.gr.aggregate_neighbors(adata, n_layers=3, aggregations="mean") gmm = cc.tl.Cluster(model_class="GaussianMixture", n_clusters=8) gmm.fit(adata, use_rep="X_cellcharter"); adata.obs["niche"] = gmm.predict(adata, use_rep="X_cellcharter")
📝 自我檢測
1. Spatial domain 與 niche 最關鍵差別?
1. Most important distinction between spatial domain and niche?
2. 想要快速、零成本看「哪兩個 cluster 比隨機更常相鄰」,最方便?
2. Quickest, zero-cost way to ask "which two clusters are adjacent more than chance"?
3. NicheCompass 的特色?
3. What distinguishes NicheCompass?