mcpField
C
cellchat-cell-communication

cellchat-cell-communication

github.com/jaechang-hitsデータ・データベース38480 回インストール6 日前に更新
リポジトリ

cellchat-cell-communication について

CellChat は、単一細胞 RNA-seq データの細胞間シグナル伝達を調べる研究者向けの R パッケージです。キュレーションされたリガンド・受容体データベースを使って通信ネットワークを推定・可視化し、条件間の比較も行えます。

主な機能

  1. 01リガンド・受容体相互作用の推定
  2. 02細胞群間の通信確率の算出
  3. 03経路レベルのシグナルネットワーク集約
  4. 04送信細胞と受信細胞の役割分析
  5. 05条件間のネットワーク比較
  6. 06ネットワーク図・ヒートマップ・バブルプロット

活用シーン

  1. 01組織内の主なシグナル送信細胞や受信細胞の特定
  2. 02選択した細胞群間のリガンド・受容体ペアの探索
  3. 03健常サンプルと疾患サンプルのシグナル網比較
  4. 04摂動実験に向けたシグナル経路の優先順位付け

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/jaechang-hits/sciagent-skills --skill cellchat-cell-communication

インストール後、Claude Code で/cellchat-cell-communicationを入力して読み込まれたか確認します。

詳細

CellChat — 細胞間コミュニケーション解析

概要

CellChat は、シングルセル RNA-seq データから細胞間シグナル伝達ネットワークを推定し、可視化する R パッケージです。正規化済み発現行列とクラスターラベルを入力として、CellChatDB が裏付けるリガンド・受容体相互作用を特定します。CellChatDB は、ヒトとマウスで検証済みの 2,000 を超えるリガンド・受容体ペアを収録した、手作業でキュレーションされたデータベースです。コミュニケーション確率は、リガンド、受容体、補因子の発現量を組み合わせ、質量作用の法則を用いてモデル化されます。CellChat はペアレベルの確率を集約して経路レベルのシグナル伝達ネットワークを構築し、各細胞グループがシグナルの送信者、受信者、仲介者、または影響者として果たす役割を定量化します。その結果、どの細胞種が、どのシグナル伝達経路を介して相互作用するのか、また条件間でこれらのパターンがどのように変化するのかを、豊かで解釈しやすい形で把握できます。

使用する場面

  • 組織アトラスや疾患サンプルにおいて、どの細胞種が傍分泌シグナルや自己分泌シグナルの主な送信者または受信者なのかを特定する
  • 注目する細胞集団間のコミュニケーションを媒介する特定のリガンド・受容体ペアを特定する(例:腫瘍細胞 → T 細胞、線維芽細胞 → 上皮細胞)
  • 2 つの条件間の細胞間シグナル伝達ネットワークを比較し(例:健常 vs. 疾患、治療 vs. 対照)、再編成または消失したコミュニケーションを見つける
  • 特定の細胞間相互作用で濃縮される、経路レベルのシグナル伝達プログラムを発見する(例:MHC-II、COLLAGEN、VEGF)
  • 集約されたコミュニケーション強度やネットワーク中心性に基づいてシグナル伝達経路を順位付けし、摂動実験の標的候補を優先付けする
  • エクスポートしたテーブルから一般的な図を作成するには、omics-plotting SKILL(Python)を使用します。ネットワークのコード図/ヒートマップ/バブル図には、CellChat の R netVisual_* を使用します
  • 純粋な Python ワークフローや、複数のリガンド・受容体データベース(CellChat、CellPhoneDB、Connectome、NicheNet)を横断したコンセンサス順位付けが必要な場合は、代わりに liana(Python/R)を使用します
  • リガンドから標的への遺伝子制御推定が必要な場合は、代わりに NicheNet(R)を使用します。これは、送信細胞のどのリガンドが受信細胞のどの標的遺伝子を制御するかを予測します

