1
0
Entering edit mode
@sarablocquiaux-21717
Last seen 2.4 years ago

Dear all, dear Michael Love,

The DESeqDataSetFromHTSeqCount() function does not want to accept my design, which is (as suggested by the deseq2 manual):

design = model.matrix(~group + group:subjectID + group:time)

Group   Time    SubjectID
A   1   1
A   2   1
A   1   2
A   2   2
A   1   3
A   2   3
A   1   4
A   2   4
A   1   5
A   2   5
B   1   1
B   2   1
B   1   2
B   2   2
B   1   3
B   2   3
B   1   4
B   2   4
B   1   5
B   2   5
B   1   6
B   2   6


As you can see, I have one subject more in group B than in group A. Therefore I deleted the collumn 'GroupA:subjectID6' from the designmatrix.

But still, the following error occurs: 'The model matrix is not full rank. One or more variables or interaction terms in the design formula are linear combinations of the others and must be removed.'

Who knows the answer to this problem? Has this something to do with the fact that subject 6 in group B is now a linear combination when comparing B16 to B26? But how to solve this, without losing subject 6?

Sara

deseq2 methylation • 359 views
0
Entering edit mode

Are you completely sure you want subject as a factor in your design? Is subject 1 from group A really the same as subject 1 in group B? I have no idea what you are trying to compare to what, but I think in general, a lot of people try to include subject or individual as a factor in their design where their experimental design does not warrant it.

0
Entering edit mode

It's group x subject, so a subject specific blocking term within each group. See the section of the vignette that describes this design.

0
Entering edit mode
@mikelove
Last seen 4 hours ago
United States

Can you post the code? I can't tell what exactly you've done and so can't say how to fix things.

You should be able to see by eye which columns of the design matrix are leading to loss of full rank.

Note also that it's not easy to see your sample table. If you want to format text as code, you can use backticks. See the posting guide.

0
Entering edit mode

Hi Michael,

Here is the design matrix. None of the columns have only zeros.

> design
(Intercept) groupYI groupOI:subjectP1 groupYI:subjectP1 groupOI:subjectP2
1            1       1                 0                 1                 0
2            1       1                 0                 1                 0
5            1       1                 0                 0                 0
6            1       1                 0                 0                 0
9            1       1                 0                 0                 0
10           1       1                 0                 0                 0
13           1       1                 0                 0                 0
14           1       1                 0                 0                 0
15           1       1                 0                 0                 0
16           1       1                 0                 0                 0
19           1       0                 1                 0                 0
20           1       0                 1                 0                 0
23           1       0                 0                 0                 1
24           1       0                 0                 0                 1
29           1       0                 0                 0                 0
30           1       0                 0                 0                 0
37           1       0                 0                 0                 0
38           1       0                 0                 0                 0
41           1       0                 0                 0                 0
42           1       0                 0                 0                 0
45           1       0                 0                 0                 0
46           1       0                 0                 0                 0

0
Entering edit mode
   groupYI:subjectP2 groupOI:subjectP3 groupYI:subjectP3 groupOI:subjectP4
1                  0                 0                 0                 0
2                  0                 0                 0                 0
5                  1                 0                 0                 0
6                  1                 0                 0                 0
9                  0                 0                 1                 0
10                 0                 0                 1                 0
13                 0                 0                 0                 0
14                 0                 0                 0                 0
15                 0                 0                 0                 0
16                 0                 0                 0                 0
19                 0                 0                 0                 0
20                 0                 0                 0                 0
23                 0                 0                 0                 0
24                 0                 0                 0                 0
29                 0                 1                 0                 0
30                 0                 1                 0                 0
37                 0                 0                 0                 1
38                 0                 0                 0                 1
41                 0                 0                 0                 0
42                 0                 0                 0                 0
45                 0                 0                 0                 0
46                 0                 0                 0                 0
groupYI:subjectP4 groupOI:subjectP5 groupYI:subjectP5 groupOI:subjectP6
1                  0                 0                 0                 0
2                  0                 0                 0                 0
5                  0                 0                 0                 0
6                  0                 0                 0                 0
9                  0                 0                 0                 0
10                 0                 0                 0                 0
13                 1                 0                 0                 0
14                 1                 0                 0                 0
15                 0                 0                 1                 0
16                 0                 0                 1                 0
19                 0                 0                 0                 0
20                 0                 0                 0                 0
23                 0                 0                 0                 0
24                 0                 0                 0                 0
29                 0                 0                 0                 0
30                 0                 0                 0                 0
37                 0                 0                 0                 0
38                 0                 0                 0                 0
41                 0                 1                 0                 0
42                 0                 1                 0                 0
45                 0                 0                 0                 1
46                 0                 0                 0                 1
groupOI:timet1 groupYI:timet1
1               0              0
2               0              1
5               0              0
6               0              1
9               0              0
10              0              1
13              0              0
14              0              1
15              0              0
16              0              1
19              0              0
20              1              0
23              0              0
24              1              0
29              0              0
30              1              0
37              0              0
38              1              0
41              0              0
42              1              0
45              0              0
46              1              0

0
Entering edit mode
> sampletable
samplenames     countnames group time condition subject
1     GC069352 GC069352.count    YI   t0      YIt0      P1
2     GC069353 GC069353.count    YI   t1      YIt1      P1
5     GC069356 GC069356.count    YI   t0      YIt0      P2
6     GC069357 GC069357.count    YI   t1      YIt1      P2
9     GC069360 GC069360.count    YI   t0      YIt0      P3
10    GC069361 GC069361.count    YI   t1      YIt1      P3
13    GC069364 GC069364.count    YI   t0      YIt0      P4
14    GC069365 GC069365.count    YI   t1      YIt1      P4
15    GC069366 GC069366.count    YI   t0      YIt0      P5
16    GC069367 GC069367.count    YI   t1      YIt1      P5
19    GC069370 GC069370.count    OI   t0      OIt0      P1
20    GC069371 GC069371.count    OI   t1      OIt1      P1
23    GC069374 GC069374.count    OI   t0      OIt0      P2
24    GC069375 GC069375.count    OI   t1      OIt1      P2
29    GC069380 GC069380.count    OI   t0      OIt0      P3
30    GC069381 GC069381.count    OI   t1      OIt1      P3
37    GC069388 GC069388.count    OI   t0      OIt0      P4
38    GC069389 GC069389.count    OI   t1      OIt1      P4
41    GC069392 GC069392.count    OI   t0      OIt0      P5
42    GC069393 GC069393.count    OI   t1      OIt1      P5
45    GC069396 GC069396.count    OI   t0      OIt0      P6
46    GC069397 GC069397.count    OI   t1      OIt1      P6

> dds = DESeqDataSetFromHTSeqCount(sampleTable=sampletable, design = 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.

0
Entering edit mode

The design matrix looks fine to me but its hard to scan on the forum. Maybe you can consult with someone locally. You can check the rank of a matrix x with:

qr(x)\$rank

Which should be equal to the number of columns of x.

0
Entering edit mode

Thanks for the effort Michael!