In a cohort of cancer samples there are 4 groups, G1 to G4. I want to perform differential gene expression between group1 Vs all other groups, i,e, G1 = G1-(G2+G3+G4)/3, to determine DEGs for group 1.
I could just find an example in limma guide where pair-wise comparisons being made ( under 9.3. several groups) with following example
f <- factor(targets$Target, levels=c("RNA1","RNA2","RNA3")) design <- model.matrix(~0+f) colnames(design) <- c("RNA1","RNA2","RNA3") To make all pair-wise comparisons between the three groups one could proceed fit <- lmFit(eset, design) contrast.matrix <- makeContrasts(RNA2-RNA1, RNA3-RNA2, RNA3-RNA1, levels=design) fit2 <- contrasts.fit(fit, contrast.matrix) fit2 <- eBayes(fit2)
I am wondering how should I formulate that in contrast matrix to be statistically correct?
would this be correct to write it like this:
design1 <- model.matrix(~0+factor(annot$grp, levels = unique(annot$grp))) colnames(design1) <- unique(annot$grp) row.names(design1) <- row.names(annot) wt <- arrayWeights(HTA) fitHTA <- lmFit(HTAEXP, design1, weights = wt) genas(fitHTA, subset="Fpval", plot=TRUE, alpha=0.4) cm1 <- makeContrasts(G1 = G1-(G2+G3+G4)/3, G2 = G2-(G1+G3+G4)/3, G3 = G3-(G1+G2+G4)/3, G4 = G4-(G1+G2+G3)/3, levels=design1)
Thanks in advance.