前提条件

  • R パッケージ:CellChat(>= 2.0)、Seurat(>= 4.0、Seurat ベースの入力用)、NMF、ggplot2、ggalluvial、igraph、dplyr、patchwork、reticulate(任意)
  • データ要件:正規化済みの scRNA-seq カウント行列(遺伝子 × 細胞)と細胞グループの識別ベクトル(クラスターラベルまたは細胞種)が必要です。CellChat 内で正規化する場合は、生カウントも使用できます。
  • 種:CellChatDB はヒトとマウスで利用できます。他の種ではカスタムデータベースの構築が必要です
  • メモリ:10,000~50,000 個の細胞を含むデータセットには、最低 8 GB の RAM が必要です。より大きなデータセットには 32 GB 以上を推奨します
# Install CellChat from GitHub (CRAN version may lag)
if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(c("BiocNeighbors", "ComplexHeatmap"))

install.packages("devtools")
devtools::install_github("jinworks/CellChat")

# Core dependencies
install.packages(c("NMF", "ggplot2", "ggalluvial", "igraph",
                   "dplyr", "patchwork", "circlize", "RColorBrewer"))

事前確認

分析コードを書く前に、次の項目についてユーザーと確認してください。

decisions:
  - id: D1
    param: cellGroupLabels
    kind: derived
    source: upstream
    ask: "Which annotation column defines the sender and receiver groups?"
    default: "the cell-type labels assigned upstream"

  - id: D2
    param: ligandReceptorDatabase
    kind: required
    source: user
    ask: "Which species database, and should it cover all interactions or only secreted signalling, ECM-receptor, or cell-contact?"
    default: "species-matched, all interaction categories"

  - id: D3
    param: minCellsPerGroup
    kind: required
    source: user
    ask: "How few cells may a group have before its inferred signalling stops being trustworthy?"
    default: 10

  - id: D4
    param: expressionAggregation
    kind: optional
    source: user
    ask: "How should per-group expression be summarized - stringently, or more permissively so weaker signals survive?"
    default: "triMean, the most stringent option"

  - id: D5
    param: populationSizeWeighting
    kind: optional
    source: user
    ask: "Should communication probability account for how many cells each group has?"
    default: "weighted"

  - id: D6
    param: bootstrapIterations
    kind: optional_conditional
    source: user
    ask: "More bootstrap rounds give finer p-values at proportionally more runtime - is the default enough?"
    default: 100

  - id: D7
    param: communicationPatterns
    kind: optional_conditional
    source: data
    ask: "How many latent signalling patterns should the data be decomposed into?"
    default: "chosen from the selectK elbow"

  - id: D8
    param: centralityThreshold
    kind: optional
    source: user
    ask: "Which interactions are strong enough to enter the network-centrality analysis?"
    default: "p-value 0.05"

D1 は、これらのグループがユーザーが上流工程ですでに決定したアノテーションに由来するため、導出されます。再度質問すると、クラスターに付与されているものとは異なるラベルセットになりかねません。D4 は、デフォルトの説明以上に結果を左右します。厳格な集約では、グループの一部でしか発現していない相互作用が除外されます。これは通常は適切ですが、探しているシグナルが隠れてしまう場合もあります。

クイックスタート

library(CellChat)
library(Seurat)

# Assume `seurat_obj` is a processed Seurat object with cell type identities in Idents()
data.input <- GetAssayData(seurat_obj, assay = "RNA", slot = "data")  # normalized counts
meta       <- data.frame(labels = Idents(seurat_obj), row.names = names(Idents(seurat_obj)))

cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")
cellchat@DB <- CellChatDB.human  # or CellChatDB.mouse

cellchat <- subsetData(cellchat)
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- computeCommunProb(cellchat, type = "triMean")
cellchat <- filterCommunication(cellchat, min.cells = 10)
cellchat <- computeCommunProbPathway(cellchat)
cellchat <- aggregateNet(cellchat)

# Quick summary
print(cellchat)
# e.g. "An object of class CellChat created from a single dataset
#  with 8 cell groups and 312 inferred ligand-receptor pairs"

ワークフロー

ステップ 1:CellChat オブジェクトを作成する

Seurat オブジェクト、またはメタデータを付属した生カウント行列から CellChat オブジェクトを作成します。

library(CellChat)
library(Seurat)

