Design Matrix for a paired experiment
1
0
Entering edit mode
p_das • 0
@p_das-8653
Last seen 4.8 years ago
United States

Hi

This is my experiment:

2 groups - Intact and Castrated. Each group has 3 mice, so 3 mice in the intact group and 3 in the castrated group.

Each mice is starts with baseline diet, then shifts to Chow, then High-fat diet and finally calorie-restricted diet.

I need suggestions for the design matrix.

Thank you

Prerna

bioconductor edger • 740 views
0
Entering edit mode

So, 4 samples for each mouse; 24 samples in total? Also, what is the aim of your analysis, i.e., what DE do you want to find?

0
Entering edit mode

Hi Aaron

For the time being, I can consider one group - which has 3 mice. Mouse 1 gets these diets - B, CH, HFD and CR, one after the other. Mouse 2 gets these diets - B, CH, HFD, and CR. Mouse 3 also gets the same four diets. At the end of each diet period, a muscle biopsy was done followed by RNASeq. These is a paired experiment with the same subject getting all four different diets , similar to example in the edgeR manual about normal and carcinoma tissue from the same individual.

To create the design matrix, this is my  R code

mice <- factor(c(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3))
diet <- factor(c("B", "CH", "H", "CR", "B", "CH", "H", "CR", "B", "CH", "H", "CR"))
data.frame(Sample=colnames(cds), mice, diet)
design <- model.matrix(~mice+diet)

This makes the mouse 1 as ref and diet B as ref.

Now, I want to compare diet CH vs diet B ?? How can I do that?

Thank you

2
Entering edit mode
@gordon-smyth
Last seen 14 minutes ago
WEHI, Melbourne, Australia

Dear Prema,

Have you tried reading the edgeR User's Guide? I would have thought the one group experiment you give code for is essentially the same as the example discussed in Section 3.4.2 of the edgeR User's Guide.

Anyway, you have almost answered your own question. You have noted that diet B is the ref, so you only need to test for the CH coefficient to compare CH to B. After you estimate the dispersions by:

dge <- estimateDisp(dge design)

and fit a glm by

fit <- glmFit(dge, design)

you can go on to compare CH to B by

lrt <- glmLRT(fit, coef="dietCH")
topTags(lrt)


You might find it helpful to type colnames(fit) to see the identities of the coefficients that have been fitted and can be tested.

0
Entering edit mode

Hi Prof Smyth

Thank you for helping me out!

What if I don't want the diet B to my ref level? Do I order the factor levels in diet vector?

Thank you!

Prerna

1
Entering edit mode

Just supply the diet vector to relevel, and specify the desired diet to be used as the new reference as the ref argument. Of course, you can just use makeContrasts to specify a contrast that doesn't involve diet B, if that's your reason for wanting to change the reference level.

0
Entering edit mode

Hi Aaron!

Does this look alright to you...I have not changed any reference levels -

CHvsH <- makeContrasts(dietCH - dietH, levels=design) # compare diet CH with diet H, reference level is still diet B

Thank you!

Prerna

1
Entering edit mode

That's right. The dietCH and dietH coefficients represent the log-fold changes of the respective diets over diet B, so comparing them to each other will detect DE between diets CH and H.