<p>I think the problem is that you have <code>time</code> as a linear value rather than a factor. While this naively makes sense (after all, you have to go through 3 hours awake before you can get to 9 hours awake), what you end up doing is fitting a single coefficient to each gene of "linearly changes with time". What you want instead is factor, so you can have a system where things like <code>per</code> and <code>clk</code> can cycle:</p>

<pre><code>time = factor(c(3,9,15,21))
</code></pre>

<p>The rest is then correct. Note that LRTs are not asking, "is there a change at any time point?", since there will likely be DE genes according to this that are not DE at any single time point. Rather an LRT such as this is asking, "What are genes that vary significantly over time?" There's a subtle different between those two questions. The former question is actually answered by a bunch of pairwise comparisons (taking the union of the DE genes).</p>

CC BY-SA 3.0
2018-03-22T03:03:25.870Z
Thanks for this!  I actually tried this last night after posting and it seemed to work, but I wasn't 100% sure it meant what I thought it meant until your post.  Much appreciated.
John Mariani
CC BY-SA 3.0
2018-03-21T07:31:59.637Z
2018-03-21T07:31:59.637Z
Devon Ryan
<p>I have RNA-Seq data from 4 time points (3 hours awake, 9 hours awake, 3 hours asleep, 9 hours asleep).  I'm interested in doing something similar to a LRT where genes are found to be significant if they changed at any point in the time course.  </p>

<p>However, I'm not sure how to do this considering this is cyclical.  Running a LRT test in DESeq2 gives different results depending on which timepoint I choose as the beginning of the time course since I assume it doesn't calculate the last transition back to being awake (Or asleep depending on your reference).<br>
Any ideas on an appropriate way to do this? </p>

<pre><code>time = c(3,9,15,21)
ddsLRT &lt;- DESeqDataSetFromTximport(txi.rsem.lrt, sampleTable, ~time)  
ddsLRT&lt;- DESeq(ddsLRT, test="LRT", reduced = ~1)
</code></pre>

<rna-seq><r><deseq2>
LRT or LRT-like test on cyclical (Sleep) data
# LRT or LRT-like test on cyclical (Sleep) data

(Asked by: username_0 on 2018-03-21)

I have RNA-Seq data from 4 time points (3 hours awake, 9 hours awake, 3 hours asleep, 9 hours asleep).  I'm interested in doing something similar to a LRT where genes are found to be significant if they changed at any point in the time course.  
However, I'm not sure how to do this considering this is cyclical.  Running a LRT test in DESeq2 gives different results depending on which timepoint I choose as the beginning of the time course since I assume it doesn't calculate the last transition back to being awake (Or asleep depending on your reference).
Any ideas on an appropriate way to do this? 
time = c(3,9,15,21)
ddsLRT <- DESeqDataSetFromTximport(txi.rsem.lrt, sampleTable, ~time)  
ddsLRT<- DESeq(ddsLRT, test="LRT", reduced = ~1)

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

---

## 1 answers

### Answer by username_1 on 2018-03-21. Score: 5 | Accepted answer

I think the problem is that you have time as a linear value rather than a factor. While this naively makes sense (after all, you have to go through 3 hours awake before you can get to 9 hours awake), what you end up doing is fitting a single coefficient to each gene of "linearly changes with time". What you want instead is factor, so you can have a system where things like per and clk can cycle:
time = factor(c(3,9,15,21))

The rest is then correct. Note that LRTs are not asking, "is there a change at any time point?", since there will likely be DE genes according to this that are not DE at any single time point. Rather an LRT such as this is asking, "What are genes that vary significantly over time?" There's a subtle different between those two questions. The former question is actually answered by a bunch of pairwise comparisons (taking the union of the DE genes).

> **Comments:**
> **username_0**: Thanks for this!  I actually tried this last night after posting and it seemed to work, but I wasn't 100% sure it meant what I thought it meant until your post.  Much appreciated.  

---

