plotting heatmap from DESeqDataSet
1
0
Entering edit mode
@nishikantwase-8473
Last seen 7.9 years ago
United States

Hi 

I am new user to DESeq2.  I managed to perform the analysis.  But i want to build heatmaps based on the pathway changes.  Say for example i can extract ids which are significantly changed lfc > 2 and padj < 0.05.  How can i use those IDs to extract counts from the DESeqDataSet and plot them as heatmap?

For example using the vignette, 

library("genefilter")

library(pheatmap)

topVarGenes <- head(order(-rowVars(assay(rld))),20)

mat <- assay(rld)[ topVarGenes, ]
mat <- mat - rowMeans(mat)
df <- as.data.frame(colData(rld)[,c("Condition", "libType")])

pheatmap(mat, fontsize_number = 0.8 * fontsize, annotation_col=df)

Using this script i can easily draw a heatmap of top 50 genes.  But for example if i have a list of genes of interest and i if i want to draw a heatmap by would it be possible to do so.

 

thanks in advance

nishikant 

 

 

deseq2 heatmap • 7.2k views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 2 hours ago
United States

hi Nishikant,

assay(rld) has rownames which identify the genes. To make it clearer, let's assign this to a new variable, so it's clear it's just a matrix:

mat <- assay(rld)

Now look at the first few rownames:

head(rownames(mat))

You can extract the rows you want by indexing, you just need to create a vector of the genes you want to pull out. For example:

idx <- rownames(res)[ which(res$padj < 0.1) ]

Then this is how you would index mat:

mat[ idx, ]
ADD COMMENT

Login before adding your answer.

Traffic: 952 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