Entering edit mode
I have a data set comprised of 3 conditions - a, b, and c. I want to compare DEG between group a and average of (group b + c), also just DEG between group a in b. In Limma, I would construct a design matrix like the following
design = cbind(a=c(1,1,1,0,0,0,0,0,0), b=c(0,0,0,1,1,1,0,0,0), c=c(0,0,0,0,0,0,1,1,1)) cont.matrix = makeContrasts(a-(b+c)/2, a-b, levels=design)
I'm trying to replicate my analysis with DESeq2. Here is some test data, and code to show I can extract DEG results between group a and b, b.
However, How do I get DEG between group a and average of (group b + c) ?
test_data=sapply(rep(20,9), function(x) { sample(seq(1:100), x) }) col_data = data.frame(condition=c("a","a","a","b","b","b","c","c","c")) dds = DESeqDataSetFromMatrix(countData = test_data, colData = col_data, design = ~ condition) dds <- DESeq(dds) resultsNames(dds) results(dds, contrast=c("condition","a","b"))
Is this the correct way for comparing group a and average of (group b + c)
Yes that's it.