Question: EdgeR with Paired Sample Replicates
1
gravatar for kmyers2
4 months ago by
kmyers220
University of Wisconsin-Madison
kmyers220 wrote:

I am running EdgeR to find differentially expressed genes and I want to make sure I am constructing the model and contrast correctly.

I have 9 total samples, 3 experimental samples (ExpA, ExpB, ExpC) and 6 controls samples (CtrlA1, CtrlA2, CtrlB1, CtrlB2, CtrlC1, CtrlC2). The samples with the same letter (ExpA, CtrlA1, CtrlA2 for example) were collected on the same day - thus the collections occurred on three different days. I need to find the genes that are differentially expressed between the experimental samples and the paired control samples but want to take into account the paired nature of the samples.

I have set up a group in EdgeR to use Exp/Ctrl and Day as grouping factors:

group <- factor(paste(targets$Experiment, targets$Day, sep = "."))

That yields six levels: Ctrl.A, Ctrl.B, Ctrl.C, Exp.A, Exp.B, Exp.C

I then use this to construct the design:

design <- model.matrix(~0+group)

That yields a design matrix that I use to perform the estimations and fit. Then to set up the differential comparison test, I use the following contrast:

my.contrasts <- makeContrasts(DipvsCtrl = (Exp.A-Ctrl.A)+(Exp.B-Ctrl.B)+(Exp.C-Ctrl.C), levels = design)

Quickly comparing the counts data seems to suggest this is the correct contrast to make, but I just wanted to see if anyone else could notice something I missed. Did I set up the contrast correctly to make the comparison I want to make?

Thanks!

rna-seq edger R • 197 views
ADD COMMENTlink modified 4 months ago by Benn6.6k • written 4 months ago by kmyers220
1
gravatar for Benn
4 months ago by
Benn6.6k
Netherlands
Benn6.6k wrote:

If you want to include "paired" in your design, you should not make the group factor, but include both experiment and day in the design.

experiment <- factor(targets$Experiment)
day <- factor(targets$Day)
design <- model.matrix(~0+experiment+day)

# Depending on the column names of your design:
my.contrasts <- makeContrasts(ExpvsCtrl = Exp - Ctrl, levels = design)
ADD COMMENTlink written 4 months ago by Benn6.6k

Thanks! So if I understand, this will maintain the days in the comparison right? It is best to compare samples collected on the same day (ExpA vs CtrlA). I just want to make sure I'm understanding it correctly.

ADD REPLYlink written 4 months ago by kmyers220
1

Yes you are testing "exp" vs "ctrl" with this design, but with the "day" effect taken into account (think of it as a similar approach to a paired t-test).

ADD REPLYlink written 4 months ago by Benn6.6k

Thank you very much! That makes sense to me and I really appreciate the help!

ADD REPLYlink written 4 months ago by kmyers220
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2044 users visited in the last hour