<p>If this error is happening on the small subset, it'll presumably be because <code>age == 47</code> cannot be separated from <code>sex == female</code>. You should show a larger subset of the table that doesn't demonstrate linear dependence.</p>
<p>Or better, given that it seems to have issues with linear combinations of PC1 and PC2, plot out PC1 vs PC2 on a scatter plot; if they form a line, then that supports DESeq2's assessment, and at least one of them should be excluded.</p>

CC BY-SA 4.0
2024-09-28T18:00:32.383Z
That won't be a problem if age is being treated as a number, which if it works with age alone, it probably is.
swbarnes2
CC BY-SA 4.0
2024-09-29T00:09:53.700Z
Yes, it's a weird error given the known metadata and testing that's been done
gringer
CC BY-SA 4.0
2024-09-28T10:49:57.523Z
2024-09-29T00:05:32.583Z
2024-09-29T00:05:32.583Z
gringer
<p>Those PC values are small compared to what I see in bulk RNASeq projects.  When I have a strong PC1, the values range from -40 to 40, a PC1 that is a smaller % of the overall variance -20 to 20.  There might not be much point in making use of such meaningless PC1 values.</p>

CC BY-SA 4.0
2024-09-27T19:18:14.543Z
2024-09-27T19:18:14.543Z
swbarnes2
<p>I am running DESeq2 for RNA-seq data that has multiple co-variates. below is my <code>sampleTable</code> (the actual table is longer 100 controls and 20 treatment):</p>
<pre><code>condition   age sex     PC1         PC2
control     47  Female  -0.0048629  -0.0034097
control     94  Male    -0.0050488  -0.0033437
treatment   21  Male    -0.0047282  -0.0017674
treatment   47  Female  -0.0046477  -0.00082367
</code></pre>
<p>I want to use population-based PCs as covariates. below is the model:</p>
<pre class="lang-r prettyprint-override"><code>dds &lt;- DESeqDataSetFromMatrix(countData = dfinput0,
                              colData = sampleTable,
                              design= ~ age+sex+ condition + PC1 + PC2)
</code></pre>
<p>It give me the error:</p>
<pre class="lang-r prettyprint-override"><code>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.
</code></pre>
<p>The model works if the design is <code>design= ~ age+sex+ condition</code> or <code>design= ~ sex+ condition + PC1)</code></p>
<p>But when I add two numerical covariates (such as <code>age+PC1</code> or <code>PC1+PC2</code>) it gives me this error.</p>
<p>I don't see how age and PC1 are linear combination of each others. Any input how to solve this issue?</p>

<rna-seq><deseq2>
DESeq2 with PC as covariate
# DESeq2 with PC as covariate

(Asked by: username_0 on 2024-09-27)

I am running DESeq2 for RNA-seq data that has multiple co-variates. below is my sampleTable (the actual table is longer 100 controls and 20 treatment):
condition   age sex     PC1         PC2
control     47  Female  -0.0048629  -0.0034097
control     94  Male    -0.0050488  -0.0033437
treatment   21  Male    -0.0047282  -0.0017674
treatment   47  Female  -0.0046477  -0.00082367

I want to use population-based PCs as covariates. below is the model:
dds <- DESeqDataSetFromMatrix(countData = dfinput0,
                              colData = sampleTable,
                              design= ~ age+sex+ condition + PC1 + PC2)

It give me the error:
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.

The model works if the design is design= ~ age+sex+ condition or design= ~ sex+ condition + PC1)
But when I add two numerical covariates (such as age+PC1 or PC1+PC2) it gives me this error.
I don't see how age and PC1 are linear combination of each others. Any input how to solve this issue?

**Tags:** rna-seq, deseq2

---

## 2 answers

### Answer by username_1 on 2024-09-28. Score: 0

If this error is happening on the small subset, it'll presumably be because `age == 47` cannot be separated from `sex == female`. You should show a larger subset of the table that doesn't demonstrate linear dependence.

Or better, given that it seems to have issues with linear combinations of PC1 and PC2, plot out PC1 vs PC2 on a scatter plot; if they form a line, then that supports DESeq2's assessment, and at least one of them should be excluded.

> **Comments:**
> **username_2**: That won't be a problem if age is being treated as a number, which if it works with age alone, it probably is.  
> **username_1**: Yes, it's a weird error given the known metadata and testing that's been done  

---

### Answer by username_2 on 2024-09-27. Score: 0

Those PC values are small compared to what I see in bulk RNASeq projects. When I have a strong PC1, the values range from -40 to 40, a PC1 that is a smaller % of the overall variance -20 to 20. There might not be much point in making use of such meaningless PC1 values.


---

