diffcyt icon indicating copy to clipboard operation
diffcyt copied to clipboard

DA for multiple treatments

Open MayaCyTOFnewbie opened this issue 3 years ago • 3 comments

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 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 avatar Feb 09 '22 13:02 MayaCyTOFnewbie

Hi again,

can anyone help?

thanks again,

Maya

MayaCyTOFnewbie avatar Feb 24 '22 08:02 MayaCyTOFnewbie

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

AntonioAhn avatar May 05 '24 05:05 AntonioAhn

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?

markrobinsonuzh avatar May 05 '24 15:05 markrobinsonuzh