# --- Option A: from a Seurat object ---
# seurat_obj must have cell type identities set with Idents() or in meta.data
data.input <- GetAssayData(seurat_obj, assay = "RNA", slot = "data")  # log-normalized
meta <- data.frame(
  labels = Idents(seurat_obj),
  row.names = colnames(seurat_obj)
)
cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")

# --- Option B: from a count matrix directly ---
# data.input: genes-by-cells normalized matrix (dgCMatrix or dense matrix)
# identity: named factor of cell group labels (length = ncol(data.input))
cellchat <- createCellChat(object = data.input, meta = data.frame(labels = identity),
                           group.by = "labels")

cat("Cell groups:", levels(cellchat@idents), "\n")
cat("Number of cells:", ncol(data.input), "\n")
# Cell groups: B_cell Endothelial Fibroblast Macrophage NK T_cell Tumor
# Number of cells: 12847
ステップ 2:CellChatDB を設定し、相互作用を絞り込む

種に適したリガンド・受容体データベースを読み込み、必要に応じて関心のあるシグナル伝達カテゴリーに絞り込みます。

# Load database for the appropriate species
CellChatDB <- CellChatDB.human   # use CellChatDB.mouse for mouse data

# Inspect available signaling categories
unique(CellChatDB$interaction$annotation)
# [1] "Secreted Signaling"    "ECM-Receptor"          "Cell-Cell Contact"

# Option 1: Use all interactions (recommended for discovery)
cellchat@DB <- CellChatDB

# Option 2: Subset to secreted ligand-receptor pairs only (reduces noise)
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling",
                           key = "annotation")
cellchat@DB <- CellChatDB.use

# Subset the CellChat data slots to only genes in the database
cellchat <- subsetData(cellchat)
cat("Genes retained after database subset:", nrow([email protected]), "\n")
# Genes retained after database subset: 1842
ステップ 3:過剰発現遺伝子と相互作用を特定する

各細胞グループについて、他のグループと比較して有意に過剰発現しているリガンドと受容体を特定します。

# Identify over-expressed genes per cell group (uses Seurat-style wilcoxon test)
cellchat <- identifyOverExpressedGenes(cellchat)

# Map over-expressed genes to ligand-receptor pairs in CellChatDB
cellchat <- identifyOverExpressedInteractions(cellchat)

# Inspect how many interactions were identified per group pair
df.net <- subsetCommunication(cellchat)
cat("Total inferred interactions:", nrow(df.net), "\n")
head(df.net[, c("source", "target", "ligand", "receptor", "prob")], 5)
#      source   target  ligand receptor      prob
# 1   B_cell Macrophage  CD22     PTPRC 0.0318
# 2 Fibroblast    Tumor   FN1     CD44  0.1072
# ...
ステップ 4:細胞間コミュニケーション確率を推定する

作用質量の法則を用いて、すべての順序付き細胞グループペア間における各リガンド・受容体ペアのコミュニケーション確率を計算します。CellChat は、多サブユニット複合体と共刺激性/共抑制性補因子を考慮します。

# Compute pairwise communication probability
# type = "triMean": uses 25th percentile × mean × 25th percentile for robustness
# type = "truncatedMean": uses trimmed mean with threshold parameter trim
cellchat <- computeCommunProb(
  cellchat,
  type          = "triMean",   # recommended default
  trim          = 0.1,         # fraction to trim (only used if type="truncatedMean")
  nboot         = 100,         # bootstrap iterations for p-value estimation
  seed.use      = 42,
  population.size = TRUE       # weight by population size (recommended)
)

# Filter out interactions with too few cells in sender or receiver groups
cellchat <- filterCommunication(cellchat, min.cells = 10)

# Summary of retained interactions
df.net <- subsetCommunication(cellchat)
cat("Interactions after filtering:", nrow(df.net), "\n")
cat("Significant interactions (p<0.05):", sum(df.net$pval < 0.05), "\n")
# Interactions after filtering: 247
# Significant interactions (p<0.05): 189
ステップ 5:経路レベルのコミュニケーションを計算する

リガンド・受容体ペアの確率をシグナル伝達経路レベルのネットワーク(例:COLLAGEN、MHC-II、VEGF)に集約します。

# Aggregate to pathway level
cellchat <- computeCommunProbPathway(cellchat)

