How to solve DESeq2 Error in checkFullRank(modelMatrix)?
Entering edit mode
17 months ago
helen ▴ 60

I have 4 factors in the design formula in DESeq2

dds <- DESeqDataSetFromMatrix(countData = cts,
                              colData = coldata,
                              design = ~ condition + gender + batch + genotype)

but got an error

Error in checkFullRank(modelMatrix) : 
the model matrix is not full rank, so the model cannot be fit as specified.
One or more variables or interaction terms in the design formula are linear
combinations of the others and must be removed.

This is what my coldata looks like:

    condition gender batch genotype
s1  Sst_Input female GA770  Sst-Cre
s2  Sst_Input female GA770  Sst-Cre
s3     Sst_IP female GA770  Sst-Cre
s4     Sst_IP female GA770  Sst-Cre
s5   Pv_Input   male GA806   Pv-Cre
s6      Pv_IP   male GA806   Pv-Cre
s7   Pv_Input   male GA806   Pv-Cre
s8      Pv_IP   male GA806   Pv-Cre
s9  Sst_Input   male GA806  Sst-Cre
s10    Sst_IP   male GA806  Sst-Cre
s11  Pv_Input   male GA806   Pv-Cre
s12     Pv_IP   male GA806   Pv-Cre
s13 Sst_Input   male GA806  Sst-Cre
s14    Sst_IP   male GA806  Sst-Cre
s15 Sst_Input   male GA838  Sst-Cre
s16 Sst_Input   male GA838  Sst-Cre
s17 Sst_Input female GA838  Sst-Cre
s18 Sst_Input female GA838  Sst-Cre
s19 Sst_Input   male GA838  Sst-Cre
s20 Sst_Input female GA838  Sst-Cre
s21    Sst_IP   male GA838  Sst-Cre
s22    Sst_IP   male GA838  Sst-Cre
s23    Sst_IP female GA838  Sst-Cre
s24    Sst_IP female GA838  Sst-Cre
s25    Sst_IP   male GA838  Sst-Cre
s26    Sst_IP female GA838  Sst-Cre

row name indicates the simplified sample name

4 conditions: Sst_Input, Sst_IP, Pv_Input, Pv_IP

2 genders: female and male

3 batches: GA770, GA806, GA838

2 genotypes: Sst-Cre and Pv-Cre

Does anyone know how to solve this?

DESeq2 RNA-Seq • 1.4k views
Entering edit mode
17 months ago
Asaf 8.6k

Your condition is nested in the genotype. You should change condition to "Input" and "IP" and then add the interaction term genotype:condition to your formula. So coldata will look like:

    condition gender batch genotype
s1      Input female GA770  Sst-Cre
s2      Input female GA770  Sst-Cre
s3         IP female GA770  Sst-Cre
s4         IP female GA770  Sst-Cre
s5      Input   male GA806   Pv-Cre
s6         IP   male GA806   Pv-Cre
s7      Input   male GA806   Pv-Cre
s8         IP   male GA806   Pv-Cre
s9      Input   male GA806  Sst-Cre
s10        IP   male GA806  Sst-Cre
s11     Input   male GA806   Pv-Cre
s12        IP   male GA806   Pv-Cre
s13     Input   male GA806  Sst-Cre
s14        IP   male GA806  Sst-Cre
s15     Input   male GA838  Sst-Cre
s16     Input   male GA838  Sst-Cre
s17     Input female GA838  Sst-Cre
s18     Input female GA838  Sst-Cre
s19     Input   male GA838  Sst-Cre
s20     Input female GA838  Sst-Cre
s21        IP   male GA838  Sst-Cre
s22        IP   male GA838  Sst-Cre
s23        IP female GA838  Sst-Cre
s24        IP female GA838  Sst-Cre
s25        IP   male GA838  Sst-Cre
s26        IP female GA838  Sst-Cre

and dds:

dds <- DESeqDataSetFromMatrix(countData = cts,
                              colData = coldata,
                              design = ~ condition + gender + batch + genotype + genotype:condition)
Entering edit mode

Thank you, Asaf. It works!


Login before adding your answer.

Traffic: 1923 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6