Hi all, I am struggling to make a contrast with EdgeR.
design <- model.matrix(~Gender + Age + Group, data = patient.table)
The (disease) Group is a factor with [Control, Mild, Severe]. I want to compare C-M. M-S and C-S. Thus s i
DGEL <- edgeR::DGEList(expressionData)
keep <- edgeR::filterByExpr(DGEL)
DGEL <- DGEL[keep, , keep.lib.sizes=FALSE]
DGEL <- edgeR::calcNormFactors(DGEL, method = "TMM")
DGEL <- edgeR::estimateDisp(DGEL, design)
fit <- edgeR::glmQLFit(DGEL, design)
contrasts <- makeContrasts(c.vs.m = GroupC - GroupM,
m.vs.s = GroupM - GroupS,
c.vs.s = GroupC - GroupS,
levels = design)
However, there is no GroupC in the model matrix. There is only an Intercept, GroupM and GroupS. How can I compare anything against the control group on a full-rank design matrix.
I already searched in the user manual and here on the website, but could not find it. Also, I tried
design <- model.matrix(~Gender + Age + Group,
data = patient.table,
contrasts.arg = list(
Group = contrasts(patient.table$Group, contrasts = FALSE)
)
)
But edgeR did not like that and informed me that the table was not of full rank. I am pretty sure this is something basic, but I just don't get it as a wet-lab worker.
Hey @h.mon, thanks for the reply. Is it correct that if I only have GroupM and GroupS, that just filling in GroupM or GroupS would be a comparison of the group agains baseline (groupC) ?
No, not when you set the intercept to zero.
Even if the intercept isn't set to zero, one needs (I certainly need) to examine the design and contrasts carefully to understand which comparisons are being made.
Ok, so... Making a design and then comparing COEFs is probably the hardest thing in EdgeR or DE in general. Up to now. I changed my code slightly;
This makes it so that the design has all the groups that I want to compare. Then I use the makeContrasts and glmQLFTest functions to get the result I want (was also incorrect):