sqjin / CellChat

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

Differences in results when comparing two datasets #630

Open ghost opened 1 year ago

ghost commented 1 year ago

I'm using Cellchat to compare two datasets with different conditions. In part 1, I make a heatmap with the differential number of interactions and interaction strengths among different celltypes and then I proceed with simplifying the complicated network by visualizing only a few celltypes.

When I compare these two plots, it shows completely different results. image image

For example: Here we see that in the heatmap the adipocytes have a lower differential number of interactions, while in the second plot, we see a red line which means a higher differential number of interactions.

Does anyone know why there is such a difference?

sqjin commented 1 year ago

This is unexpected. Both functions extracts the data using the code below obj1 <- @.[[comparison[1]]][[measure]] obj2 <- @.[[comparison[2]]][[measure]] net.diff <- obj2 - obj1

Do you have the same cell compositions across conditions?

On Thu, Jun 8, 2023 at 6:17 PM Orybies @.***> wrote:

I'm using Cellchat to compare two datasets with different conditions. In part 1, I make a heatmap with the differential number of interactions and interaction strengths among different celltypes and then I proceed with simplifying the complicated network by visualizing only a few celltypes.

When I compare these two plots, it shows completely different results. [image: image] https://user-images.githubusercontent.com/98324133/244351927-24b1ee2f-a7b3-4b40-b9b9-52117808c04f.png [image: image] https://user-images.githubusercontent.com/98324133/244351983-51f761e1-72d4-475e-8e8a-9cd35b50df52.png

For example: Here we see that in the heatmap the adipocytes have a lower differential number of interactions, while in the second plot, we see a red line which means a higher differential number of interactions.

Does anyone know why there is such a difference?

— Reply to this email directly, view it on GitHub https://github.com/sqjin/CellChat/issues/630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXF63DV6BZAJL5OYJ5WOSDXKGRD7ANCNFSM6AAAAAAY7CTLDM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

htejedam commented 1 year ago

I had the same issue. This happens for some reason when you have more than 2 clusters with 0 cells in one of your compared conditions. But @sqjin is right, if you make sure that you have same cell compositions, this should be solved.

Rhacki commented 1 year ago

Is "same cell composition" defined by having the same (number of) clusters or the same cell number of cells in each cluster in each condition ? For example Cluster 5 has to contain 50 cells both in condition A and B? @htejedam

htejedam commented 1 year ago

Means to have the same number of clusters with a cell number >0. (Preferably >20 cells I would say is better). E.g. Condition 1: A (200 cells), B (150 cells), C (500 cells). Condition 2: A (400 cells), B (50 cells), C (200 cells).