STEP 11 / 15

生態棲位 (Niche):把組織描述成「鄰居組合」

不只看「我是誰」,更看「我的鄰居是誰」——這就是 niche。

Not only "what cell am I" but also "who are my neighbors" — that is a niche.

一、Spatial Domain vs Niche vs CN

概念輸入目的
Spatial Domainspot/cell 的 expression + 位置把組織分成大區塊(皮層、髓質、腫瘤核心…)spot/cell expression + positionPartition tissue into large regions (cortex, medulla, tumor core…)
Niche每個 cell 的鄰域 cell-type 組成分類「微環境」(如「T-rich 邊界 niche」、「血管周圍 niche」)Each cell's neighbor compositionClassify microenvironments ("T-rich margin niche", "perivascular niche")
Cellular Neighborhood (CN)同 niche,更強調免疫/腫瘤 immunology 場景找出反覆出現的免疫架構(CODEX/MIBI 用詞)Same as niche, immunology-focused termFind recurrent immune architectures (term from CODEX/MIBI)
💡
關鍵差別:spatial domain 看「我自己表達什麼」;niche 看「我周遭是誰」。同一個 T cell 可能在不同 niche 裡:腫瘤旁、血管旁、淋巴聚集區。 Key distinction: spatial domain = "what I express"; niche = "who is around me". The same T cell can sit in many niches: tumor-adjacent, perivascular, lymphoid aggregate.

三、典型 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?

A. niche 不需要空間資訊A. Niche doesn't need spatial info
B. domain 看自己 expression;niche 看周遭鄰居組成B. Domain looks at one's own expression; niche looks at surrounding neighbors
C. 兩者完全相同C. They are identical
D. niche 不能用 GNND. Niche can't use GNNs

2. 想要快速、零成本看「哪兩個 cluster 比隨機更常相鄰」,最方便?

2. Quickest, zero-cost way to ask "which two clusters are adjacent more than chance"?

A. CellCharterA. CellCharter
B. NicheCompassB. NicheCompass
C. Squidpy nhood_enrichmentC. Squidpy nhood_enrichment
D. SpatialDED. SpatialDE

3. NicheCompass 的特色?

3. What distinguishes NicheCompass?

A. 把 signaling pathway 知識當 prior 嵌入模型A. Embeds signaling-pathway priors into the model
B. 不需 spatial 資訊B. Needs no spatial info
C. 只支援 RC. R-only
D. 取代 deconvolutionD. Replaces deconvolution