Hi,
we have a data set consisting of 48 samples in total. we have 4 time points (0,1,2,3), a control group (which has triplicates for each of the four time points) as well as three different conditions.
metadata <-
structure(list(condtion = structure(c(4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("KO1", "KO2",
"KO3", "WT"), class = "factor"), timepoint = structure(c(1L,
1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L,
2L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L,
4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("0h",
"1h", "2h", "3h"), class = "factor"), replicate = c(1L, 2L, 3L,
1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L,
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L)), class = "data.frame", row.names = c("sample1",
"sample2", "sample3", "sample4", "sample5", "sample6", "sample7",
"sample8", "sample9", "sample10", "sample11", "sample12", "sample13",
"sample14", "sample15", "sample16", "sample17", "sample18", "sample19",
"sample20", "sample21", "sample22", "sample23", "sample24", "sample25",
"sample26", "sample27", "sample28", "sample29", "sample30", "sample31",
"sample32", "sample33", "sample34", "sample35", "sample36", "sample37",
"sample38", "sample39", "sample40", "sample41", "sample42", "sample43",
"sample44", "sample45", "sample46", "sample47", "sample48"))
To analyze the data I have followed the user manual and created this design matrix
Group <- factor(paste(metadata$condtion,metadata$timepoint,sep="."))
design <- model.matrix(~0+Group)
colnames(design) <- levels(Group)
Now i would like to implore several comparisons. For that I need to create a contrast matrix
with this contrast matrix:
my.contrasts <- makeContrasts(
KO1vsWT.0h = KO1.0h-WT.0h,
KO1vsWT.1h = (KO1.1h-KO1.0h)-(WT.1h-WT.0h),
KO1vsWT.2h = (KO1.2h-KO1.0h)-(WT.2h-WT.0h),
KO1vsWT.3h = (KO1.3h-KO1.0h)-(WT.3h-WT.0h),
levels=design)
Q1. Can I, with this design matrix, identify genes differentially expressed in each time-point between the KO and the control (this simple pair-wise comparison would be done for each of the three KOs separately)?
But I would also like to identify genes changed over time, first within each condition and second between the KOs and the control. Here I would probably need a more complex (nested?) design. Here I'm struggling with the design/contrast matrix
Again, following the examples in the manual, I would like to use this design matrix
metadata$condtion <- relevel(metadata$condtion, ref="WT")
design2 <- model.matrix(~condtion * timepoint, data=metadata)
colnames(design2)
[1] "(Intercept)" "condtionKO1"
[3] "condtionKO2" "condtionKO3"
[5] "timepoint1h" "timepoint2h"
[7] "timepoint3h" "condtionKO1:timepoint1h"
[9] "condtionKO2:timepoint1h" "condtionKO3:timepoint1h"
[11] "condtionKO1:timepoint2h" "condtionKO2:timepoint2h"
[13] "condtionKO3:timepoint2h" "condtionKO1:timepoint3h"
[15] "condtionKO2:timepoint3h" "condtionKO3:timepoint3h"
Q2. How Can I now identify genes with a changed expression over time with a specific condition (e.g. only within the KO1 or KO2) over all timepoints?
Does edger can calculate this kind if behavior?
Q3. Is there also a way to compare the behavior over time between KO1 and the control?
qlf <- glmQLFTest(fit, coef=c(8,11,14))
Can this combination identify genes changed over all time points with a differential behavior between KO1and WT?
thanks a lot for any suggestions or corrections