Hi all,
I am trying to figure out signals from DNA methylation for a continuous variable at multiple groups. We have mice samples at 4 time points in both sexes, and we are testing if DNA methylation positions respond to V1 using limma
I used the following design matrix and added duplicateCorrelation for random effect. I am asking the following three questions:
- which DNA methylation positions respond to V1 in females?
- which DNA methylation positions respond to V1 in males?
- which DNA methylation positions respond to V1 differently between females and males?
V1 = meta_dat$variable
sex = meta_dat$sex
X = ns(meta_dat$time_point, df = 3)
design = model.matrix(~ 0 + sex + sex:V1 + X)
Q1: Does this design matrix make any sense?
The results from limma gave the following columns
colnames(coef(fit2))
[1] "sexfemale" "sexmale" "X1" "X2" "X3"
[6] "sexfemale.V1" "sexmale.V1"
To answer the above questions,
topTable(fit2, coef = 6, n = Inf, adjust.method = "BH")
topTable(fit2, coef = 7, n = Inf, adjust.method = "BH")
cont_sexdiff = makeContrasts(sexfemale.V1 - sexmale.V1, levels = colnames(coef(fit2))) fit_cont = contrasts.fit(fit2, cont_sexdiff) fit_cont = eBayes(fit_cont) topTable(fit_cont, n = Inf, adjust.method = "BH")
Q2: Is my approach appropriate? Thank you.
Thank you, Gordon. X is time splines for time point, and yes, it's needed.
However, I was also thinking to incorporate time point with sex, but the splines will no longer be available.
Which design will you recommend?