CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

Error when running identifyOverExpressedGenes()

Open JosieCen opened this issue 1 year ago • 3 comments

I Lift up cellChat object and merge together to create cellchat. When I want to "Identify the up-gulated and down-regulated signaling ligand-receptor pairs" following the guidance, I met the error:

> cellchat <- identifyOverExpressedGenes(cellchat, group.dataset = "datasets", pos.dataset = pos.dataset, features.name = features.name, only.pos = FALSE, thresh.pc = 0.1, thresh.fc = 0.05, thresh.p = 0.05, group.DE.combined = FALSE)
Use the joint cell labels from the merged CellChat object
Error in wilcoxauc.default(data.use.i, labels.i) : 
  Must have at least 2 groups defined.

I have checked the datasets parameter and confirmed that there are only 2 groups (e.g., "HC" and "PD"), but still encountering the error...How can I troubleshoot and fix the issue?

JosieCen avatar Dec 07 '24 09:12 JosieCen

@JosieCen Can you check if the variable cellchat@meta$datasets is a factor? I have no idea on this error. The best way to troubleshoot this is to run the source codes line by line.

sqjin avatar Dec 12 '24 00:12 sqjin

I have a similar problem and when I run the source code line by line, I found out that the problem is that when it runs through the loop to identify DE genes it stops at the first cluster with cells only in one condition. I did use liftCellChat, wasn't it supposed to solve the differences in cell composition? Am I missing something here?

erikagucciardo avatar Mar 25 '25 08:03 erikagucciardo

Hello, although the liftCellChat function was used, I checked the number of cell types in the two datasets and found that some cell types had zero counts. By filtering out these cell types using subsetCellChat and re-running identifyOverExpressedGenes, the issue can be resolved.

Yvonne-1001 avatar Jul 04 '25 02:07 Yvonne-1001