I need help with Time series testing using DESeq2. - I have 5 subjects given same treatment at 11 different time points (for each subject: single observation at 1 day interval from 0d through 10d).
I). the sampledata table looks like (tab-delimited):
subject time (d)
A D0 ... A D10
B D0 ... B D10
C D0 ... C D10
D D0 ... D D10
E D0 ... E D10
II). The objective is to compare each time point with 0d (baseline reference) within each subject, separately: for example, D_D10 vs D_D0 (not the default baseline A_D0). I tried to set A, B, C, D & E by turn as baseline subjects and D0 as baseline time and use the contrast shown below in an example for subject D.
- set relevel for subject
sampledata$subject <- relevel(sampledata$subject, ref = "D");
- set relevel for time factor (default anyway)
sampledata$time <- relevel(sampledata$time, ref = "D0");
- create DESeq data object & define model design
ddsD <- DESeqDataSetFromMatrix(countData = countsdata, colData = sampledata, design = ~ subject + time);
- LRT test with reduced model
ddsD <- DESeq(ddsD, test="LRT", reduced = ~subject); #or ~time (get the same comparison terms)
resultsNames(ddsD)  "Intercept" "subject_A_vs_D" "subject_B_vs_D"  "subject_C_vs_D" "subject_E_vs_D" "time_D1_vs_D0"
 "time_D2_vs_D0" "time_D3_vs_D0" "time_D4_vs_D0"
 "time_D5_vs_D0" "time_D6_vs_D0" "time_D7_vs_D0"
 "time_D8_vs_D0" "time_D9_vs_D0" "time_D10_vs_D0"
ignore subject effect terms & use only (baseline) time point comparison terms as below results(ddsD, name= "time_D10_vs_D0", test="Wald");
Will this work for my objective? I am not sure which 'D0' is being used here (is it from subject A or D?). If this is wrong, how should I proceed with the test? Thanks.