Answers.Body: <p>Adding to what benn pointed out, at this line:</p>
  
  <pre><code>dds &lt;- DESeqDataSetFromMatrix(countData = cts, colData = coldata, design = ~Genotype + Type + Genotype:Type)
  </code></pre>
  
  <p>You specified that the counts, can be a explained by Genotype (being Control or Viral) or Type (RNAseq or Ribo) or an interaction effect </p>
  
  <p>What you need is this coefficient, Genotype:Type. To use it, go</p>
  
  <pre><code>res &lt;- results(dds,name="GenotypeViral.TypeRNA")
  </code></pre>
  
  <p>Based on your setup, you are always comparing RNA to Ribo (see "Type_RNA_vs_Ribo" in resultsNames). If changes to the abundance of a mRNA is similar in RNAseq or Ribo, then the coefficient of the interaction term will be zero and it will be zero in the log2foldchange column in results(res). A positive fold change indicates the log2foldchange between RNA and Ribo is higher in Viral.</p>
  
  <p>If you would like to compare ribo versus and rna-seq, then set RNA as the reference by:</p>
  
  <pre><code>coldata<span class="math-container">$Type = factor(coldata$</span>Type,levels=c("RNA","Ribo"))
  # run deseq again
  dds &lt;- DESeqDataSetFromMatrix(countData = cts, colData = coldata, design = ~Genotype + Type + Genotype:Type)
  dds &lt;- DESeq(dds)
  </code></pre>
  
  <p>With this you will compare by default Ribo versus RNA, and the interaction term will tell you how much more enriched or depleted the ribo fraction is, in the Viral samples.</p>
  
  <p>Would recommend checking the vignette out <a href="http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#contrasts" rel="nofollow noreferrer">here</a>:</p>
  
  <p><a href="http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#contrasts" rel="nofollow noreferrer">http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#contrasts</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-17T07:24:18.310Z
Answers.LastActivityDate: 2019-08-17T16:06:49.513Z
Answers.LastEditDate: 2019-08-17T16:06:49.513Z
Answers.UserDisplayName: StupidWolf
Body: <p>I'm attempting to compare total RNA-seq with Ribo-Seq, to determine if changes in Ribo-Seq are due to changes in transcriptional expression (akin to the analysis performed by Anota2Seq). I am, however, struggling to understand how to accomplish this in DESeq2.</p>
  
  <p>My design is as follows:</p>
  
  <pre><code>cts &lt;- read.delim("Interaction.txt", row.names=1)
  coldata &lt;- read.delim("Sample_Sheet.txt", row.names=1)
  cts &lt;- round(cts)
  dds &lt;- DESeqDataSetFromMatrix(countData = cts, colData = coldata, design = ~Genotype + Type + Genotype:Type)
  dds &lt;- DESeq(dds)
  resultsNames(dds)
  
  &gt; coldata
                  Genotype Type
  C_24h_Ribo_1     Control Ribo
  C_24h_Ribo_2     Control Ribo
  C_24h_Ribo_3     Control Ribo
  CHIK_24h_Ribo_1    Viral Ribo
  CHIK_24h_Ribo_2    Viral Ribo
  CHIK_24h_Ribo_3    Viral Ribo
  C_24h_RNA_1      Control  RNA
  C_24h_RNA_2      Control  RNA
  C_24h_RNA_3      Control  RNA
  CHIK_24h_RNA_1     Viral  RNA
  CHIK_24h_RNA_2     Viral  RNA
  CHIK_24h_RNA_3     Viral  RNA
  
  &gt; resultsNames(dds)
  [1] "Intercept"                 "Genotype_Viral_vs_Control" "Type_RNA_vs_Ribo"          "GenotypeViral.TypeRNA"
  </code></pre>
  
  <p>I do not understand which contrast is the one I need, or how to access the results i'm looking for (or interpret them). Any help?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-15T08:39:43.023Z
Comments.Text: You would be interested in the interaction term. Did someone else write your code?
Comments.UserDisplayName: benn
Tags: <rna-seq><deseq2>
Title: Comparing RNA-Seq and Ribo-Seq
ThreadText: # Comparing RNA-Seq and Ribo-Seq
  
  (Asked by: username_0 on 2019-08-15)
  
  I'm attempting to compare total RNA-seq with Ribo-Seq, to determine if changes in Ribo-Seq are due to changes in transcriptional expression (akin to the analysis performed by Anota2Seq). I am, however, struggling to understand how to accomplish this in DESeq2.
  
  My design is as follows:
  
  ```
  cts <- read.delim("Interaction.txt", row.names=1)
  coldata <- read.delim("Sample_Sheet.txt", row.names=1)
  cts <- round(cts)
  dds <- DESeqDataSetFromMatrix(countData = cts, colData = coldata, design = ~Genotype + Type + Genotype:Type)
  dds <- DESeq(dds)
  resultsNames(dds)
  
  > coldata
                  Genotype Type
  C_24h_Ribo_1     Control Ribo
  C_24h_Ribo_2     Control Ribo
  C_24h_Ribo_3     Control Ribo
  CHIK_24h_Ribo_1    Viral Ribo
  CHIK_24h_Ribo_2    Viral Ribo
  CHIK_24h_Ribo_3    Viral Ribo
  C_24h_RNA_1      Control  RNA
  C_24h_RNA_2      Control  RNA
  C_24h_RNA_3      Control  RNA
  CHIK_24h_RNA_1     Viral  RNA
  CHIK_24h_RNA_2     Viral  RNA
  CHIK_24h_RNA_3     Viral  RNA
  
  > resultsNames(dds)
  [1] "Intercept"                 "Genotype_Viral_vs_Control" "Type_RNA_vs_Ribo"          "GenotypeViral.TypeRNA"
  
  ```
  
  I do not understand which contrast is the one I need, or how to access the results i'm looking for (or interpret them). Any help?
  
  **Tags:** rna-seq, deseq2
  
  > **Comments:**
  > **username_1**: You would be interested in the interaction term. Did someone else write your code?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-08-17. Score: 3 | Accepted answer
  
  Adding to what username_1 pointed out, at this line:
  
  ```
  dds <- DESeqDataSetFromMatrix(countData = cts, colData = coldata, design = ~Genotype + Type + Genotype:Type)
  
  ```
  
  You specified that the counts, can be a explained by Genotype (being Control or Viral) or Type (RNAseq or Ribo) or an interaction effect
  
  What you need is this coefficient, Genotype:Type. To use it, go
  
  ```
  res <- results(dds,name="GenotypeViral.TypeRNA")
  
  ```
  
  Based on your setup, you are always comparing RNA to Ribo (see "Type\_RNA\_vs\_Ribo" in resultsNames). If changes to the abundance of a mRNA is similar in RNAseq or Ribo, then the coefficient of the interaction term will be zero and it will be zero in the log2foldchange column in results(res). A positive fold change indicates the log2foldchange between RNA and Ribo is higher in Viral.
  
  If you would like to compare ribo versus and rna-seq, then set RNA as the reference by:
  
  ```
  coldata$Type = factor(coldata$Type,levels=c("RNA","Ribo"))
  # run deseq again
  dds <- DESeqDataSetFromMatrix(countData = cts, colData = coldata, design = ~Genotype + Type + Genotype:Type)
  dds <- DESeq(dds)
  
  ```
  
  With this you will compare by default Ribo versus RNA, and the interaction term will tell you how much more enriched or depleted the ribo fraction is, in the Viral samples.
  
  Would recommend checking the vignette out [here](http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#contrasts):
  
  <http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#contrasts>
  
  
  ---
  
  