I am observing a reproducible issue where liftCellChat() causes misalignment of centrality values (netP$centr) with cell type labels, leading to incorrect sender/receiver identification in downstream plots such as:
netAnalysis_signalingRole_scatter()
Summary of the problem
CellChat objects behave correctly before lift
After liftCellChat(), cell labels (@idents) remain correct
However, centrality values (outdeg, indeg) are reassigned to different cell types
This results in incorrect biological interpretation
obj_a@idents and obj_b@idents both have additional cell types which the other doesn't have
Example of the issue
group.new <- union(levels(obj_a@idents), levels(obj_b@idents))
obj_b_lift <- liftCellChat(obj_b, group.new)
targets <- c("pericyte", "pericyte_STEAP4", "fibro_CXCL14")
p <- names(obj_b@netP$centr)[1]
data.frame(
cell_type = targets,
outdeg_before = obj_b@netP$centr[[p]]$outdeg[targets],
outdeg_after = obj_b_lift@netP$centr[[p]]$outdeg[targets]
)
Output:
cell_type outdeg_before outdeg_after
pericyte 0.1270253 0.0010619
pericyte_STEAP4 0.0005287 0.1270253
The values are effectively swapped between some cell types.
Additional diagnostics
identical(
names(obj_b@netP$centr[[p]]$outdeg),
names(obj_b_lift@netP$centr[[p]]$outdeg)
)
Result:
FALSE
So the issue appears to be a mismatch between centrality vector ordering and cell identity levels after lift.
Impact
This directly affects:
netAnalysis_signalingRole_scatter()
Any analysis using netP$centr
Interpretation of major signaling senders/receivers
CellChat v2.2.0
I ran netAnalysis_computeCentrality on my original cellchat objects, and the cell labels were stored as factors originally
I have tried recomputing NetP before and after lift and it still doesn't fix the issue:
cellchat_obj_a <- netAnalysis_computeCentrality(cellchat_obj_a, slot.name = "netP")
cellchat_obj_b <- netAnalysis_computeCentrality(cellchat_obj_b, slot.name = "netP")
Please can you advise?
I am observing a reproducible issue where liftCellChat() causes misalignment of centrality values (netP$centr) with cell type labels, leading to incorrect sender/receiver identification in downstream plots such as:
netAnalysis_signalingRole_scatter()
Summary of the problem
CellChat objects behave correctly before lift
After liftCellChat(), cell labels (@idents) remain correct
However, centrality values (outdeg, indeg) are reassigned to different cell types
This results in incorrect biological interpretation
obj_a@idents and obj_b@idents both have additional cell types which the other doesn't have
Example of the issue
group.new <- union(levels(obj_a@idents), levels(obj_b@idents))
obj_b_lift <- liftCellChat(obj_b, group.new)
targets <- c("pericyte", "pericyte_STEAP4", "fibro_CXCL14")
p <- names(obj_b@netP$centr)[1]
data.frame(
cell_type = targets,
outdeg_before = obj_b@netP$centr[[p]]$outdeg[targets],
outdeg_after = obj_b_lift@netP$centr[[p]]$outdeg[targets]
)
Output:
pericyte 0.1270253 0.0010619
pericyte_STEAP4 0.0005287 0.1270253
The values are effectively swapped between some cell types.
Additional diagnostics
identical(
names(obj_b@netP$centr[[p]]$outdeg),
names(obj_b_lift@netP$centr[[p]]$outdeg)
)
Result:
FALSE
So the issue appears to be a mismatch between centrality vector ordering and cell identity levels after lift.
Impact
This directly affects:
netAnalysis_signalingRole_scatter()
Any analysis using netP$centr
Interpretation of major signaling senders/receivers
CellChat v2.2.0
I ran netAnalysis_computeCentrality on my original cellchat objects, and the cell labels were stored as factors originally
I have tried recomputing NetP before and after lift and it still doesn't fix the issue:
cellchat_obj_a <- netAnalysis_computeCentrality(cellchat_obj_a, slot.name = "netP")
cellchat_obj_b <- netAnalysis_computeCentrality(cellchat_obj_b, slot.name = "netP")
Please can you advise?