<p>If you have densely spaced time points the using non-linear regression to directly fit the signal to a cosine or sine curve, which would directly produce the offset, would be much simpler. DESeq2 wouldn't be the appropriate tool then, you'd use base R and the <code>nls()</code> function.</p>

CC BY-SA 4.0
2018-06-17T14:07:27.573Z
2018-06-17T14:07:27.573Z
Devon Ryan
<p>If I were to do this, my first guess would be to add in the phases as a separate factor in the statistical model, something like:</p>

<pre><code>~ Condition + sex + phase1 + phase2 + phase3 + ...
</code></pre>

CC BY-SA 4.0
2018-06-17T22:27:58.237Z
And then run LRTs removing phases from the model one at a time? This will leave me with p-values from individual tests, and comparing p-values to each other is probably going to put the wrath of statisticians upon me...  
Or is there a way to run DESeq2 in such a way that it spits out the "best phase" for each row?
Unknown artist
CC BY-SA 4.0
2018-06-17T03:43:13.790Z
2018-06-17T03:43:13.790Z
gringer
<p>Imagine I have a dataset of highly periodic gene expression, taken at densely spaced timepoints. I know that the expression is periodic, but different genes have different offsets.</p>

<p>It is trivial to convert my timestamps into a cosine (<code>cos_time = cos(offset + time*pi*2/PERIOD)</code>), so that this new variable is linear with the genes' expressions -- but only with the ones that have a peak at <code>offset</code>.</p>

<p>What if I could have multiple <code>cos_time</code>s (let's call them <code>phases</code>) and then ask DESeq2: "OK, which gene's behavior is most linear with which phase?" Barring comparing p-values of each LRT test, is there a better way?</p>

<p>Disclaimer: <em>I know about cosinor, Lomb-Scargle periodograms, ARS, JTK etc, and I know they are likely more applicable in this particular case. I'm interested in whether it is in general possible to ask such a question from DESeq2, even if the variables in question are not periodic. Phase just seemed like the simplest concept to demonstrate this on.</em></p>

<r><rna-seq><differential-expression><deseq2>
Can I ask DESeq2 which variable alone explains which gene's behavior the best?
# Can I ask DESeq2 which variable alone explains which gene's behavior the best?

(Asked by: username_0 on 2018-06-16)

Imagine I have a dataset of highly periodic gene expression, taken at densely spaced timepoints. I know that the expression is periodic, but different genes have different offsets.

It is trivial to convert my timestamps into a cosine (`cos_time = cos(offset + time*pi*2/PERIOD)`), so that this new variable is linear with the genes' expressions -- but only with the ones that have a peak at `offset`.

What if I could have multiple `cos_time`s (let's call them `phases`) and then ask DESeq2: "OK, which gene's behavior is most linear with which phase?" Barring comparing p-values of each LRT test, is there a better way?

Disclaimer: *I know about cosinor, Lomb-Scargle periodograms, ARS, JTK etc, and I know they are likely more applicable in this particular case. I'm interested in whether it is in general possible to ask such a question from DESeq2, even if the variables in question are not periodic. Phase just seemed like the simplest concept to demonstrate this on.*

**Tags:** r, rna-seq, differential-expression, deseq2

---

## 2 answers

### Answer by username_1 on 2018-06-17. Score: 2

If you have densely spaced time points the using non-linear regression to directly fit the signal to a cosine or sine curve, which would directly produce the offset, would be much simpler. DESeq2 wouldn't be the appropriate tool then, you'd use base R and the `nls()` function.


---

### Answer by username_2 on 2018-06-17. Score: 1

If I were to do this, my first guess would be to add in the phases as a separate factor in the statistical model, something like:
~ Condition + sex + phase1 + phase2 + phase3 + ...

> **Comments:**
> **username_0**: And then run LRTs removing phases from the model one at a time? This will leave me with p-values from individual tests, and comparing p-values to each other is probably going to put the wrath of statisticians upon me...   Or is there a way to run DESeq2 in such a way that it spits out the "best phase" for each row?  

---

