Limma design matrix only showing 3/4 treatments?
1
0
Entering edit mode
avery • 0
@b923a20f
Last seen 7 months ago
Canada

So I have a group project where we must take RNAseq data and analyze it ourselves. We decided to use limma in order to do so, but are having some trouble understanding how to build the design matrix. There are two factors in the experiment: carbon source which is either CH4 or MeOH and nitrogen source which is either NMS or AMS. I extracted the factors for the carbon and nitrogen groups respectively, and they give the correct output, as seen below.

> Carbon <- as.factor(meta$Carbon)
> print(Carbon)
 [1] CH4  CH4  CH4  CH4  CH4  CH4  MeOH MeOH MeOH MeOH MeOH MeOH
Levels: CH4 MeOH
> Nitrogen <- as.factor(meta$Nitrogen)
> print(Nitrogen)
 [1] NMS NMS NMS AMS AMS AMS NMS NMS NMS AMS AMS AMS
Levels: AMS NMS

I then built the design matrix for a two-factor additive experiment, but when I look at the design matrix it only show 3 treatment groups. I also tried to build the contrast matrix but I'm having trouble with it as well. Am I doing something wrong?

> design <- model.matrix(~0+Carbon+Nitrogen)
> design
   CarbonCH4 CarbonMeOH NitrogenNMS
1          1          0           1
2          1          0           1
3          1          0           1
4          1          0           0
5          1          0           0
6          1          0           0
7          0          1           1
8          0          1           1
9          0          1           1
10         0          1           0
11         0          1           0
12         0          1           0
attr(,"assign")
[1] 1 1 2
attr(,"contrasts")
attr(,"contrasts")$Carbon
[1] "contr.treatment"

attr(,"contrasts")$Nitrogen
[1] "contr.treatment"

Thanks!

limma designmatrix • 352 views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 3 minutes ago
WEHI, Melbourne, Australia

How to construct the design matrix for a two-factor experiment like this is explained in Section 9.5 of the limma User's Guide.

ADD COMMENT

Login before adding your answer.

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