Dear all,
I need to understand that whether my design matrix and analysis are correct or not. I have tow conditions, 4 time points for each and their corresponding replicates (total 31 sample, unfortunately experiment is not equal designed). I have done my analysis through and the aim was to see differential changes in between times (age), differential changes in between groups (conditions) and differential changes in between time and groups.
# target file
Replicate Group Time
WT.T1.1 WT 1
WT.T1.2 WT 1
WT.T1.3 WT 1
WT.T2.1 WT 2
WT.T2.2 WT 2
WT.T2.3 WT 2
WT.T2.4 WT 2
WT.T3.1 WT 3
WT.T3.2 WT 3
WT.T3.3 WT 3
WT.T3.4 WT 3
WT.T4.3 WT 4
WT.T4.4 WT 4
WT.T4.5 WT 4
WT.T4.6 WT 4
KO.T1.1 KO 1
KO.T1.2 KO 1
KO.T1.3 KO 1
KO.T2.1 KO 2
KO.T2.2 KO 2
KO.T2.3 KO 2
KO.T2.4 KO 2
KO.T3.1 KO 3
KO.T3.2 KO 3
KO.T3.3 KO 3
KO.T3.4 KO 3
KO.T4.2 KO 4
KO.T4.3 KO 4
KO.T4.4 KO 4
KO.T4.5 KO 4
KO.T4.6 KO 4
age<-factor(substring(colnames(wt.ko_counts),4,5))
> age
[1] T1 T1 T1 T2 T2 T2 T2 T3 T3 T3 T3 T4 T4 T4 T4 T1 T1 T1 T2 T2 T2 T2 T3 T3
[25] T3 T3 T4 T4 T4 T4 T4
Levels: T1 T2 T3 T4
grp=factor(target$Group, levels=c("WT","KO"))
> grp
[1] WT WT WT WT WT WT WT WT WT WT WT WT WT WT WT KO KO KO KO KO KO KO KO KO
[25] KO KO KO KO KO KO KO
Levels: WT KO
## The aim was to see differential changes over times (age), differential changes in between groups (conditions) and differential changes in between time and groups.
design <- model.matrix(~age*grp)
colnames(design)
[1] "(Intercept)" "ageT2" "ageT3" "ageT4" "grpKO"
[6] "ageT2:grpKO" "ageT3:grpKO" "ageT4:grpKO"
lm.fit <- lmFit(wt.ko_counts, design)
eb <- eBayes(lm.fit)
topTable(eb, adjust="BH")
Finally, i plotted the expression values (from topTable) of each genes (taking the mean of replicates) which has lower than 0.05 FDR.
Query: Considering my aim, I need to understand that whether my design matrix and analysis are correct or not. or should i have to change something in my code or in design matrix. ?? Please note that here i didnt consider natural regression spline and degree of freedom as described in limma user-guide. is it necessary ??
Thanks