Hi All
I plot the heat map for my logCPM successfully but using Ensemble geneIDs. I need the heatmap to have the gene symbols, I can convert the ensemble gene IDs to gene IDs fine, but don't know how to reflect this on the heatmap. My code for the heatmap and my code for ensemble IDs to gene sybmol are below if any one can help where can I reflect the gene symbol in the heatmap, thanks very much
Heatmap
logCPM =countsPerMillion
o = rownames(etp$table[abs(etp$table$logFC)>2 & etp$table$FDR<0.01, ])
logCPM = logCPM[o[1:25],]
colnames(logCPM) = LABELS
logCPM = t(scale(t(logCPM)))
require("RColorBrewer")
require("gplots")
myCol <- colorRampPalette(c("dodgerblue", "black", "yellow"))(25)
myBreaks <- seq(-3, 3, length.out=26)
heatmap.2(logCPM, col=myCol, breaks=myBreaks,symkey=F, Rowv=TRUE,Colv=TRUE, main=title, key=T, keysize=0.7,scale="none",trace="none", dendrogram="both", cexRow=0.7, cexCol=0.9, density.info="none",margin=c(10,9), lhei=c(2,10), lwid=c(2,6),reorderfun=function(d,w) reorder(d, w, agglo.FUN=mean), distfun=function(x) as.dist(1-cor(t(x))), hclustfun=function(x) hclust(x, method="ward.D2"))
Naming conversions:
library(EnsDb.Hsapiens.v79)
geneIDs <- ensembldb::select(EnsDb.Hsapiens.v79, keys= o, keytype = "GENEID",
columns
= c("SYMBOL","GENEID"))
Thanks all
yes, when I use rownames(logCPM) to geneid I get not equal size error, that I can't get around, so may this is the issue, duplication and missings. Thanks fracarb8.
Yes, that's the problem. Unlike humans, not every gene got a name or a symbol and they are not unique either. Uniqueness can be overcome using make.names, but missing symbols not that easily.
Thanks Michael. I never used make.names, but will play around and see. Thank you