I would like to look at the differential expression of three groups- all with the same condition. Most resources I found focus on two-group comparison or two condition and two group comparison. I have not found anything for one condition and three group comparisons.
For example, I want to know what genes differ among three types of cells- type A, type B, and type C. I found suggestions to set up three separate pairwise comparisons (A/B, A/C, B/C), but would like to set up one three-group comparison (A/B/C) to determine which genes are unique to each cell type.
I have looked into using the contrast argument of the results function to extract comparisons, but get the error “(Type A) should be the name of a factor in the colData of the DESeqDataSet.”
dds <- DESeqDataSetFromMatrix(counts, DataFrame(groups), ~groups)
dds <- DESeq(dds)
res <- results(dds, contrast = c("Type A", "Type B", "Type C"))
Any advice is appreciated!
I think this is not the proper way to use the contrast argument. If I understand correct what you need is, the genes specific to one type compared to the average of 2 other types. If so, following should work
So type_A_result means how A changes with B and C as reference right?
Eg: if the Logfoldchange for Gene1 in type_A_result is 2.002, that means Gene1 is upregulated in A over B and C right?
Another kind of clunky way to do it would be to make more groups, one being "A" and "notA", the next group being "B" or "notB", etc.
According to your error, I thought your colData input (DataFrame(groups) in your case) is not understandable for the function. So, the groups should be determined with factor function, and converted to the database which has the row.names are the names you wrote in contrast. I think you can create the different scenarios such as one condition and three comparisons with this way, I think.
And after DESeq function, results function should work when you type inputs like this (those codes will be different for your scenario for sure):