I am trying to use limma-voom to determine the effect of a condition between males and females. Even after reading through the users guide and several similar posts online I am still confused and would very much appreciate some guidance.
I have paired samples, and my data looks as such (following the edgeR user's guide):
sample | condition | sex | nested |
sample1 | pre | M | 1 |
sample1 | post | M | 1 |
sample2 | pre | M | 2 |
sample2 | post | M | 2 |
sample70 | pre | F | 1 |
sample 70 | post | F | 1 |
... | ... | ... | ... |
As of right now, here is how I set up my design matrix and collect the results:
design = ~ sex + sex:nested + sex:condition
v = voom(dge, design, plot=FALSE)
fit = lmFit(v, design)
#construct contrast matrix
p <- ncol(fit)
cont <- rep(0, p)
cont[p] <- 1
cont[p-1] <- -1
fit2 = contrasts.fit(fit, cont)
fit2 = eBayes(fit2)
results = decideTests(fit2)
> summary(results)
[,1]
-1 0
0 21457
1 0
It seems strange that I'm getting nothing, leading me to believe that I'm testing the contrast incorrectly. Did I fit the contrast correctly, or is it a problem with how I set up the interaction terms in my design? I'm pretty confused, so any help would be greatly appreciated.
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.8 (Final)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] edgeR_3.16.5 limma_3.30.10
loaded via a namespace (and not attached):
[1] grid_3.3.1 locfit_1.5-9.1 lattice_0.20-33
I apologize, I did define the design matrix using the model.matrix function, I forgot that bit. The terms I am trying to contrast are the last 2 columns in the design matrix: "sexMale:conditionpost" and "sexFemale:conditionpost".
Thank you very much for the thoughtful advice. I'll be sure to implement your suggestions.