Design matrix for edge R analysis?
0
0
Entering edit mode
6.6 years ago
star ▴ 350

I would like to compare Q method against L method, and I have considered 2 different contrasts (at the end), but I am not sure which on is correct?

There are 2 different methods (Q and L) and from each one there are 2 biological replicates (L4,L6-L8 and Q3,Q5-Q7), and 2 technical replications from each biological replicate. as below:

design

                    biological_replicate   method
 L4_rep1                              L4       L
 L4_rep2                              L4       L
 L6_L8_rep1                        L6_L8       L
 L6_L8_rep2                        L6_L8       L
 Q3_rep1                              Q3       Q
 Q3_rep2                              Q3       Q
 Q5_Q7_rep1                        Q5_Q7       Q
 Q5_Q7_rep2                        Q5_Q7       Q

design$biological_replicate <- factor(design$biological_replicate, levels = c("L4","L6_L8", "Q3", "Q5_Q7"))

design$method <- factor(design$method, levels = c("L", "Q"))

Group <- factor(paste(design$biological_replicate,design$method,sep="."))

design<- cbind(design,Group)

                    biological_replicate method   Group
L4_rep1                              L4      L    L4.L
L4_rep2                              L4      L    L4.L
L6_L8_rep1                        L6_L8      L L6_L8.L
L6_L8_rep2                        L6_L8      L L6_L8.L
Q3_rep1                              Q3      Q    Q3.Q
Q3_rep2                              Q3      Q    Q3.Q
Q5_Q7_rep1                        Q5_Q7      Q Q5_Q7.Q
Q5_Q7_rep2                        Q5_Q7      Q Q5_Q7.Q

design.matrix <- model.matrix(~0+Group,design)

colnames(design.matrix) <- levels(Group)

my.contrasts_1 <- makeContrasts(QvsL = (Q3.Q+Q5_Q7.Q)/2-(L4.L+L6_L8.L)/2, levels = design.matrix)

my.contrasts_2 <- makeContrasts(QvsL = (Q3.Q+Q5_Q7.Q)-(L4.L+L6_L8.L), levels = design.matrix)

r edgeR bioconductor limma statistics • 1.6k views
ADD COMMENT
1
Entering edit mode

The contrasts are the same from a hypothesis testing perspective. I'd use the contrast 1 however (the difference between the averages) as the contrast coefficient that it returns will look like the difference on a log2 boxplot

ADD REPLY

Login before adding your answer.

Traffic: 2068 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