# Build aggregate interaction count and weight networks
cellchat <- aggregateNet(cellchat)

# View significant pathways
cat("Significant signaling pathways:\n")
print(cellchat@netP$pathways)
# [1] "MHC-II"    "COLLAGEN"  "FN1"       "VEGF"      "CXCL"
# [6] "CCL"       "MIF"       "APP"       "GALECTIN"  ...

# Extract pathway-level communication probabilities between groups
df.pathways <- subsetCommunication(cellchat, slot.name = "netP")
head(df.pathways[, c("source", "target", "pathway_name", "prob")], 5)
#        source    target pathway_name     prob
# 1  Fibroblast     Tumor     COLLAGEN   0.2341
# 2  Macrophage  Fibroblast     MIF    0.1876
# ...
ステップ 6:ネットワーク中心性を分析する — 送信側、受信側、影響力のあるグループ

情報フローの指標を計算して、各細胞グループのネットワーク上の役割を特定します。指標には、外向き強度(送信側)、内向き強度(受信側)、媒介中心性(媒介役)、固有ベクトル中心性(影響力のあるグループ)があります。

# Compute centrality measures for all pathways
cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP")

# Visualize centrality scores as a heatmap (rows=pathways, cols=cell groups)
# Each dot size: outgoing signal strength; color: incoming signal strength
netAnalysis_signalingRole_heatmap(
  cellchat,
  pattern    = "all",     # "outgoing", "incoming", or "all"
  signaling  = NULL,      # NULL = all pathways; or specify e.g. c("COLLAGEN","VEGF")
  height     = 10,
  color.heatmap = "OrRd"
)

# Identify dominant communication patterns using NMF
# outgoing patterns reveal which cell groups co-activate similar pathways
library(NMF)
selectK(cellchat, pattern = "outgoing")    # elbow plot to choose K
cellchat <- identifyCommunicationPatterns(
  cellchat,
  pattern = "outgoing",
  k       = 3,            # number of latent patterns; choose from selectK elbow
  width   = 8,
  height  = 6
)
ステップ 7:可視化する — コード図、ヒートマップ、バブルプロット

CellChat には、集約された相互作用と経路固有の相互作用の両方を可視化するための関数がいくつか用意されています。

library(ggplot2)
library(patchwork)

# --- 7a. Chord diagram: aggregate interaction count and weight ---
par(mfrow = c(1, 2))
netVisual_circle(
  cellchat@net$count,
  vertex.weight = as.numeric(table(cellchat@idents)),
  weight.scale  = TRUE,
  label.edge    = FALSE,
  title.name    = "Number of interactions"
)
netVisual_circle(
  cellchat@net$weight,
  vertex.weight = as.numeric(table(cellchat@idents)),
  weight.scale  = TRUE,
  label.edge    = FALSE,
  title.name    = "Interaction strength"
)

# --- 7b. Heatmap: cell-group × cell-group interaction matrix ---
p1 <- netVisual_heatmap(cellchat, measure = "count",  color.heatmap = "Blues")
p2 <- netVisual_heatmap(cellchat, measure = "weight", color.heatmap = "Reds")
p1 + p2

# --- 7c. Chord diagram for a specific pathway ---
netVisual_aggregate(
  cellchat,
  signaling      = "COLLAGEN",
  layout         = "chord",
  vertex.receiver = NULL   # NULL = show all groups as receivers
)

# --- 7d. Bubble plot: all significant interactions for chosen pathways ---
netVisual_bubble(
  cellchat,
  sources.use = NULL,   # NULL = all senders
  targets.use = NULL,   # NULL = all receivers
  signaling   = c("COLLAGEN", "MIF", "VEGF"),
  remove.isolate = FALSE
)
ggsave("bubble_plot_selected_pathways.pdf", width = 10, height = 8)
ステップ 8:条件間で 2 つの CellChat オブジェクトを比較する

2 つの条件(例:健常と疾患)がある場合は、CellChat オブジェクトをマージしてシグナル伝達ネットワークを比較します。

# Assume cellchat_ctrl and cellchat_disease are pre-computed CellChat objects
object.list <- list(Control = cellchat_ctrl, Disease = cellchat_disease)
cellchat_merged <- mergeCellChat(object.list, add.names = names(object.list))

