This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DESeq2: "model matrix is not full rank"

Hello, I have the following variables for my deseq2 analysis but I am getting the error model matrix is not full rank.

condition   type
control 1
control 1
control 1
ko  2
ko  2
ko  2
ko  3
ko  3
ko  3
ko  4
ko  4
ko  4

I have four cell types, 1 wild-type and three different KO's for the same gene.

deseq2

Can you add the design? I assume it's because you have both condition and type in your design.

2 answers

You cannot include both condition and type into the design, because control and type-1 are nested. You can either do ~condition, but this assumes that all KO are the same group. If they're heterogeneous then it will drive up dispersion and potentially get few DEGs. Alternatively, do ~type (make sure it's a factor, not a number), and then you can do pairwise comparisons as you like between types.

You basically have the situation described here. The solution is in there.

Log in to answer this question.