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!