Hi all I have a design that I'm wondering if someone can help me double check. Basically I have he following groups.
Adult.autism
Peds.autism
Adult.control
Peds.control
I want to do the following comparisons
* compare ped control vs. ped autism
* compare adult control vs adult autism
* ped autism vs adult autism
* ALL control vs ALL autism regardless of age.
Here are my codes and design. Can someone help confirm if this is correct? especially the last all group. thanks.
group <- factor (key)
design <- model.matrix(~0+group )
colnames(design) = gsub ( "group","", colnames(design))
fmain <- lmFit(voom.data, design )
contrast.matrix <- makeContrasts(p = ped.control - ped.autism,
a = adult.control - adult.autism,
pVSa = ped.autism - adult.autism,
ALL = (adult.autism + ped.autism) - (adult.control + ped.control ),
levels=design
)
fmain.r <- contrasts.fit(fmain, contrast.matrix)
fmain.r <- eBayes(fmain.r)
result.p <- topTable(fmain.r, coef="p", n=Inf )
result.a <- topTable(fmain.r, coef="a", n=Inf )
result.pVSa <- topTable(fmain.r, coef="pVSa", n=Inf )
result.ALL <- topTable(fmain.r, coef="ALL", n=Inf )
Great thank you for helping confirm this. and yes I can now see that dividing by 2 is necessary. There is a strange issue however that, only on certain datasets, for some weird reason, running all the groups together and than building the contrast, for example, in the a = adult.control - adult.autism, when I do this separately or together as the above example the logFC calculation is different!? perhaps I should start a new thread. Thing is I need to create a test set that can recapitulate this because on some dataset this does not happen. Weird.