Hi , I want to joint set of the identities of my two groups by set
group.new = union(levels( cellchat.group1@idents), levels(cellchat.group2@idents))
However, I found that these two commands gave totally different P-values while I think it should be the same when calling rankNet function.
group.new = union( levels(cellchat.group1@idents), levels(cellchat.group2@idents) )group.new = union( levels(cellchat.group2@idents), levels(cellchat.group1@idents) )
To make sure, I run the example dataset of CellChat tutorial. As expected, different levels for liftCellChat result in same contribution, contribution.scaled, and contribution.relative.1 but with different pvalues for rankNet, also the different layout.
Hi , I want to joint set of the identities of my two groups by set
group.new = union(levels( cellchat.group1@idents), levels(cellchat.group2@idents))
However, I found that these two commands gave totally different P-values while I think it should be the same when calling rankNet function.
group.new = union( levels(cellchat.group1@idents), levels(cellchat.group2@idents) )
group.new = union( levels(cellchat.group2@idents), levels(cellchat.group1@idents) )
To make sure, I run the example dataset of CellChat tutorial. As expected, different levels for liftCellChat result in same contribution, contribution.scaled, and contribution.relative.1 but with different pvalues for rankNet, also the different layout.
CODE-1
cellchat.E13 <- readRDS("cellchat_embryonic_E13.rds")
cellchat.E13 <- updateCellChat(cellchat.E13)
cellchat.E14 <- readRDS("cellchat_embryonic_E14.rds")
cellchat.E14 <- updateCellChat(cellchat.E14)
first E14 then E13
group.new <- union( levels(cellchat.E14@idents), levels(cellchat.E13@idents) )
group.new
[1] "FIB-A" "FIB-B" "FIB-P" "DC" "Pericyte" "MYL" "Immune" "ENDO" "Muscle" "MELA" "Basal-P" "Basal" "Spinious"
cellchat.E13 <- liftCellChat(cellchat.E13, group.new)
cellchat.E14 <- liftCellChat(cellchat.E14, group.new)
object.list <- list(E13 = cellchat.E13, E14 = cellchat.E14)
cellchat <- mergeCellChat(object.list, add.names = names(object.list), cell.prefix = TRUE)
rankNet(cellchat , slot.name = "netP", mode = "comparison", do.stat=TRUE, stacked = T, return.data=TRUE)
CODE-2
cellchat.E13 <- readRDS("cellchat_embryonic_E13.rds")
cellchat.E13 <- updateCellChat(cellchat.E13)
cellchat.E14 <- readRDS("cellchat_embryonic_E14.rds")
cellchat.E14 <- updateCellChat(cellchat.E14)
first E13 then E14
group.new <- union( levels(cellchat.E13@idents), levels(cellchat.E14@idents) )
group.new
[1] "FIB-A" "FIB-B" "FIB-P" "MYL" "Immune" "ENDO" "Muscle" "MELA" "Basal-P" "Basal" "Spinious" "DC" "Pericyte"
cellchat.E13 <- liftCellChat(cellchat.E13, group.new)
cellchat.E14 <- liftCellChat(cellchat.E14, group.new)
object.list <- list(E13 = cellchat.E13, E14 = cellchat.E14)
cellchat <- mergeCellChat(object.list, add.names = names(object.list), cell.prefix = TRUE)
rankNet(cellchat , slot.name = "netP", mode = "comparison", do.stat=TRUE, stacked = T, return.data=TRUE)