ordinal treatment group design / contrast matrix
1
0
Entering edit mode
Chris • 0
@72f8727f
Last seen 24 days ago
United Kingdom

Looking to get some advice on the appropriate design / contrast matrix for my analysis please. I have 30 independent samples that have been generated in three batches. Each batch contains 10 samples (5 treated and 5 untreated controls). The treated samples in each batch are from a different time-point - where time-point is an ordinal variable; batch 1 = "short time point", batch 2 = "medium timepoint", batch 3 = "long timepoint".

time      <- rep(c("short", "medium", "long"), 10)
treatment <- rep(c(rep("drug",3),rep("control", 3)), 5)
batch     <- rep(c("1", "2", "3"), 10)

tibble(treatment, time, batch)


I am looking to identify genes that up- / down-regulated across all time points. Because time point and batch are indistinguishable, I would also like to use the control samples to adjust for any batch effects (assuming all control samples are similar across batches). Any advice greatly appreciated.

limma • 143 views
1
Entering edit mode
@james-w-macdonald-5106
Last seen 2 days ago
United States

Since you have aliased batch and time, you can't assume controls are the same across batches. Instead you have to make comparisons between drug and control within each batch, and then you can make comparisons between those differences. The easiest way to do that is to combine the time/treatment combinations and then make explicit comparisons.

> library(limma)
> combo <- paste(treatment, time, sep = ".")
> design <- model.matrix(~0+combo)
> colnames(design) <- gsub("combo", "", colnames(design))
> cont <- makeContrasts(Trt.short = drug.short - control.short,
+                       Trt.med = drug.medium - control.medium,
+                       Trt.long = drug.long - control.long,
+                       Trt.long.vs.short = (drug.long - control.long) - (drug.short - control.short),
+                       Trt.med.vs.short = (drug.medium - control.medium) - (drug.short - control.short),
+                       Trt.long.vs.med = (drug.long - control.long) - (drug.medium - control.medium),
+                       levels = design)
> cont
Contrasts
Levels           Trt.short Trt.med Trt.long Trt.long.vs.short Trt.med.vs.short
control.long           0       0       -1                -1                0
control.medium         0      -1        0                 0               -1
control.short         -1       0        0                 1                1
drug.long              0       0        1                 1                0
drug.medium            0       1        0                 0                1
drug.short             1       0        0                -1               -1
Contrasts
Levels           Trt.long.vs.med
control.long                -1
control.medium               1
control.short                0
drug.long                    1
drug.medium                 -1
drug.short                   0