Question: Generating A Heatmap for specific samples.
gravatar for fouerghi20
4 days ago by
fouerghi200 wrote:

I have 4 samples (Adar1-null stimulated, Adar1-null unstimulated, Control Stimulated, and Control Unstimulated). For each of these 4 samples, there are 3 replicates.

I have performed the differential gene expression analysis by doing pairwise comparisons and I am now trying to produce a heatmap for the differentially expressed genes for Adar1-null stimulated vs. Control stimulated.

I have stored the result of the comparison in a variable, but I don't know how to use this variable to generate a heatmap. The only heatmap I was able to generate was the one across all samples, but I am only interested in generating the heatmap across these two samples. How do I do this using DESeq2 and R?

heatmap rna-seq deseq2 • 73 views
ADD COMMENTlink modified 3 days ago by dtm245120 • written 4 days ago by fouerghi200
gravatar for dtm2451
3 days ago by
dtm245120 wrote:

You can do this pretty simply with dittoHeatmap(). It can grab the proper genes and samples subsets of your counts data and even automatically add annotation based on the type of samples. The inputs for such subsetting are genes and cells.use (dittoSeq is built to work for single-cell data as well.)

# Import your DESeqDataSet object into the (very similar) format that dittoSeq natively understands:
RNAdata <- importDittoBulk(your_dds)

# If your `sample types` data was likely in the dds as you would have used it for DE
# The import function will retain it then, but you can see the names of all kept metadata with

# Access of metadata can be achieved with:

# Make the heatmap
    object = RNAdata,
    genes = DE.genes,
    # cells.use can be used in any of these three ways.
    # Each are easiest for different situations.
    # Use ONE.
    cells.use = names_of_wanted_samples # example: colnames(RNAdata)[RNAdata$metadata_name %in% c("x","y")]
    cells.use = indices_of_wanted_samples # example: 1:4
    cells.use = logical_TRUE_for_wanted_samples # example: RNAdata$metadata_name %in% c("x","y")

Note on dittoSeq installation: If you are in R 4.0, you can install through Bioconductor with BiocManager::install("dittoSeq"). If not, you can still install it via the github (I have tested myself for R≥3.6.2, but this method should let you install in any R version.) BiocManager::install("dtm2451/dittoSeq")

Additional tweaks to the plot can be made by providing additional ?dittoHeatmap or ?pheatmap inputs, but the above code should accomplish the goals that you mention here.

ADD COMMENTlink modified 3 days ago • written 3 days ago by dtm245120
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1454 users visited in the last hour