sqjin / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data
GNU General Public License v3.0
637 stars 145 forks source link

ERROR: netAnalysis_signalingChanges_scatter Error in outgoing[, i] <- centr[[i]][[x.measure]] : #479

Open FanZhang9 opened 2 years ago

FanZhang9 commented 2 years ago

ERROR with the netAnalysis_signalingChanges_scatter

netAnalysis_signalingChanges_scatter(cellchat, idents.use = "Conventional_dendritic")

Merge the following slots: 'data.signaling','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'. Visualizing differential outgoing and incoming signaling changes from CTL to SP Error in outgoing[, i] <- centr[[i]][[x.measure]] : number of items to replace is not a multiple of replacement length

This is my cellchat object I am trying to compare ; cellchat_mer.rdata.gz

FanZhang9 commented 2 years ago

I have fixed this problem by selecting the mutual cell type on 2 data set from the beginning. It taken me 1 day to figure it out.

shanshenbing commented 1 year ago

I got a error when using netAnalysis_signalingChanges_scatter function. After checking my cellchat obj, I found cellchat@netP$centr is null. Actually, my cellchat is a merged cellchat list from chbm and chlm.

names(chlm@netP$centr[[1]]) [1] "outdeg_unweighted" "indeg_unweighted" "outdeg"
[4] "indeg" "hub" "authority"
[7] "eigen" "page_rank" "betweenness"
[10] "flowbet" "info"
names(chbm@netP$centr[[1]]) [1] "outdeg_unweighted" "indeg_unweighted" "outdeg"
[4] "indeg" "hub" "authority"
[7] "eigen" "page_rank" "betweenness"
[10] "flowbet" "info"

Here is my codes to merge cellchat obj. cellchat <- chbm cellchat <- aggregateNet(cellchat) cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP") chbm <- cellchat

cellchat <- chlm cellchat <- aggregateNet(cellchat) cellchat <- netAnalysis_computeCentrality(cellchat, slot.name = "netP") chlm <- cellchat

chbm <- updateCellChat(chbm) chlm <- updateCellChat(chlm)

merge obj.

object.list <- list(BM = chbm, LM = chlm) cellchat <- mergeCellChat(object.list, add.names = names(object.list)) After runnning the code, I got the info: Merge the following slots: 'data.signaling','images','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'.

Hope your help. Any suggestions will be appreciated.

htejedam commented 1 year ago

This is because your might have cell populations (clusters) that are not shared among both conditions. I had the same, and kept having the same error. If you take them out, the analysis runs smooth.

shanshenbing commented 1 year ago

Thank you for your advice.

sqjin commented 1 year ago

You can also lift up the cell identity to be the same (i.e., the union of the cell identities across two condtions)

On Wed, Jun 7, 2023 at 9:08 PM shanshenbing @.***> wrote:

Thank you for your advice.

— Reply to this email directly, view it on GitHub https://github.com/sqjin/CellChat/issues/479#issuecomment-1580781854, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXF63CF4VSQRRGVPFIIWVTXKB4MXANCNFSM6AAAAAAQLARLAE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

htejedam commented 1 year ago

I believe that does not work, at least not will cellchat. I had the same identity active across all my samples, but if there's samples that contain 0 cells in one of the clusters from that identity, it won't run.

tingxie2020 commented 1 year ago

Hi, I have 4 cellchat object merged together, two objects have 4 cellgroups less than the other two objects. I used liftcellchat function to lift up the cell idents the same among all the 4 cellchat objects. But still I got the error when running netAnalysis_signalingChanges_scatter function. The error is : Error in outgoing[, i] <- centr[[i]][[x.measure]] : number of items to replace is not a multiple of replacement length

Any solution for the issue? Thank you Ting

Chenxinnnnn commented 1 year ago

I got the same problem, and I've tried all the solutions above. Still the error exists.