sqjin / CellChat

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

CellChat Visualization between specified sources and targets #253

Open flolesage opened 3 years ago

flolesage commented 3 years ago

I would like to calculate the aggregated cell-cell communication network between only a couple of source cell types and a couple of target cell types.

I'm using the following code:

Calculate the aggregated cell-cell communication network

cellchat <- aggregateNet(cellchat, sources.use = c(32,35), targets.use = c(2,5))

Visualize

groupSize <- as.numeric(table(cellchat@idents))
par(mfrow = c(1,2), xpd=TRUE)
netVisual_circle(cellchat@net$count, vertex.weight = groupSize, weight.scale = T, label.edge= F, title.name = "Number of interactions")
netVisual_circle(cellchat@net$weight, vertex.weight = groupSize, weight.scale = T, label.edge= F, title.name = "Interaction weights/strength")

After running this code, I get the following error: Error in plot.window(...) : need finite 'xlim' values

Would you be able to help out? Running AggregateNet(cellchat) works for downstream visualization and analysis (so using the entire dataset), but not anymore when I add arguments for sources and targets.

Thanks!

sqjin commented 2 years ago

@flolesage I tried it using the example in the tutorial, but I did not encounter any issue. You can also try the function 'subsetCellChat'

williamhsy commented 2 years ago

Hi. Nice tool! I have a question related to this topic. I was wondering if it is possible to visualize all interaction results between specific sources and targets using the netVisual_bubble function. For example, I have three cell types (A, B and C). I am just interested in interaction between (A -> B, B -> A and A -> C), is there a way just to show these three interactions? Thanks.

sqjin commented 2 years ago

@williamhsy I am afraid not.