How to do a heatmap (with pheatmap) when I have a multifactorial design with 3 replicates
0
1
Entering edit mode
8.1 years ago
ivanasabljic ▴ 10

I load the table with the counts from HTSeq and then I ran de DESEq2 as follows:

condition = c("control","control","control","treated","treated","treated","control","control","control","treated","treated","treated")
genotype = c("A","A","A","A","A","A","B","B","B","B","B","B")
dds <- DESeqDataSetFromMatrix(countData = filtered, colData = colData, design = ~ genotype + condition)

design(dds) <- formula(~ genotype + condition)
dds <- DESeq(dds)

res <- results(dds)
resOrdered <- res[order(res$padj),]

rld <- rlog(dds)
sampleDists <- dist(t(assay(rld)))
vsd <- varianceStabilizingTransformation(dds)

#Finally I did a heatmap

library(pheatmap)
topgenes <- head(rownames(resOrdered),100)
mat <- assay(rld)[topgenes,] 
mat <- mat - rowMeans(mat)
df <- as.data.frame(colData(dds)[,c("genotype","condition")])
pheatmap(mat, annotation_col=df)

But the biological replicates appear separated. I would like to know how to do the mean just to have one column for each treatment (control-A, treated-A, control-B, treated-B).

Thanks!

RNA-Seq R DESeq2 pheatmap multifactorial • 6.0k views
ADD COMMENT
1
Entering edit mode

I would encourage you not to do that, it kind of defeats the purpose of a heatmap and masks the variability.

ADD REPLY
0
Entering edit mode

Ok, thanks. That was a doubt I had. I haven't seen heatmaps with replicates in papers so I thought that the mean is used.

ADD REPLY

Login before adding your answer.

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