# --- Compare total interaction count and strength ---
compareInteractions(cellchat_merged, show.legend = FALSE,
                    group = c(1, 2), measure = "count")
compareInteractions(cellchat_merged, show.legend = FALSE,
                    group = c(1, 2), measure = "weight")

# --- Differential interaction chord diagram (gained/lost connections) ---
netVisual_diffInteraction(cellchat_merged, weight.scale = TRUE)

# --- Identify signaling pathways specific to each condition ---
rankNet(cellchat_merged, mode = "comparison", stacked = TRUE, do.stat = TRUE)

# --- Scatter plot: pathways shifted in information flow ---
rankNetPairwise(
  cellchat_merged,
  comparison = c(1, 2),
  slot.name  = "netP",
  measure    = "prob"
)

主なパラメーター

パラメーター関数デフォルト範囲/オプション効果
typecomputeCommunProb"triMean""triMean"、"truncatedMean"、"thresholdedMean"、"median"グループレベルの発現量の集約方法です。triMean が最も厳格です
trimcomputeCommunProb0.10–0.25両端から除外する割合です。type="truncatedMean" の場合にのみ適用されます
nbootcomputeCommunProb10050–1000p 値推定のためのブートストラップ反復回数です。値を大きくすると処理は遅くなりますが、精度が上がります
population.sizecomputeCommunProbTRUETRUE、FALSE細胞グループのサイズでコミュニケーション確率に重み付けします。不均一なデータでは推奨されます
min.cellsfilterCommunication105–50相互作用を保持するために、送信側または受信側の各グループに必要な最小細胞数です
kidentifyCommunicationPatterns必須2–6(selectK で選択)潜在的なコミュニケーションパターンの数です。選択には selectK のエルボー法を使用します
threshnetAnalysis_computeCentrality0.050.01–0.1中心性分析で相互作用を保持するための p 値のしきい値です
sources.usenetVisual_bubbleNULL細胞グループ名またはインデックスバブルプロットの送信側細胞グループを制限します。NULL = すべて
targets.usenetVisual_bubbleNULL細胞グループ名またはインデックスバブルプロットの受信側細胞グループを制限します。NULL = すべて

主な概念

コミュニケーション確率モデル

CellChat は作用質量の法則を用いてコミュニケーション確率を定量化します。細胞グループ A で発現するリガンド L と、細胞グループ B で発現する受容体 R(複数のサブユニットからなる複合体の場合もあります)について、次のようになります。

P(A → B | L-R) = hill(expr_L_A) × hill(expr_R1_B) × hill(expr_R2_B) × ...

ここで hill(x) = x^n / (K^n + x^n) はヒル関数(デフォルトでは n=1)であり、発現値は選択した type 引数を用いてグループ単位で集約されます。多サブユニット受容体複合体では、すべてのサブユニットが発現している必要があります。確率は、ヒル変換した各サブユニットの発現量の積です。

CellChatDB リガンド・受容体データベース

CellChatDB は、実験的に検証されたリガンド・受容体相互作用を、次の 3 つのカテゴリーに分類したキュレーション済みデータベースです。

# Inspect the database structure
dim(CellChatDB.human$interaction)   # [1] 2293   17
head(CellChatDB.human$interaction[, c("interaction_name", "pathway_name",
                                       "ligand", "receptor", "annotation")], 4)
#   interaction_name pathway_name ligand receptor          annotation
# 1         TGFB1_TGFBR1_TGFBR2         TGFb  TGFB1  TGFBR1_TGFBR2  Secreted Signaling
# 2          WNT5A_FZD1_LRP5          WNT   WNT5A     FZD1_LRP5   Secreted Signaling
# 3             FN1_CD44             FN1    FN1      CD44        ECM-Receptor
# 4          NOTCH1_DLL4        NOTCH  NOTCH1       DLL4   Cell-Cell Contact

この 3 つのカテゴリーは、それぞれ異なる生物学的メカニズムを対象とします。

  • 分泌シグナル:古典的なパラクリン/オートクリンリガンド(サイトカイン、成長因子、モルフォゲン)
  • ECM-受容体:膜受容体に結合する細胞外マトリックス成分
  • 細胞間接触:細胞同士の直接接触を必要とするジャクスタクリンシグナル(Notch、Ephrin、Semaphorin)
