Hi, I am analysing an RNAseq dataset for which I have two kinetic, postprandial responses that I wish to compare- milk vs yoghurt (time 0, 2h, 4h, 6h). I have 7 repetitions for each condition and time as the experiment was completed with a cross-over design. I have used Limma with an adapted version of the time course model detailed in the Limma Vignette to assess whether there is a response for either condition (milk or yoghurt response versus 0) separately and then between the two conditions (please see my code below). I have three questions:
1. Is it correct to control for the volunteer variable using the blocking factor 'Subject' or is there a better way to exploit the paired nature of the study.
2. With the current coding are the time differences calculated separately for each individual before an assessment of the mean difference i.e mean(T120subject x-T0subjectx) or is the difference assessed by the mean T120-mean T0. (It should be the first option but am not sure whether the blocking is adequate to ensure this).
3. How is each contrast assessed? Independantly or is there any consideration of the fact that the time differences are part of a continuous series (ie. will three small differences show an overall difference even if separately there is no significant difference?)
cols<-c("Day5_dairy","Time5") Postprandial$MY=do.call(paste, c(Postprandial[cols],sep='.'))
lev <- c("Milk.T0","Milk.T120","Milk.T240","Milk.T360","Yogurt.T0","Yogurt.T120","Yogurt.T240","Yogurt.T360") f <- factor(Postprandial$MY, levels=lev) design <- model.matrix(~0+f) colnames(design) <- lev Subject=Postprandial$Subject.ID Counts=counts_pp20
corfit= duplicateCorrelation(Counts,design,block=Subject) fit <- lmFit(Counts, design,block=Subject, correlation=corfit$consensus)
##########Analysis Milk
cont.M <- makeContrasts("Milk.T120-Milk.T0","Milk.T240-Milk.T120","Milk.T360-Milk.T240", levels=design) fit2 <- contrasts.fit(fit, cont.M) fit3 <- eBayes(fit2) ttMilk=topTableF(fit3, number=nrow(Counts),adjust="fdr", genelist=rownames(Counts))
#Comparison yoghurt versus 0 ###Raw counts used without T0 deducted to correct individual baseline cont.Y <- makeContrasts("Yogurt.T120-Yogurt.T0","Yogurt.T240-Yogurt.T120","Yogurt.T360-Yogurt.T240", levels=design) fit2 <- contrasts.fit(fit, cont.Y) fit2 <- eBayes(fit2) ttYog=topTableF(fit2, number=nrow(Counts),adjust="fdr", genelist=rownames(Counts))
#Use time course approach to assess the differences between milk and yoghurt
cont.dif <- makeContrasts( Dif120hr =(Yogurt.T120-Yogurt.T0)-(Milk.T120-Milk.T0), Dif240hr =(Yogurt.T240-Yogurt.T120)-(Milk.T240-Milk.T120), Dif360hr =(Yogurt.T360-Yogurt.T240)-(Milk.T360-Milk.T240), levels=design) fit2 <- contrasts.fit(fit, cont.dif) fit2 <- eBayes(fit2) ttMY=topTableF(fit2, number=nrow(Counts),adjust="fdr", genelist=rownames(Counts))
With many thanks,
Kathryn
For future reference, please respond to existing posts with "add comment" rather than "add answer".
For how blocking would work in GLS, consider a situation where samples 1-3 belong in block A, samples 4-5 in block B, and samples 6-10 in block C. You'd end up with a correlation matrix that looks like:
... where
x
is the consensus correlation. This matrix, I think, would be the value of the Omega in https://en.wikipedia.org/wiki/Generalized_least_squares (give or take a scaling factor for the variance). One could then find the least squares solution, while accounting for intra-block correlations. In effect, the off-diagonal entries downweight the contribution of samples in the same block to the residual sum of squares. This is desirable as correlated samples in the same block provide less information than if they were independent. I don't know of a limma-specific citation for the use of GLS, but there's one forduplicateCorrelation
.As for the ANOVA-like F-test, there's a couple of mentions of this behaviour of
topTable(F)
in the limma book and user's guide, and there's a more mathematical description of the moderated F-statistic in the SAGMB paper.Thank you Aaron for your clear and complete response- I am grateful for your patience in explaining this to me. I will make reference to the described paper and Limma Vignette.