I'm using pheatmap to make a Heatmap. I was wondering if exist any way using pheatmap in R to add only the name of specific genes in the heatmap. Without do it manually.
You can set the names that are not of interest to you to empty vectors (I think).
Apart from that, the ComplexHeatmap package seems to allow you to do just that without a hack like the one I suggested. You can transfer your pheatmap command into ComplexHeatmap universe following these code details.
library(ComplexHeatmap)
I used the test examples just to see how it work.
Then I run:
pheatmap(test)
I got these error:
Error in pheatmap(test) : could not find function "pheatmap"
any guest I can imagine has to be something simple o fix.
For the pheatmap package that behaviour is controlled by the labels_row or labels_col arguments. These labels are by default the rownames and colnames of your matrix. To only show specific names, set the rest to empty characters "". For example:
# Your list of genes
genelist <- c("a","c")
# Labels to plot
labels <- rownames(mt)
# Set the rest of genes to ""
labels[!labels %in% genelist] <- ""
pheatmap(mt, labels_row = labels)
You can set the names that are not of interest to you to empty vectors (I think).
Apart from that, the
ComplexHeatmap
package seems to allow you to do just that without a hack like the one I suggested. You can transfer yourpheatmap
command intoComplexHeatmap
universe following these code details.I tried. ComplexHeatmap
library(ComplexHeatmap) I used the test examples just to see how it work. Then I run: pheatmap(test) I got these error: Error in pheatmap(test) : could not find function "pheatmap"
any guest I can imagine has to be something simple o fix.
Don't worry I fixed, thanks
Thanks guys I will try both option.
do report back what ended up working for you so that this post may be as useful as possible for future users
Finally, I took the suggestion from papyrus and your suggestion with ComplexHeatmap, The Script looks like that and work really good for me.