Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

computeCommunProb :Error in data.use[RsubunitsV, ] #111

Closed
wulc21 opened this issue Jan 11, 2021 · 14 comments
Closed

computeCommunProb :Error in data.use[RsubunitsV, ] #111

wulc21 opened this issue Jan 11, 2021 · 14 comments

Comments

@wulc21
Copy link

wulc21 commented Jan 11, 2021

Hi dear professor, could you help me solve the problem? Thank you very much
cellchat <- computeCommunProb(cellchat)
Error in data.use[RsubunitsV, ] : 下标出界

@sqjin
Copy link
Owner

sqjin commented Jan 12, 2021

Hi @wulc21, I have no idea on this issue except that I can replicate your error. If you can share me your CellChat object, I am happy to test it; otherwise, you can try the source codes line by line to figure out the reason.

@sqjin sqjin closed this as completed Jan 24, 2021
@DawnEve
Copy link

DawnEve commented Feb 17, 2021

I encounter the same issue.

cellchat2 <- computeCommunProb(cellchat2)

Error in data.use[RsubunitsV, ]: subscript out of bounds
Traceback:

1. computeCommunProb(cellchat2)
2. computeExpr_complex(complex_input, data.use, complex)
3. my.sapply(X = 1:nrow(Rsubunits), FUN = function(x) {
 .     RsubunitsV <- unlist(Rsubunits[x, ], use.names = F)
 .     RsubunitsV <- RsubunitsV[RsubunitsV != ""]
 .     return(geometricMean(data.use[RsubunitsV, ]))
 . })
4. pblapply(X = X, FUN = FUN, ..., cl = cl)
5. lapply(X, FUN, ...)
6. FUN(X[[i]], ...)
7. geometricMean(data.use[RsubunitsV, ])
8. nrow(x)

@sqjin
Copy link
Owner

sqjin commented Feb 18, 2021

@DawnEve Can you please make sure there is no obvious issue of the following four parts: 1) Use the correct CellChatDB: either mouse or human; 2) Please check the input data matrix cellchat@data; 3) Please check the subset data matrix cellchat@data.signaling; 4) Please check the cell group information is correct: unique(cellchat@idents).

@alhadjil
Copy link

@DawnEve Can you please make sure there is no obvious issue of the following four parts: 1) Use the correct CellChatDB: either mouse or human; 2) Please check the input data matrix cellchat@data; 3) Please check the subset data matrix cellchat@data.signaling; 4) Please check the cell group information is correct: unique(cellchat@idents).

Hi,

I've used following code on an Seurat scRNASeq object and I still get the same Error message

data.input <- GetAssayData(dataset, assay = "RNA", slot = "data") # normalized data matrix
Idents(object = dataset) <- 'Named'
labels <- Idents(dataset)
identity <- data.frame(group = labels, row.names = names(labels)) # create a dataframe of the cell labels
cellchat <- createCellChat(data = data.input)
cellchat <- addMeta(cellchat, meta = identity, meta.name = "labels")
cellchat <- setIdent(cellchat, ident.use = "labels") # set "labels" as default cell identity
CellChatDB <- CellChatDB.mouse # use CellChatDB.human if running on human data
CellChatDB.use <- subsetDB(CellChatDB, search = "Secreted Signaling")
cellchat@DB <- CellChatDB.use # set the used database in the object
cellchat <- subsetData(cellchat) # subset the expression data of signaling genes for saving computation cost
future::plan("multiprocess", workers = 8) # do parallel
cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)
cellchat <- projectData(cellchat, PPI.mouse)
groupSize <- as.numeric(table(cellchat@idents))
cellchat <- computeCommunProb(cellchat)
cellchat <- computeCommunProbPathway(cellchat)

Then I followed the recommended steps and I got following results:

(1) I'm using the MouseDB and my scRNASeq dataset is from mice
(2) cellchat@data
grafik
(3) cellchat@data.signaling
grafik
(4) unique(cellchat@idents)
grafik

Can you please help me? Thanks!

@zpingfeng
Copy link

should the unique(cellchat@idents) be the cluster names?

I have 1) Use the correct CellChatDB: mouse ; 2) the input data matrix cellchat@data, range from 0.00000 to 8.34498, dimension 14393 x 2814 ; 3) the data matrix cellchat@data.signaling, range from 0.00000 to 8.34498, dimension 3000 x 2814; 4) the cell group information is correct: unique(cellchat@idents): 1 to 11.

I still got similar error message
cellchat <- computeCommunProb(cellchat)
Error in data.use[RsubunitsV, ]: subscript out of bounds

@wfma
Copy link

wfma commented Jun 4, 2022

I ran into this error also. I found that I used the wrong idents from Seurat!

@ysuzuki1978
Copy link

I am having the same error, please tell me how to fix the idents from Seurat to solve the problem.

@Xiujia-Yang
Copy link

Perhaps the following two steps were missed,

cellchat <- identifyOverExpressedGenes(cellchat)
cellchat <- identifyOverExpressedInteractions(cellchat)

This issue mentioned above was solved for me when the two steps were executed beforehand.

@dmj6288
Copy link

dmj6288 commented May 1, 2023

Hi All,

It is because the RSubunitsV variable is NULL. This happens when the cellchat@LR slot is empty. In other words, CellChat was unable to identify any relevant Ligand-Receptor pairs in the gene list you provided. This slot get's populated when you run identifyOverExpressedInteractions(). I recommend increasing the gene list (rownames or relax some upstream filtering pipeline) you provided and then it will work.

Best,
dmj

@codecant1
Copy link

@dmj6288 @sqjin Hello -- having similar difficulty with this step (Error in data.use[RsubunitsV, ]: subscript out of bounds). Confirmed that the cellchat@LR slot is empty, even after running identifyOverExpressedInteractions().

Gene list constituent of 50K+ HUGO symbols. Running with bulk samples (N=61), in accordance with previous mention by @sqjin that such analysis is possible with CellChat despite its single cell intentions.

Kindly find my cellchat object attached
cellchat.zip

Any insight is greatly appreciated.

@dmj6288
Copy link

dmj6288 commented Aug 7, 2023

I believe it is possible to run bulk samples with cellchat, but when I run cellchat on bulk data, I've always received a very small number of LR interactions.

@imrjesh
Copy link

imrjesh commented Aug 22, 2023

There must be some issue with your dataset.

@patrycja-oleniacz
Copy link

I had similar error (Error in data.use[RsubunitsV, ] : subscript out of bounds) when I forgot to run:

cellchat <- updateCellChat(cellchat)

before
identifyOverExpressedGenes(cellchat)
identifyOverExpressedInteractions(cellchat)

Running cellchat <- updateCellChat(cellchat) before those two commends solved the problem in my case

@zyc0321
Copy link

zyc0321 commented Nov 14, 2023

I had similar error (Error in data.use[RsubunitsV, ] : subscript out of bounds) when I forgot to run:

cellchat <- updateCellChat(cellchat)

before identifyOverExpressedGenes(cellchat) identifyOverExpressedInteractions(cellchat)

Running cellchat <- updateCellChat(cellchat) before those two commends solved the problem in my case

Problem solved! Thanks so much!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests