Search
Question: DESeq2 combining factors in contrasts
0
8 months ago by
chang02_2320
United States
chang02_2320 wrote:

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"))

modified 8 months ago by Michael Love18k • written 8 months ago by chang02_2320
1
8 months ago by
Michael Love18k
United States
Michael Love18k wrote:

Take a look at numeric contrasts described here ?results

Is this the correct way for comparing group a and average of (group b + c)

resultsNames(dds)
[1] "Intercept"  "conditiona" "conditionb" "conditionc"
results(dds, contrast=c(0,1,-0.5,-0.5))
1

Yes that's it.