7 days ago by
From the discussions above, I believe you are being asked to test the difference between those samples in group A compared to an average of all the samples. This is, in fact, the traditional (before R) way to test contrasts.
This, it turns out, is actually fairly easy to code up, and simply relies on using a different contrast encoding system for your model matrix.
Create a conditions frame/factor for your groups (A or B) and set its contrasts model to
cluster <- factor(c("A", "A", "B", "B")
contrasts(cluster) <- contr.sum(2)
You can now create your model matrix as usual:
design = model.matrix(~ 1 + cluster)
When you fit your linear model, your will fit two coefficients, one is the intercept (that is effectively A+B) and the other is the difference for A (or membership of cluster A). There is no need to fit a contrast in your
edgeR workflow, the coefficient of interest will be coef=2 in your