<p>There's a lot to unpack here; it should really be in a few separate questions. I'm just going to concentrate on the data preparation side of things....</p>
<p>Given that you're using DESeq2, it would be better to prepare a single count table with all your data (genes / features in rows, samples in columns), and add any complicating factors into the statistical model.</p>
<p>Given that you're working with multiple datasets, one of those complicating factors would be the dataset that the data came from. So your meta data frame (e.g. <code>meta.df</code>) should look something like this:</p>
<pre><code>Dataset Condition SampleID
Pub1    Cell_A    NCR00102
Pub1    Cell_A    NCR00103
Pub1    Cell_A    NCR00104
Pub1    Cell_B    NCR00112
Pub1    Cell_B    NCR00113
Pub1    Cell_B    NCR00114
Pub1    Cell_B    NCR00115
Pub1    Cell_B    NCR00118
Pub1    Cell_B    NCR00120
Pub2    Cell_A    NBS00233
Pub2    Cell_A    NBS00234
Pub2    Cell_A    NBS00235
Pub2    Cell_A    NBS00236
Pub2    Cell_A    NBS00238
Pub2    Cell_B    NBS00030
Pub2    Cell_B    NBS00031
Pub2    Cell_B    NBS00037
Pub2    Cell_B    NBS00042
Pub3    Cell_A    HGZ00780
Pub3    Cell_A    HGZ00878
Pub3    Cell_A    HGZ01023
Pub3    Cell_A    HGZ02053
Pub3    Cell_A    HGZ03950
Pub3    Cell_A    HGZ04059
Pub3    Cell_A    HGZ05069
Pub3    Cell_B    HGZ02042
Pub3    Cell_B    HGZ03056
</code></pre>
<p>Then the DESeq2 command would look something like this:</p>
<pre><code>dds &lt;- DESeqDataSetFromMatrix(countData = counts.mat,
                              colData = meta.df,
                              design= ~ Dataset + Condition)
res &lt;- results(dds, name=&quot;Condition_Cell_B_vs_Cell_A&quot;)
</code></pre>
<p>Information about doing this can be found in the DESeq2 manual. I'd recommend reading at least the quick start section; many of the answers to my own questions about differential analysis can be found in that manual:</p>
<p><a href="https://www.bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#quick-start" rel="nofollow noreferrer">https://www.bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#quick-start</a></p>

CC BY-SA 4.0
2024-08-15T22:05:12.873Z
2024-08-15T22:05:12.873Z
gringer
<p>I'm new to bioinformatics and RNAseq analysis, I'll try my best to explain the question!</p>
<p>I have raw counts RNAseq data from 3 different publications (so 3 different datasets) that all had similar methods to produce their data. I will be comparing the gene exp of Cell_type_A vs Cell_type_B in each of the datasets, so I will be doing differential gene expression on these 2 cell types. The 2 cell types will be my &quot;conditions&quot;, if that makes sense. To do this, I used R to apply DESeq2 on each dataset (independently) to get the log2fold change of each gene for the differential expression of Cell_type_A vs Cell_type_B. I filtered for genes with p-adj &lt; 0.05. Now that I have significant log2fold changes for each dataset, how can I compare these results in a heatmap? The type of heatmap I'm going for is 3 columns: one for each dataset. The heatmap will just display the log2foldchange values, like how a volcano plot would. Positive values (upregulated) = red, negative values (downregulated) = blue.</p>
<p>I was thinking of making a new dataset with 4 columns: gene, log2fs of dataset 1, log2fs of dataset 2, log2fs of dataset 3. And from there I can make a heatmap out of the new dataset: so my heatmap will have 3 columns of data and the genes as the row labels. But that seems like a cheap solution to me. Is it a valid way of going through with this? I really appreciate all kinds of help, I've been stuck on this problem for quite a while!</p>

CC BY-SA 4.0
2024-08-15T16:10:01.383Z
The question lacks any background information, e.g. what experiment is being performed and what coding can you do, presumably R maybe Python? ***You should perform a Volcano plot rather than a heat map.*** If I get time I will forward an answer.
M__
CC BY-SA 4.0
2024-08-15T16:13:36.153Z
Thank you for these suggestions, I will edit my post!
careless_caramel
<r><differential-expression><deseq2>
Differential gene expression (aiming to create heatmap) for raw RNAseq count data from different publications - how to?
# Differential gene expression (aiming to create heatmap) for raw RNAseq count data from different publications - how to?

