I am trying to generate a heat map of the top differentially expressed genes between two samples. I have used DESeq2 to identify these. My code is
library(DESeq2)
countData = read.csv("data.txt",header = T,sep = "\t")
colData = DataFrame(condition = factor(c("female","female","female","male","male","male")))
dds <- DESeqDataSetFromMatrix(countData = countData,colData = colData,design = ~ condition)
dds <- dds[ rowSums(counts(dds)) > 1, ]
dds <- DESeq(dds)
res <- results(dds,contrast=c("condition","male","female"))
summary(res)
I am not sure how to get a heatmap from the dds or res objects. Please help. Thanks
3 answers
Please visit "Data quality assessment by sample clustering and visualization" section in below page: https://www.bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html
You can extract FPKM values or Count value (If you are using htseq-count) of top differentially expressed gene. by this FPKM matrix you can plot heatmap using pheatmap library or heatmap.2(ggplot lib).
Create a matrix of DEG counts then use corrplot or ggplot2.
Matrix example:
sample1 sample2 sample3
sample1 0 567 545
sample2 123 0 234
sample3 345 34 0
Corrplot is very very very easy. ggplot2 gives more control but is more complicated and will require first converting the matrix to long format using the melt function of reshape package. Did I mention how easy corrplot is?
Log in to answer this question.
This guideline contains code for making DESeq2 heatmaps, and also the DESeq2 manual does. Using google to find this wasn't too hard!