What about this approach based on edgeRUserGuide 3.3.1? It can be easily expanded to more complicated designs...

`targets<- data.frame(condition= rep(c('A', 'B', 'C'), each= 2), `

` row.names= c('sampleA1', 'sampleA2', 'sampleB1', `

` 'sampleB2', 'sampleC1', 'sampleC2'))`

`# > targets`

# condition

# sampleA1 A

# sampleA2 A

# sampleB1 B

# sampleB2 B

# sampleC1 C

# sampleC2 C

`matrixOfRawCounts<- matrix(rpois(n= 600, 100), ncol= 6)`

`Group<- as.factor(rep(c('A', 'B', 'C'), each= 2))`

`design <- model.matrix(~0+Group)`

colnames(design) <- levels(Group)

row.names(design)<- row.names(targets)

`#> design`

# A B C

# sampleA1 1 0 0

# sampleA2 1 0 0

# sampleB1 0 1 0

# sampleB2 0 1 0

# sampleC1 0 0 1

# sampleC2 0 0 1

# attr(,"assign")

# [1] 1 1 1

# attr(,"contrasts")

# attr(,"contrasts")$Group

# [1] "contr.treatment"

`## Now decide your contrasts of interest`

contrasts<- makeContrasts(

A_vs_B= A - B,

A_vs_C= A - C,

A_vs_BC= A - (B+C)/2,

# etc...

levels= design

)

# Contrasts

# Levels A_vs_B A_vs_C A_vs_BC

# A 1 1 1.0

# B -1 0 -0.5

# C 0 -1 -0.5

`## Fit model`

d <- DGEList(counts = matrixOfRawCounts, group = Group)

d <- calcNormFactors(d)

d<- estimateGLMCommonDisp(d, design)

d<- estimateGLMTagwiseDisp(d, design)

fit<- glmFit(d, design)

`## Get DEGs`

lrt<- glmLRT(fit, contrast= contrasts[, "A_vs_B"])

detable<- topTags(lrt)

`lrt<- glmLRT(fit, contrast= contrasts[, "A_vs_C"])`

detable<- topTags(lrt)

`lrt<- glmLRT(fit, contrast= contrasts[, "A_vs_BC"])`

detable<- topTags(lrt)

What's right or wrong will depend on the question you want to answer. So base your design on that.

89k