I'm trying to run a differential gene expression analysis using DESeq2, with counts coming from kallisto. I have imported them using tximport and I'm creating the DESeqDataSet
(dds) using the DESeqDataSetFromMatrix
function.
> dds <- DESeqDataSetFromMatrix(counts,
samples,
~ strain + batch)
And I get the following error, expected given my experimental design:
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.
Now, I know that I can just remove one column from the design matrix to make it work, but is there a way to supply my own design matrix to DESeq2? The following code raises an error:
> design <- model.matrix(~strain+batch, s2c)
> design = design[, -9] # removing a column to avoid full-rank
> dds <- DESeqDataSetFromMatrix(counts, s2c, design=design)
converting counts to integer mode
Error: $ operator is invalid for atomic vectors
Is there a way to provide my own model.matrix
?
p.s. the modified model works in sleuth, but I would like to use DESeq2 for this particular analysis.