cellchat需要两个输入:基因表达矩阵 + cell label。表达矩阵行为基因列为细胞,标准化+log。cell label为dataframe,行名为细胞,第一列为cell label.
从seurat v3 object中提取cell chat 所需要的两个输入文件:
data.input <- GetAssayData(seurat_object, assay = "RNA", slot = "data") # normalized data matrix
labels <- Idents(seurat_object)
meta <- data.frame(group = labels, row.names = names(labels)) # create a dataframe of the cell labels
library(CellChat)
library(patchwork)
options(stringsAsFactors = FALSE)
- part I: data input and preprocessing, initialization of the cellchat object
(1)load data
# Here we load a scRNA-seq data matrix and its associated cell meta data
#load(url("https: