DESeq2 for time-course with nested individuals
Entering edit mode
Nashla ▴ 10
Last seen 2.6 years ago

I am trying to run the following analysis in DESeq, and running into a few challenges, as described.

Subjects in two groups ('A', 'B') - with approximately 3 times more subjects in group 'A' vs. 'B', provide samples pre-treatment and at three time points post-treatment (t0,t1,t2,t3). Thus, our column data (with a nested index) looks something like:

sample column

We want to compare how the treatment differentially impacts subjects from group B vs. subjects from group A at any time post-treatment.

The first challenge is to create a DESeqDataSetFromMatrix because the design function ~ Group + Time + Group:Subject.nested + Group:Time gives an error that the 'model matrix is not full rank'. I plan to address this by using a custom model matrix for DESeq, but I need to create a DESeqDataSet object first - so I run DESEQDataSetFromMatrix call using 'ignoreRank=True'.
Then, following [1a,1b], I create a model.matrix (m1) with the same design as above, and then remove the zero columns.

Nevertheless, when I try to run DESeq(dds, full=mm1, betaPrior=FALSE), I still get the error that the 'model matrix is not full rank'.

Is there something incorrect in my logic?

Also, I believe I need to also use 'reduce' in DESeq to ~ Group + Time in order to obtain the correct final model (as outlined in [2]). Can you please help to confirm, and to integrate with the above?

Thank you.

[1a] With DESeq2 "Not full rank" Error with design ~ line + time + condition



DESeq2 • 923 views
Entering edit mode
Last seen 1 day ago
United States

You can create a DESeqDataSet with design=~1 to start, or you can provide a model matrix to design also. I wouldn't use ignoreRank... that is only for developers and may lead to trouble if used in this setting.

BTW, you don't have to specify betaPrior=FALSE, this is default.

How have you corrected the model matrix to make sure it is full rank?

Regarding what design should be full and what should be reduced, these statistical analysis decisions are beyond the scope of what I have time to provide on the support site, I'd recommend to work with a local collaborator who can inform the statistical analysis for your project.

Entering edit mode

Michael, thank you very much for your response. Setting the design=~1 to create the original DESeqDataSet worked great to get around having to use ignorRank to initialize the object. Also, I found an error with my nested indexing, once I fixed it, I was able to run the full protocol to create a full-rank model matrix (m1) and run DESeq using 'full=m1'. I also found that I could run the reduced comparison by creating a model matrix for the reduced model (mr), and inputting that into the DESeq function (i.e. 'reduced = mr'). I will seek out further advice on appropriate construction of the design function.

Entering edit mode

Great. Sounds good.

I've also tried to clarify, in the vignette, the way to create the dataset for the case when the desired design leads to a less than full rank error:


Login before adding your answer.

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