Closed franciscogrisanti closed 4 years ago
Hi @franciscogrisanti, your data.input contains negative values, which is not suitable as input of CellChat. CellChat requires the normalized data. data.input <- GetAssayData(LAPV.integrated, assay = "RNA", slot = "data")
Thanks for the reply! It's working now. 💯
Hi @sqjin! I'm having the same issue and don't know what todo,hoping you can help me I running the code below: data.input <- GetAssayData(scdata, assay = "RNA", slot = "data") identity = data.frame(group =scdata@meta.data$Predicted_labels, row.names = names(scdata@meta.data$Predicted_labels)) unique(identity$group) cellchat <- createCellChat(data = data.input) cellchat <- addMeta(cellchat, meta = identity, meta.name = "labels") cellchat <- setIdent(cellchat, ident.use = "labels") identity levels(cellchat@idents) # show factor levels of the cell labels groupSize <- as.numeric(table(cellchat@idents)) # number of cells in each cell group CellChatDB <- CellChatDB.mnouse CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") # use Secreted Signaling for cell-cell communication analysis cellchat@DB <- CellChatDB.use # set the used database in the object cellchat <- subsetData(cellchat) future::plan("multiprocess", workers = 4) cellchat <- identifyOverExpressedGenes(cellchat) cellchat <- identifyOverExpressedInteractions(cellchat) cellchat <- projectData(cellchat, PPI.mouse) cellchat <- computeCommunProb(cellchat)
And get the error : Error in data.use[RsubunitsV, ]: subscript out of bounds
Hi @sqjin I have the same question as @caiquanyou mentioned. Could you help us with this? Thanks!
@weihuaguo Can you please make sure you have correctly done the following? (1) Use the correct CellChatDB: either 'CellChatDB <- CellChatDB.mouse' or 'CellChatDB <- CellChatDB.human'; (2) Have the correct cell group information by checking 'unique(cellchat@idents)'; (3) Have the correct data matrix for cell-cell communication analysis: please check cellchat@data
and 'cellchat@data.signaling'
Hi @sqjin ! Thank you for this tool! Seems excellent.
I'm also having a subscript out of bounds error. Let me describe the situation below. My samples are Human Bulk RNA-Seq from isolated populations of HSCs (15 samples) and MSCs (7 samples). My gene identifiers are ENSEMBL gene ids with no version number.
library(CellChat) library(patchwork) library(edgeR) options(stringsAsFactors = FALSE) setwd('directory')
exprData <- read.table('table.txt', header=TRUE, row.names = 1)
exprDataN <- log2(cpm(exprData) + 1)
metadata <- read.table('metadata.txt', header = TRUE) cellChat1 <- createCellChat(object = exprDataN, meta = metadata, group.by = "CellType") cellChat1 <- setIdent(cellChat1, ident.use = "CellType") # set "labels" as default cell identity levels(cellChat1@idents) # show factor levels of the cell labels CellChatDB <- CellChatDB.human #use all CellChatDB for cell-cell communication analysis CellChatDB.use <- CellChatDB # simply use the default CellChatDB cellChat1@DB <- CellChatDB.use cellChat1 <- subsetData(cellChat1, features = CellChatDB.human$geneInfo$Ensembl.Gene.ID) # end up with 36845 x22 matrix from an initial 58767 x 22 matrix
cellChat1@data.signaling dim(cellChat1@data.signaling)
future::plan("multiprocess", workers = 4) #normal warning will pop-up probably cellChat1 <- identifyOverExpressedGenes(cellChat1) cellChat1 <- identifyOverExpressedInteractions(cellChat1) cellChat1 <- projectData(cellChat1, PPI.human) cellChat1 <- computeCommunProb(cellChat1, raw.use = TRUE)
The result is:
cellChat1 <- computeCommunProb(cellChat1, raw.use = TRUE) Error in data.use[RsubunitsV, ] : subscript out of bounds
Any suggestions? I will continue to troubleshoot this and return here if I find a solution.
Thank you in advance for your time!
@geosen Hi, you should convert ensembl gene id to official gene name before running CellChat.
@sqjin Thank you so much for taking the time to answer me! That was the issue!
@sqjin Thank you so much for taking the time to answer me! That was the issue!
@geosen Hi, I get the same error while analyzing bulk RNA-seq. And my gene identifiers are gene symbols. Could you please tell me How you fixed this error in more detail?
Hello, I think I also encountered the same problem on "Computecommunprob".Here is my code:
RDS <- readRDS('/home/wangyu/students_catalogue/lxm/snRNA/pBAT/sWAT_TSNE.rds') data.input <- RDS@assays$RNA@data
meta = RDS@meta.data identity = data.frame(group = meta$seurat_clusters, row.names = names(meta$seurat_clusters)) head(identity) group 1 1 2 2 3 0 4 2 5 2 6 0 unique(identity$group) [1] 1 2 0 Levels: 0 1 2 cellchat <- createCellChat(object = data.input, meta = meta, group.by = "seurat_clusters") Create a CellChat object from a data matrix Set cell identities for the new CellChat object The cell groups used for CellChat analysis are 0 1 2 cellchat <- addMeta(cellchat, meta = meta) cellchat <- setIdent(cellchat, ident.use = "seurat_clusters") levels(cellchat@idents) [1] "0" "1" "2" groupSize <- as.numeric(table(cellchat@idents)) CellChatDB <- CellChatDB.human showDatabaseCategory(CellChatDB) dplyr::glimpse(CellChatDB$interaction) Registered S3 method overwritten by 'cli': method from
print.boxx spatstat.geom Rows: 1,939 Columns: 11 $ interaction_name"TGFB1_TGFBR1_TGFBR2", "TGFB2_TGFBR1_TGFBR2", "TGFB… $ pathway_name "TGFb", "TGFb", "TGFb", "TGFb", "TGFb", "TGFb", "TG… $ ligand "TGFB1", "TGFB2", "TGFB3", "TGFB1", "TGFB1", "TGFB2… $ receptor "TGFbR1_R2", "TGFbR1_R2", "TGFbR1_R2", "ACVR1B_TGFb… $ agonist "TGFb agonist", "TGFb agonist", "TGFb agonist", "TG… $ antagonist "TGFb antagonist", "TGFb antagonist", "TGFb antagon… $ co_A_receptor "", "", "", "", "", "", "", "", "", "", "", "", "",… $ co_I_receptor "TGFb inhibition receptor", "TGFb inhibition recept… $ evidence "KEGG: hsa04350", "KEGG: hsa04350", "KEGG: hsa04350… $ annotation "Secreted Signaling", "Secreted Signaling", "Secret… $ interaction_name_2 "TGFB1 - (TGFBR1+TGFBR2)", "TGFB2 - (TGFBR1+TGFBR2)… CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling") CellChatDB.use <- subsetDB(CellChatDB) cellchat@DB <- CellChatDB.use cellchat <- subsetData(cellchat) future::plan("multiprocess", workers = 4) cellchat <- identifyOverExpressedGenes(cellchat) cellchat <- identifyOverExpressedInteractions(cellchat) cellchat <- projectData(cellchat, PPI.human) cellchat <- computeCommunProb(cellchat) Error in data.use[RsubunitsV, ] : subscript out of bounds In addition: Warning message: In max(data) : no non-missing arguments to max; returning -Inf
My cellchat@data has been standardized and no negative number exists. The gene name is the official gene name. for example:
head(cellchat@data) 6 x 963 sparse Matrix of class "dgCMatrix" [[ suppressing 963 column names ‘AAACCCAAGCACCCAC-1’, ‘AAACCCACAAGACCGA-1’, ‘AAACCCATCGACGATT-1’ ... ]]
RCAN1 . . . . . . . .
CBX3 . . . . . . . .
SMIM11A . . . . . . . .
MRPS6 . . 0.9947906 1.563694 1.906185 . 2.788075 .
ATP5PO . . 0.9947906 1.563694 . . . .
ITSN1 2.754954 . 2.5594811 2.779176 2.900439 2.992338 2.154648 2.312864
RCAN1 . . . 1.938575 . . . . CBX3 . . . . . . . . SMIM11A . . . . . 2.058039 . . MRPS6 1.211823 . . 1.379879 . . . . ATP5PO . . . . . . . . ITSN1 2.089245 3.059502 2.116168 1.938575 3.715525 3.067672 2.70321 .
but,There may be some errors in this
cellchat@data.signaling 0 x 963 sparse Matrix of class "dgCMatrix" [[ suppressing 963 column names ‘AAACCCAAGCACCCAC-1’, ‘AAACCCACAAGACCGA-1’, ‘AAACCCATCGACGATT-1’ ... ]]
I would like to ask whether this caused the above mistakes, and how to solve these two problems.I really appreciate your time to help me solve the problem
@1221li You should change your cell labels, which cannot be 0
. It should be at least starting from 1, e..g., 1,2,3,..
Thank you very much for answering my question. I seem to have solved this problem. I have increased the number of seurat_clusters and there is no longer this mistake.However, at the step of NetAnalysis_ComputeCentrality, we have the following error
future::plan("multiprocess", workers = 4) cellchat <- identifyOverExpressedGenes(cellchat) cellchat <- identifyOverExpressedInteractions(cellchat) cellchat <- projectData(cellchat, PPI.human) cellchat <- computeCommunProb(cellchat)
cellchat < - filterCommunication(cellchat,min.cells = 10) Error: unexpected input in "cellchat < - filterCommunication(" cellchat <-filterCommunication(cellchat,min.cells = 10) Error: unexpected input in "cellchat <-filterCommunication(cellchat," cellchat <-filterCommunication(cellchat,min.cells = 10) cellchat <- computeCommunProbPathway(cellchat) cellchat <- aggregateNet(cellchat) cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP") Fortran runtime error: Insufficient number of elements in TARRAY. Fortran runtime error: Insufficient number of elements in TARRAY. Fortran runtime error: Insufficient number of elements in TARRAY. Error: Failed to retrieve the result of MulticoreFuture (future_sapply-1) from the forked worker (on localhost; PID 42646). Post-mortem diagnostic: No process exists with this PID, i.e. the forked localhost worker is no longer alive. In addition: Warning message: In mccollect(jobs = jobs, wait = TRUE) : 1 parallel job did not deliver a result Fortran runtime error: Insufficient number of elements in TARRAY.
I don't know what caused this mistake, could you please help me solve it?
@1221li I have no idea on this. Can you run the source codes of this function to figure out the reason?
@1221li Did you figure out the problem with NetAnalysis_ComputeCentrality? I'm experiencing the same issue now.
@1221li Did you figure out the problem with NetAnalysis_ComputeCentrality? I'm experiencing the same issue now.
@libingnan11 (1) Run the source codes by yourself and check the reason (2) if you can share your object and I can run the source code.
Hi @sqjin ! Hope you're doing good. I'm having an issue and I was hoping you can help me. After running the netAnalysis_computeCentrality function, it turns off R directly and displays Fortran runtime error: Insufficient number of elements in TARRAY. What is the reason for this?
On my case, Fortran runtime error: Insufficient number of elements in TARRAY.
seems cause by igraph
. When netAnalysis_computeCentrality()
call igraph
, the R session crash immediately. Downgrade my R version 4.2.2 to 4.0.3 could fix this problem.
Hi Sqjin, I have a similar error, could you kindly help?
My cellchat@data has been standardized and no negative number exists. The gene name is the official gene name. for example:
Xkr4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gm1992 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gm37381 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Rp1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sox17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gm37323 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Xkr4 ...... Gm1992 ...... Gm37381 ...... Rp1 ...... Sox17 ...... Gm37323 ......
cellchat <- computeCommunProbPathway(cellchat) Error in prob.pathways[, , pathways.sig, drop = FALSE] : subscript out of bounds
traceback() 1: computeCommunProbPathway(cellchat)
@1989ANSS Can you show your unique(cellchat@idents)
?
Thank you for responding
unique(cellchat@idents)
[1] T_Cells Neutrophils NK_Cells Macrophages DCs B_Cells Fibroblast Cancer Basophils
[10] MCs Endo_Cells
Levels: B_Cells Basophils Cancer DCs Endo_Cells Fibroblast Macrophages MCs Neutrophils NK_Cells T_Cells
@1989ANSS It looks good. Could you share your cellchat object so that I can replicate your error. If your file is too big, you can set cellchat@data = cellchat@data[1:2, ]
as I only need the cellchat@data.signaling
Dear Professor Suoqin Jin
Please Attached cellchat object file,
Kindest Regards
Arnaldo
Hi @sqjin! Hope you're doing good. I'm having an issue and I was hoping you can help me
While running
cellchat <- computeCommunProbPathway(cellchat)
I get this error!
Do you know what could it be?
Here is the complete code