Generating A Heatmap for specific samples.
1
0
Entering edit mode
4.0 years ago
fouerghi20 ▴ 80

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?

RNA-Seq DESeq2 Heatmap • 1.4k views
ADD COMMENT
2
Entering edit mode
4.0 years ago
dtm2451 ▴ 30

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
getMetas(RNAdata)

# Access of metadata can be achieved with:
RNAdata$metadata_name

# Make the heatmap
dittoHeatmap(
    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 COMMENT

Login before adding your answer.

Traffic: 1696 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6