This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in checkFullRank(modelMatrix) : the model matrix is not full rank, so the model cannot be fit as specified.

I am trying to create a dds object using the formula below:

 dds <- DESeqDataSetFromMatrix(counts, 
                                colData = md, 
                                design = ~PCNAscore + IEGscore + group)

But I keep getting this error:

converting counts to integer mode
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. Please read the vignette section 'Model matrix not full rank':

I have read the vignette and understand that if batch and condition are confounded then it is not possible to create a model based on that. However, my variables of interest in the model do not seem confounded. I have uploaded an image of my md where I have the columns group, PCNAscore and IEGscore that I am using in the design matrix. I am confused why I am getting this error. Any help would be appreciated.

enter image description here

deseq2

Hi, I just wanted to update that IEGscore and PCNAscore were linearly dependent (or linear combinations of each other). I tested this using linear regression and the two variables have an r squared value of 1 thus indicating they are perfect linear combinations of each other. however, now I am using this design model

dds <- DESeqDataSetFromMatrix(counts, colData = md, design = ~PCNAscore + group)

and it is still giving me the same error. I checked if group and PCNA are linearly dependent using a linear regression model and the r squared value is 0.2. So i should expect the design to work, Any help is appreciated.

1 answer

Any chance the numerical columns were imported as factors?

Hi swbarnes2, that was the problem, they were not numeric but as character columns. converted them and it fixed the error. Thank you for your help.

Log in to answer this question.