ネットワーク中心性の役割
役割中心性指標解釈
送信者出次数/出強度多数の標的にシグナルを送る細胞グループ
受信者入次数/入強度多数の発信元からシグナルを受け取る細胞グループ
仲介者媒介中心性他のグループ間のコミュニケーションをつなぐ細胞グループ
インフルエンサー固有ベクトル中心性他の高度に接続されたグループとつながる細胞グループ
情報フローと相互作用数

aggregateNet は、相互に補完する2つの行列を計算します。

  • cellchat@net$count:細胞グループのペアごとの統計的に有意なリガンド・受容体ペアの数(相互作用の生の数)
  • cellchat@net$weight:すべてのペアにわたるコミュニケーション確率の合計(相互作用の強度/情報フロー)

数が多く重みが小さい場合は、弱い相互作用が多数あることを示します。重みが大きく数が少ない場合は、少数の主要な経路があることを示します。

よく使うレシピ

レシピ:有意な相互作用をすべてデータフレームとして抽出する

結果をエクスポートしたい場合、カスタムフィルタリングを適用したい場合、または相互作用を下流の経路解析に渡したい場合に使用します。

# All ligand-receptor level interactions (p < 0.05)
df.lr <- subsetCommunication(cellchat, slot.name = "net")
df.lr_sig <- df.lr[df.lr$pval < 0.05, ]
cat("Significant LR interactions:", nrow(df.lr_sig), "\n")

# All pathway-level interactions
df.path <- subsetCommunication(cellchat, slot.name = "netP")

# Interactions involving specific cell groups
df.tumor_recv <- subsetCommunication(cellchat,
                                      targets.use = "Tumor",
                                      slot.name   = "net")
cat("Interactions targeting Tumor cells:", nrow(df.tumor_recv), "\n")

# Save to CSV for downstream analysis
write.csv(df.lr_sig,    "cellchat_lr_interactions.csv",    row.names = FALSE)
write.csv(df.path,      "cellchat_pathway_interactions.csv", row.names = FALSE)
write.csv(df.tumor_recv, "cellchat_tumor_receivers.csv",   row.names = FALSE)
レシピ:特定の経路のシグナル伝達における役割を可視化する

1つの経路を介して、どの細胞型がシグナルを送受信するかを詳しく確認したい場合に使用します。

# Show chord diagram + violin plots for a single pathway
pathway <- "COLLAGEN"

# Chord diagram
netVisual_aggregate(cellchat, signaling = pathway, layout = "chord")
title(main = paste0(pathway, " signaling network"))

# Contribution of each LR pair to the pathway
netAnalysis_contribution(cellchat, signaling = pathway)

# Gene expression of constituent ligands and receptors
plotGeneExpression(
  cellchat,
  signaling  = pathway,
  enriched.only = TRUE,     # show only significantly enriched genes
  type       = "violin"
)
レシピ:CellChat オブジェクトを保存して再読み込みする

可視化や比較の前に、完了した実行結果をチェックポイントとして保存する場合に使用します。

# Save the completed CellChat object
saveRDS(cellchat, file = "cellchat_analysis.rds")
cat("Saved to cellchat_analysis.rds\n")

# Reload and resume analysis
cellchat_loaded <- readRDS("cellchat_analysis.rds")
cat("Cell groups:", levels(cellchat_loaded@idents), "\n")
cat("Pathways:", length(cellchat_loaded@netP$pathways), "\n")

# Verify the object is complete
slotNames(cellchat_loaded)
# [1] "data"          "data.signaling" "images"        "net"
# [5] "netP"          "meta"           "idents"        "var.features"
# [9] "DB"            "LR"             "options"
レシピ:liana を使った Python 相当のワークフロー

パイプラインが Python ベースの場合や、複数の LR データベースをまたいだコンセンサスランキングを作成したい場合に使用します。

# Install: pip install liana
import liana
import scanpy as sc
import pandas as pd

