phipsonlab / speckle

R package for analysing single cell data
GNU General Public License v3.0
48 stars 6 forks source link

plotCellTypeProps Mean and propeller.ttest/propeller.anova means are different #5

Open basedank opened 1 year ago

basedank commented 1 year ago

Hello,

Thank you for developing this wonderful tool! I'm working with scRNA-seq data. I'm trying to extract the plotting information from plotCellTypeProps by accessing that object's $data so that I can use those cell proportions when making a customized ggplot box-and-whisker plot of cell proportions. The problem is that I want to append the

pbloodImm <- plotCellTypeProps(clusters = bloodImm$RNA_snn_res.0.8, sample = bloodImm$Patient_ID) 
Immprops <- pbloodImm$data 

Immprops will be used to store the different proportions per cluster and I append Disease subgroup (Control vs Diseased.1 vs Diseased.2) for each patient to that to dodge my box-and-whisker plot later on.

bloodImmprops <- getTransformedProps(clusters = bloodImm$RNA_snn_res.0.8, 
                                  sample = rownames(bloodImm@meta.data))

I use bloodImmprops as the prop.list for the propeller.ttest/anova function. rownames(bloodImm@meta.data) are individual cells

The problem is that when I calculate the mean per each unique Cluster + Disease status combination, they are different than the means generated from propeller.ttest/anova and thus do not make sense when I visualize the ggplot with the manually-added p-values.

image

The bold text is the mean calculated from the plotCellTypeProps data. So for the proportions, Control = 0.084 and Disease = 0.089

Here is the output of the simple propeller function: image

We can see that the mean proportions are very similar to the ones I extracted and summarized from the plotCellTypeProp data.

But, when I run propeller.ttest or propeller.anova, I get different means for my groups... image

This is the output of propeller.ttest between Control and Disease for cluster 11 - Blood. As we can see, the proportions here differ if different directions since Control = 0.09 and Disease = 0.087

How can this be fixed?