design matrix for a 4 groups comparision time series experiment
1
0
Entering edit mode
@rverstraten-8509
Last seen 8.7 years ago
United Kingdom

Hi 

 

I have done an illumina micro array and my experiment consists of 4 groups with treated/untreated data for 2 time points with replicates(3). I would like to use limma to find the differentially expressed genes between time points for treated and untreated samples across 4 groups, and comparing gene expression for the same time point.

conditions = c(wt-treat,wt-untreat,mut-treat,mut-untreat,norm-treat,norm-untreat,mock-treat,mock-untreat)

I am a beginner in R so any help is appreciated.

Thanks,

Ruth

limma design matrix • 1.9k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 12 hours ago
United States

With such a complex experimental design, it is probably easiest to create a factor that encompasses all the group/treatment/time combinations, fit the model, and then make whatever comparisons you want. Something like this:

> group <- factor(rep(c("wt","mut","norm","mock"), each = 12))
> treat <- factor(rep(c("treated","untreated"), each = 6, times = 4))
> time <- factor(rep(c("time1","time2"), each = 3, times = 8))
> grps <- factor(paste(group, treat, time, sep = "_"))

> levels(grps)
 [1] "mock_treated_time1"   "mock_treated_time2"   "mock_untreated_time1" "mock_untreated_time2"
 [5] "mut_treated_time1"    "mut_treated_time2"    "mut_untreated_time1"  "mut_untreated_time2"
 [9] "norm_treated_time1"   "norm_treated_time2"   "norm_untreated_time1" "norm_untreated_time2"
[13] "wt_treated_time1"     "wt_treated_time2"     "wt_untreated_time1"   "wt_untreated_time2"

Then you can fit a model using

design <- model.matrix(~0 + grps)
colnames(design) <- gsub("grps", "", colnames(design))

And then make any comparison you want, noting that this is just algebra, and most comparisons are just what you would expect them to be. In other words, if you want to compare mock treated at the two different times, it's just

contrast <- makeContrasts(mock_treated_time2 - mock_treated_time1, levels = design)

Or if you care about the difference between mock treated and untreated, averaged across the two times

contrast <- makeContrast((mock_treated_time1 + mock_treated_time2)/2 - (mock_untreated_time1 + mock_untreated_time2)/2, levels = design)

Or if you care about the interaction between time and treatment for mock samples

contrast <- makeContrast((mock_treated_time2 - mock_treated_time1) - (mock_untreated_time2 - mock_untreated_time1), levels = design)

Ideally you would make one big contrast matrix, rather than individual ones like that, but I don't want to confuse things. To do that, you just put all the comparisons in, followed by levels = design:

contrast <- makeContrast(mockTimeDiff = mock_treated_time2 - mock_treated_time1,
mockTrtDiff = (mock_treated_time1 + mock_treated_time2)/2 - (mock_untreated_time1 + mock_untreated_time2)/2,
mockInteraction = (mock_treated_time2 - mock_treated_time1) - (mock_untreated_time2 - mock_untreated_time1),
levels = design)

 

ADD COMMENT

Login before adding your answer.

Traffic: 909 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6