Hi
I have a count matrix (TPM) for my samples. My samples are as follows :
wt0hr wt6hr wt24hr kd0hr kd6hr kd24hr
I have a TPM matrix with geneids as rows and the columns as the 6 samples above. I am using follwoing R code to generate the heatmap: cols <- c("","wt0","wt6","wt24","kd0", "kd6","kd24") dat <- read.csv("TPM.csv", row.names = 1,stringsAsFactors = FALSE, col.names = cols, header = TRUE)
counts_filtered_df <- dat[apply(dat, MARGIN = 1, FUN = function(x) sd(x) != 0),]
z.mat <- t(scale(t(counts_filtered_df), scale=TRUE, center=TRUE))
heatmap.2(z.mat, dendrogram="both", scale="none", trace="none")
Can anyone suggest me if this is the correct way to generate the heatmaps from TPM .
Tanya
what makes you think that this was not the correct way?
You don't really need to scale the matrix manually as heatmap.2 can do that for you (by choosing a different value than
scale = "none"
) and my personal preference is to look at the unscaled values, too.