I am creating DeSeqDataSet and I am unsure whether I need to include the number of mice into the design formula. Basically, the samples look like that:

enter image description here

I have 4 different groups: GF, B6, ET and Wld. It is obvious that these should go into the design formula, but I am not sure about the mice number. Basically for each group, e.g. GF, there are 4 experiments with 1, 2, 3 and 4 mice each. When I am trying to use both Groups and Mouse columns as a design formula, R is telling that I need to convert Mouse to factor:

enter image description here

I am a bit confused about two things here: first, as I told already, should I include this Mouse column at all in the design formula of DeSeqDataSet and second, if I do need it, how to convert it to factor? Any suggestions would be greatly appreciated.


What concerns me also is that if I specify design formula as ~ Groups + Mouse, the DeSeq() function starts comparing the Mouse but not the Groups which is the most interesting for me.

  • $\begingroup$ Is Mouse# the number of mice used for that sample, or just a way of identifying individual mice? $\endgroup$ – heathobrien Apr 12 '18 at 10:59
  • $\begingroup$ It is the number of mice, not an id $\endgroup$ – Nikita Vlasenko Apr 12 '18 at 18:13
  • $\begingroup$ so you used 10 mice per group? $\endgroup$ – heathobrien Apr 16 '18 at 9:43
  • $\begingroup$ It turned out that I was wrong. It really was an ‘id’ which I did not include in the design formula. There were 4 groups of 16 mice in each for 4 trials. $\endgroup$ – Nikita Vlasenko Apr 16 '18 at 16:03

Any IDs (e.g. replicate number) don't need to be included in the design formula if it's not a repeated factor in multiple samples.

In this case, you have said that mouse number is related to the number of mice used in the pool (and is a variable factor that is consistent across multiple samples), in which case it should be included in the design matrix. This would also be the case if the same mouse were being used for multiple RNASeq experiments. Converting an integer value to a factor is done by the factor method:

sampleTable$MiceUsed <- factor(sampleTable$MiceUsed);

Other examples of things that might be useful in the design formula would be sex, age, and sequencing run batch (assuming these are not consistent across samples).

With a design formula of something like ~Groups + Mouse, it will also be comparing Groups, it's just hidden in the results. The DESeq2 vignette is really great at explaining what's going on, but as a quick answer you can pull out the Groups results with the contrast function. This will pull out group differences that are independent of mouse number:

results(dds, contrast=c("Groups", "GF", "Wld"))

[first value is the variable name, second value is the numerator condition, third is the denominator condition]

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.