(Asked by: username_0 on 2024-08-15)

I'm new to bioinformatics and RNAseq analysis, I'll try my best to explain the question!

I have raw counts RNAseq data from 3 different publications (so 3 different datasets) that all had similar methods to produce their data. I will be comparing the gene exp of Cell\_type\_A vs Cell\_type\_B in each of the datasets, so I will be doing differential gene expression on these 2 cell types. The 2 cell types will be my "conditions", if that makes sense. To do this, I used R to apply DESeq2 on each dataset (independently) to get the log2fold change of each gene for the differential expression of Cell\_type\_A vs Cell\_type\_B. I filtered for genes with p-adj < 0.05. Now that I have significant log2fold changes for each dataset, how can I compare these results in a heatmap? The type of heatmap I'm going for is 3 columns: one for each dataset. The heatmap will just display the log2foldchange values, like how a volcano plot would. Positive values (upregulated) = red, negative values (downregulated) = blue.

I was thinking of making a new dataset with 4 columns: gene, log2fs of dataset 1, log2fs of dataset 2, log2fs of dataset 3. And from there I can make a heatmap out of the new dataset: so my heatmap will have 3 columns of data and the genes as the row labels. But that seems like a cheap solution to me. Is it a valid way of going through with this? I really appreciate all kinds of help, I've been stuck on this problem for quite a while!

**Tags:** r, differential-expression, deseq2
> **Comments:**
> **username_1**: The question lacks any background information, e.g. what experiment is being performed and what coding can you do, presumably R maybe Python? ***You should perform a Volcano plot rather than a heat map.*** If I get time I will forward an answer.  
> **username_0**: Thank you for these suggestions, I will edit my post!  

---

## 1 answers

### Answer by username_2 on 2024-08-15. Score: 1

There's a lot to unpack here; it should really be in a few separate questions. I'm just going to concentrate on the data preparation side of things....
Given that you're using DESeq2, it would be better to prepare a single count table with all your data (genes / features in rows, samples in columns), and add any complicating factors into the statistical model.
Given that you're working with multiple datasets, one of those complicating factors would be the dataset that the data came from. So your meta data frame (e.g. meta.df) should look something like this:
Dataset Condition SampleID
Pub1    Cell_A    NCR00102
Pub1    Cell_A    NCR00103
Pub1    Cell_A    NCR00104
Pub1    Cell_B    NCR00112
Pub1    Cell_B    NCR00113
Pub1    Cell_B    NCR00114
Pub1    Cell_B    NCR00115
Pub1    Cell_B    NCR00118
Pub1    Cell_B    NCR00120
Pub2    Cell_A    NBS00233
Pub2    Cell_A    NBS00234
Pub2    Cell_A    NBS00235
Pub2    Cell_A    NBS00236
Pub2    Cell_A    NBS00238
Pub2    Cell_B    NBS00030
Pub2    Cell_B    NBS00031
Pub2    Cell_B    NBS00037
Pub2    Cell_B    NBS00042
Pub3    Cell_A    HGZ00780
Pub3    Cell_A    HGZ00878
Pub3    Cell_A    HGZ01023
Pub3    Cell_A    HGZ02053
Pub3    Cell_A    HGZ03950
Pub3    Cell_A    HGZ04059
Pub3    Cell_A    HGZ05069
Pub3    Cell_B    HGZ02042
Pub3    Cell_B    HGZ03056

Then the DESeq2 command would look something like this:
dds <- DESeqDataSetFromMatrix(countData = counts.mat,
                              colData = meta.df,
                              design= ~ Dataset + Condition)
res <- results(dds, name="Condition_Cell_B_vs_Cell_A")

Information about doing this can be found in the DESeq2 manual. I'd recommend reading at least the quick start section; many of the answers to my own questions about differential analysis can be found in that manual:
https://www.bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#quick-start


---

