jinworks / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell and spatially resolved transcriptomics
GNU General Public License v3.0
209 stars 26 forks source link

RankNet for several samples #166

Open mboisvert1 opened 3 weeks ago

mboisvert1 commented 3 weeks ago

Hi,

I am wondering if it is possible to run the rankNet function on a cellchat object that has multiple (~5) different samples?

When I run compareInteractions on the cellchat object, it shows the # of interactions across all 5 samples. However, when I run rankNet, it only shows the comparison of signaling molecules between the first two samples.

gg1 <- rankNet(cellchat, mode = "comparison", measure = "weight", sources.use = NULL, targets.use = NULL, stacked = T, do.stat = TRUE) gg2 <- rankNet(cellchat, mode = "comparison", measure = "weight", sources.use = NULL, targets.use = NULL, stacked = F, do.stat = TRUE)

gg1 + gg2

sqjin commented 3 weeks ago

@mboisvert1 You can adjust the parameter comparison. If you want to show all samples in the same plot, you should set stacked = FALSE and comparison = c(1,2,3,4,5)