# Load preprocessed AnnData (cells x genes, log-normalized)
adata = sc.read_h5ad("my_scrna.h5ad")
# adata.obs["celltype"] must contain cluster/cell-type labels

# Run liana with CellChat resource (consensus across CellChatDB, CellPhoneDB, NATMI, etc.)
liana.mt.rank_aggregate(
    adata,
    groupby   = "celltype",
    resource_name = "consensus",   # or "cellchat" for CellChat-only LR pairs
    expr_prop = 0.1,               # min fraction cells expressing ligand/receptor
    verbose   = True
)

# Results stored in adata.uns["liana_res"]
df = adata.uns["liana_res"]
df_sig = df[df["magnitude_rank"] < 0.05].sort_values("magnitude_rank")
print(df_sig[["source", "target", "ligand_complex", "receptor_complex",
              "magnitude_rank"]].head(10))
df_sig.to_csv("liana_interactions.csv", index=False)

期待される出力

出力種類説明
cellchat@net$countR 行列(n_groups × n_groups)各細胞グループのペア間における有意な LR 相互作用の数
cellchat@net$weightR 行列(n_groups × n_groups)細胞グループのペア間におけるコミュニケーション確率の集計値(情報フロー)
cellchat@netP$pathways文字ベクトル推定されたすべてのシグナル伝達経路の名前
subsetCommunication(cellchat)data.frame送信元、標的、リガンド、受容体、確率、p 値を含む、すべての LR レベルの相互作用のテーブル
subsetCommunication(cellchat, slot.name="netP")data.frame経路レベルの相互作用テーブル
コード図(PDF/PNG)図細胞グループ間の相互作用の強度を示す円形図
ヒートマップ(PDF/PNG)図細胞グループ × 細胞グループの相互作用数または重みを示すヒートマップ
バブルプロット(PDF/PNG)図グループのペアごとに、LR ペアの相互作用確率を示すドットプロット
シグナル伝達の役割のヒートマップ(PDF/PNG)図経路 × 細胞グループの中心性スコア(送信者/受信者の役割)

トラブルシューティング

問題考えられる原因解決策
Error in computeCommunProb: all probabilities are zeroCellChatDB 内の遺伝子が検出されていないか、除外されていますsubsetData() で遺伝子が保持されていることを確認します:nrow([email protected]) > 0。発現行列がログ正規化済み(生カウントではない)であることと、遺伝子名が CellChatDB と一致することを確認します(ヒト:HGNC 記号、マウス:MGI 記号)。
警告:groups with fewer than min.cells cells are removedフィルタリングの段階で小さなクラスターが除外されていますfilterCommunication() の min.cells を小さくします(例:min.cells = 5)。または、CellChat オブジェクトを作成する前に少数のクラスターを統合します。
identifyCommunicationPatterns の NMF エラー、または収束しないパターン数 k が多すぎるか、データが疎すぎますselectK() を使い、コフェネティック曲線/分散曲線のエルボーから k を選択します。まず k=2 または k=3 を試します。
computeCommunProb 中のメモリーエラー/セッションのクラッシュデータセットが利用可能な RAM に対して大きすぎます条件ごとに細胞数を ≤30,000 にサブサンプリングします。または、ブートストラップのメモリー使用量を削減するため、nboot = 50 を指定して computeCommunProb を実行します。
コード図が読みづらい(細胞グループが多すぎる)細かく分類されたクラスターが多数ありますCellChat オブジェクトを作成する前に、クラスターをより大きなカテゴリにまとめます。または、多数のグループでもスケーラビリティに優れた netVisual_heatmap を使います。
mergeCellChat エラー:細胞グループのラベルが一致しませんオブジェクト間で細胞タイプ名が異なりますマージする前に levels(cellchat_ctrl@idents) と levels(cellchat_disease@idents) を統一します。setIdent() を使ってグループ名を変更します。
遺伝子記号が認識されない(確率がすべて 0)ヒト/マウスの遺伝子命名規則が混在しています生物種を確認します。ヒトの遺伝子はすべて大文字(例:TGFB1)、マウスの遺伝子はタイトルケース(例:Tgfb1)です。マウスデータには CellChatDB.mouse を設定します。

参考資料

コメント