<p>See here for a Differential Expression guide which discusses carrying out differential expression using DESeq2:</p>
<p><a href="https://www.bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html" rel="nofollow noreferrer">https://www.bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html</a></p>
<p>It starts with a standard &quot;quick start&quot; workflow, and goes into quite a lot of detail explaining all the different things that can be done:</p>
<pre><code>dds &lt;- DESeqDataSetFromMatrix(countData = cts,
                              colData = coldata,
                              design= ~ batch + condition)
dds &lt;- DESeq(dds)
resultsNames(dds) # lists the coefficients
res &lt;- results(dds, name=&quot;condition_trt_vs_untrt&quot;)
</code></pre>

CC BY-SA 4.0
2022-07-14T04:40:14.650Z
2022-07-14T04:40:14.650Z
gringer
<blockquote>
<p>I'm thinking first normalize using TMM then compare the mean of the normalized values for treated vs. untreated?</p>
</blockquote>
<p>That is a bit too simple. You need to analyse your experiment as a paired comparison. You need to combine the treated and untreated count matrices into one and form factors for individual and treatment:</p>
<pre><code>Counts &lt;- cbind(Counts.treated, Counts.untreated)
Individual &lt;- gl(5,1,length=10)
Treatment &lt;- gl(2,5,length=10,labels=c(&quot;Treated&quot;,&quot;Untreated&quot;))
Treatment &lt;- relevel(Treatment, ref=&quot;Untreated&quot;)
design &lt;- model.matrix(~Individual+Treatment)
</code></pre>
<p>Then follow a standard workflow:
<a href="https://bioconductor.org/packages/release/workflows/vignettes/RnaSeqGeneEdgeRQL/inst/doc/edgeRQL.html" rel="nofollow noreferrer">https://bioconductor.org/packages/release/workflows/vignettes/RnaSeqGeneEdgeRQL/inst/doc/edgeRQL.html</a></p>
<pre><code>library(edgeR)
y &lt;- DGEList(counts=Counts)
y &lt;- calcNormFactors(y)
y &lt;- estimateDisp(y,design)
fit &lt;- glmQLFit(y,design)
test &lt;- glmQLFTest(fit)
topTags(test)
</code></pre>

CC BY-SA 4.0
2022-07-14T07:55:07.853Z
2022-07-14T08:49:07.320Z
2022-07-14T08:49:07.320Z
Gordon Smyth
<p>I have two matrices, one for individuals before treatment and one for the same individuals after treatment. Both matrices are raw read counts of RNA expression.</p>
<pre><code>        Treated_1  Treated_2  Treated_3  Treated_4  Treated_5
RNA_1   105        283        64         155        51
RNA_2   359        27         47         348        84
RNA_3   99         10         89         345        77
RNA_4   48         100        77         74         83

        Untreated_1  Untreated_2  Untreated_3  Untreated_4  Untreated_5
RNA_1   100          200          50           130          33
RNA_2   200          10           30           300          75
RNA_3   90           10           60           320          60
RNA_4   66           50           33           60           55

</code></pre>
<p>How can I tell which RNA's are significantly differentially expressed in R using <code>edgeR</code> or <code>DESeq2</code>? I'm thinking first normalize using TMM then compare the mean of the normalized values for treated vs. untreated?</p>

<r><deseq2><differential-expression><rna><edger>
Basic RNA Differential Expression in R
# Basic RNA Differential Expression in R

(Asked by: username_0 on 2022-07-14)

I have two matrices, one for individuals before treatment and one for the same individuals after treatment. Both matrices are raw read counts of RNA expression.
        Treated_1  Treated_2  Treated_3  Treated_4  Treated_5
RNA_1   105        283        64         155        51
RNA_2   359        27         47         348        84
RNA_3   99         10         89         345        77
RNA_4   48         100        77         74         83

        Untreated_1  Untreated_2  Untreated_3  Untreated_4  Untreated_5
RNA_1   100          200          50           130          33
RNA_2   200          10           30           300          75
RNA_3   90           10           60           320          60
RNA_4   66           50           33           60           55


How can I tell which RNA's are significantly differentially expressed in R using edgeR or DESeq2? I'm thinking first normalize using TMM then compare the mean of the normalized values for treated vs. untreated?

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

---

## 2 answers

### Answer by username_1 on 2022-07-14. Score: 3

See here for a Differential Expression guide which discusses carrying out differential expression using DESeq2:
https://www.bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html
It starts with a standard "quick start" workflow, and goes into quite a lot of detail explaining all the different things that can be done:
dds <- DESeqDataSetFromMatrix(countData = cts,
                              colData = coldata,
                              design= ~ batch + condition)
dds <- DESeq(dds)
resultsNames(dds) # lists the coefficients
res <- results(dds, name="condition_trt_vs_untrt")


---

### Answer by username_2 on 2022-07-14. Score: 1

I'm thinking first normalize using TMM then compare the mean of the normalized values for treated vs. untreated?

That is a bit too simple. You need to analyse your experiment as a paired comparison. You need to combine the treated and untreated count matrices into one and form factors for individual and treatment:
Counts <- cbind(Counts.treated, Counts.untreated)
Individual <- gl(5,1,length=10)
Treatment <- gl(2,5,length=10,labels=c("Treated","Untreated"))
Treatment <- relevel(Treatment, ref="Untreated")
design <- model.matrix(~Individual+Treatment)

Then follow a standard workflow:
https://bioconductor.org/packages/release/workflows/vignettes/RnaSeqGeneEdgeRQL/inst/doc/edgeRQL.html
library(edgeR)
y <- DGEList(counts=Counts)
y <- calcNormFactors(y)
y <- estimateDisp(y,design)
fit <- glmQLFit(y,design)
test <- glmQLFTest(fit)
topTags(test)


---

