Error running DESeq2 on longitudinal data: Error in checkFullRank(modelMatrix)
Entering edit mode
Last seen 5 days ago
United States


I am trying to use DESeq2 to perform DE analysis on longitudinal data with sample groups as mentioned below:

subject day condition
patient1    T0  baseline
patient2    T0  baseline
patient3    T0  baseline
patient1    T1  trtA
patient1    T1  trtB
patient2    T1  trtA
patient2    T1  trtB
patient3    T1  trtA
patient3    T1  trtB
patient1    T2  trtA
patient1    T2  trtB
patient2    T2  trtA
patient2    T2  trtB
patient3    T2  trtA
patient3    T2  trtB
patient1    T3  trtA
patient1    T3  trtB
patient2    T3  trtA
patient2    T3  trtB
patient3    T3  trtA
patient3    T3  trtB
patient1    T4  trtA
patient1    T4  trtB
patient2    T4  trtA
patient2    T4  trtB
patient3    T4  trtA
patient3    T4  trtB

The comparisons of interest are:

  1. T1 vs. T0, T2 vs. T0, T3 vs. T0, and T4 vs. T0 for trtA and trtB
  2. trtA vs. trtB at T1, trtA vs. trtB at T2, trtA vs. trtB at T3, and trtA vs. trtB at T4

Following the time course experiment section from the link below:

ddsTC <- DESeqDataSetFromMatrix(countData = round(PooledCounts), colData = sg,
+                               design = ~ condition + day + condition:day)
converting counts to integer mode
Error in checkFullRank(modelMatrix) : 
  the model matrix is not full rank, so the model cannot be fit as specified.
  Levels or combinations of levels without any samples have resulted in
  column(s) of zeros in the model matrix.

  Please read the vignette section 'Model matrix not full rank':

In addition: Warning message:
In DESeqDataSet(se, design = design, ignoreRank) :
  some variables in design formula are characters, converting to factors

Can you please help with this?


DESeq2 longitudinal • 117 views
Entering edit mode
swbarnes2 ★ 1.2k
Last seen 3 hours ago
San Diego

Yup. Every T0 is baseline. That's why you get that error.

Entering edit mode

Thank you for the reply. The baseline (T0) is common for both treatments. How would you suggest defining the design in DESeq2?

Entering edit mode

Yes, I understand, but the way the software works is if all the T0 are also Baseline, then the software will throw that error. You can't do it like that.

To just compare one subset of samples to another, the far simple way is to make a new column of Treatment_Time, and make that your design, and use contrasts to specify which Treatment_Time to compare to what other Treatment_Time.

Entering edit mode

Thank you for the feedback. For the approach you mentioned, it's not clear how the design controls for baseline conditions when comparing two treatments at a specific time point. And, how matched samples are being accounted for?

sg$group <- paste( condition , day, sep="_")
dds <- DESeqDataSetFromMatrix(countData = round(PooledCounts), colData = sg,
                                    design = ~ group)
Entering edit mode

You don't "control for baseline conditions", like that. If you want to compare two subsets to each other, just compare them. Adding the variability and uncertainty from a third set of samples won't improve things.

Just add subject to the design, like you would for batch, or any other factor that you want the software to account for, but don't care about for the question at hand.


Login before adding your answer.

Traffic: 327 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