Heat MAP TPM
2
0
Entering edit mode
tanyabioinfo ▴ 20
@tanyabioinfo-14091
Last seen 5.8 years ago

Hi

I have a count matrix (TPM) for my samples. I have 4 replicate for each sample. My samples are as follows :

 

wt0hr wt6hr wt24hr  mut0hr mut6hr  mut24hr

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:

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 rather than using log2 FC.

 

Tanya

 

 

heatmap2 • 5.3k views
ADD COMMENT
0
Entering edit mode
chris86 ▴ 420
@chris86-8408
Last seen 5.0 years ago
UCL, United Kingdom

Your saying rather than using log2FC, but are you sure that is what you mean?

You are currently running your heatmap function on z score normalised TPMs.

I would first take log(TPM+1) before doing the z score. That should be approx normally distributed which is required for doing z scores.

Other than that, this looks fine - to me at least.

ADD COMMENT
0
Entering edit mode
tanyabioinfo ▴ 20
@tanyabioinfo-14091
Last seen 5.8 years ago

Thanks Chris

 

I did that and it works fine for me.

So now the R script looks like this:

logTransformed.dat = log2(counts_filtered_df + 1)
z.mat <- t(scale(t(logTransformed.dat), scale=TRUE, center=TRUE))
heatmap.2(z.mat, dendrogram="both", scale="none", trace="none")

I have one more question. I have four replicates for each sample. How can I plot all the replicates into one heatmap.

Regards

 

Tanya

ADD COMMENT
0
Entering edit mode

I am not sure I understand your question. You have 4 replicates, if these are in the matrix that goes into the heatmap function they will be plotted. If you want to average by column to combine replicates, just could google for that.
 

ADD REPLY

Login before adding your answer.

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