Open zacharyjxy2020 opened 1 year ago
We do not suggest to run cellchat on the datasets from two conditions if you want to identify the signaling changes acropss conditions. instead, run cellchat on each dataset and then use the mergeCellChat function to do the comparison analysis .
Hello, I also encountered a problem when running ComputeCommunProb. My code is:
library(rhdf5) library(reticulate) library(Matrix) data_R <- h5read("exeGUdata_R.h5","exeGUdata_R") data_process <- data_R$block0_values rownames(data_process) <- data_R$axis0 colnames(data_process) <- data_R$axis1 data_process <- Matrix(data_process, sparse = TRUE) meta_data <- read.table('metadata_data.tsv',sep="\t",header=T,row.names=1) library(patchwork) library(ggalluvial) library(igraph) library(dplyr) library(ggplot2) library(CellChat) library(Seurat)
exeGU <- CreateSeuratObject(data_process,assay='RNA',meta.data=meta_data)
dim(exeGU) head(exeGU)
options(stringsAsFactors = FALSE) options(futrue.globlas.Maxsize=2*1024**3) suppressWarnings(suppressMessages(future::plan("multicore", workers = 4)))
cellchat<- createCellChat(exeGU@assays$RNA@data) meta <- data.frame(cellType = exeGU$leiden_new, row.names = Cells(exeGU)) cellchat <- addMeta(cellchat, meta = meta, meta.name = "cellType") cellchat <- setIdent(cellchat, ident.use = "cellType") levels(cellchat@idents) groupSize <- as.numeric(table(cellchat@idents)) cellchat
CellChatDB <- CellChatDB.human CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") # use Secreted signaling for cell-cell communication analysis cellchat@DB <- CellChatDB.use
cellchat <- subsetData(cellchat) cellchat <- identifyOverExpressedGenes(cellchat) cellchat <- identifyOverExpressedInteractions(cellchat) cellchat <- projectData(cellchat, PPI.human)
knitr::opts_chunk$set(echo = TRUE) cellchat <- computeCommunProb(cellchat, raw.use = TRUE)
Then I got the error message: "Error in if (sum(P1_Pspatial) == 0) { : The location where TRUE/FALSE values are required cannot use missing values.
My data comes from files analyzed with scanpy, and I have checked that there are no missing values before running the code. Could you help me see what's causing it?
I am trying to integrate two cellchat objects and look at cell-cell interactions between populations in separate datasets. When I run computeCommunProb on the integrated cellchat objects I get the following error:
Error in computeCommunProb(cellchat.integrated) : Please check
unique(object@idents)
and ensure that the factor levels are correct! You may need to drop unused levels using 'droplevels' function. e.g.,meta$labels = droplevels(meta$labels, exclude = setdiff(levels(meta$labels),unique(meta$labels)))
When I run computeCommunProb on each object individually it works properly.