lmweber / diffcyt

R package for differential discovery analyses in high-dimensional cytometry data
MIT License
19 stars 12 forks source link

DA for multiple treatments #37

Open MayaCyTOFnewbie opened 2 years ago

MayaCyTOFnewbie commented 2 years ago

Hi!

thank you for this package and for the useful tutorials!

I am working on CyTOF generated data, where I have four groups of treatments, and I want to make three pairwise comparisons treatmentA to treatmentAB treatmentC to treatmentCB treatmentCB to treatmentAB

How do I create a design matrix and contrast?

this is what I did, but I am not sure it was the correct thing to do

my results don't show the different comparisons and without any statistical value

thanks!

condition = ei$condition
condition 

[1] treatmentA treatmentA treatmentA treatmentA treatmentA treatmentA treatmentAB treatmentAB treatmentAB treatmentC treatmentC treatmentC treatmentC treatmentC treatmentC treatmentC treatmentCB treatmentCB treatmentCB treatmentCB [21] treatmentCB Levels: treatmentA treatmentAB treatmentC treatmentCB


design <- model.matrix(~0+condition)

contrasts <- makeContrasts( treatmentAB-treatmentA,treatmentCB-treatmentC , treatmentCB -treatmentAB , levels=colnames(design))

da_res1 <- diffcyt(sce, design = design, contrast = contrasts, analysis_type = "DA", method_DA = "diffcyt-DA-GLMM", clustering_to_use = "merging")

rowData(da_res1$res)


>DataFrame with 11 rows and 3 columns
                             cluster_id     p_val     p_adj
                               <factor> <numeric> <numeric>
B cells             B cells                    NA        NA
CD4 T cells         CD4 T cells                NA        NA
CD45-               CD45-                      NA        NA
CD45- CD11b+ CD11c+ CD45- CD11b+ CD11c+        NA        NA
CD45+               CD45+                      NA        NA
CD8 T cells         CD8 T cells                NA        NA
DCs                 DCs                        NA        NA
Granulocytes        Granulocytes               NA        NA
Macrophages         Macrophages                NA        NA
Monocytes           Monocytes                  NA        NA
TCRgd T cells       TCRgd T cells              NA        NA
MayaCyTOFnewbie commented 2 years ago

Hi again,

can anyone help?

thanks again,

Maya

AntonioAhn commented 4 months ago

Hi Maya, did you figure this one out? I'm facing the same issue.

markrobinsonuzh commented 4 months ago

I'm not fully sure (I'm guessing), but often model.matrix() makes a modification to the column names with conditionXX when using ~0+condition, but I would need to check it.

If your code is like above, can you give the output of design and contrasts to make sure they match up correctly?