I know edgeR has a function:
x <- calNormFactors(x, method="TMM")
I will get the normalized factor for each group. I am wondering should I multiply each reads number with their corresponding normalize factors?
Thank you,
Hi All:
I have a matrix that contains the gene EntrezID and the counts number at different developmental stage, the head of which looks like this:
> head(count_cts)
E11_rep1 E11_rep2 E14_rep1 E14_rep2 E18_rep1 E18_rep2 Adult_rep1 Adult_rep2
21749 4638 3254 1472 1862 632 1019 799 684
98403 8794 7109 5282 7475 3778 5853 2569 2595
18393 7917 7888 3758 5916 2814 4480 2997 2752
21961 6972 9219 6400 5051 2583 4079 5272 5210
76709 15345 19298 16327 21389 19766 28117 14388 13096
67534 12314 9867 5107 7963 4060 6005 1404 1397
It contains the developmental stages, each contains 2 replicates, the rowname of the the matrix is the geneID. The number is the counts I got from Rsubread. The geneID are already selected using a criteria. Now I want to use heatmap to describe the gene expression level change.
My question is: How should I process the counts before feed them into heatmap?
Thank you,
I would normalize counts using either deseq2 or edgeR, and then plot them in using a heatmap tool that can cluster columns based on similarity. That should show you major differences in EntrezID/function between samples.
https://genviz.org/module-04-expression/0004/02/01/DifferentialExpression/
I know edgeR has a function:
x <- calNormFactors(x, method="TMM")
I will get the normalized factor for each group. I am wondering should I multiply each reads number with their corresponding normalize factors?
Thank you,
No let edgeR do it for you!!!!
dge<-DGEList(counts,group = c(1,2,3,4))
dge<-calcNormFactors(dge)
tmm<-cpm(dge, normalized.lib.size=T, log=F) #non-LOG TMM normalized counts
I almost got there but got an error at the very last step:
my_palette <- colorRampPalette(c("red", "yellow", "blue"))(n = 299)
col_breaks = c(seq(0,20,length=100), # for red
seq(20.01,50,length=150), # for yellow
seq(50.01,300,length=100)) # for blue
png("heatmaps_in_r.png", # create PNG for the heat map
width = 5*300, # 5 x 300 pixels
height = 5*300,
res = 300, # 300 pixels per inch
pointsize = 8)
every thing looked fine, until the following step:
heatmap.2(mat_data, cellnote = count_cts, main = "Dynamic_Expression", notecol = "black", density.info="none", trace="none",margins =c(12,20), col=my_palette, breaks = col_breaks, dendrogram = "row", Colv="NA")
Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : must have one more break than colour
what can be the mistakes, is that because the value of the normalized counts exceed the color breaks?
Perhaps. Did you try it without col_breaks?
Log in to answer this question.
I tried. It gave a heatmap with all black color.
You could try adding another break in. I would keep it simple and call the heatmap on your normalized count matrix. After that, you can modify the parameters one by one to change colors and scale bar breaks to your liking.
Will try. Your advice looks working better. Thanks!
Hi: I have read some short manuals for heatmap for getting better images but I failed to get one with color showing the dynamic change of reads counts(normalized).
The heatmap generated is showing with single color. I guess it is because the reads counts value show too big variation for different genes. I am wondering how can I set the color to show the change at different stages:
For example for gene 21749, 36.30160 is high at E11 compared to 8.476963 at Adult; however, this value is the low expression in gene 98403. How to solve this conflicts? Also after heatmap, there will be clustering. Is there any methods to get the information on which genes are in the same cluster?
Try log transforming your count matrix before plotting with heatmap. You can export log-transformed counts from edgeR directly:
Thanks for the reply. Though the numbers looks better, but it still is a single colored heatmap.
How can I show you the map I got to make my expression better to be understood.
Thanks a lot,