I am interested in adding multiple row annotations to my heatmap using the pheatmap function in R (example: https://stackoverflow.com/questions/41628450/r-pheatmap-change-annotation-colors-and-prevent-graphics-window-from-popping-up). The examples I see online all give only one annotation. What is the easy way to extend it to multiple row annotations?
If you hablve a data frame or matrix with your gene names annotated for each category. Then you can easily parse it in pheatmap as
annotation_row=
. Check the pheatmap tutorial. Alternatively if it's on the fly then you have to create vectors of the category with your gene names or rownames that you intend to project and create a data frame with them. Once done while you write code for the pheatmap just parse that data frame in to the row annotate handler. It should work.I have a data frame for the annotation, and I tried doing it, as you've mentioned. For some reason, I always get this error: Error in cut.default(a, breaks = 100) : 'x' must be numeric. Could you help me understand what this error means?
I would encourage you to search the error in this forum or Google or StackOverflow. In case you do not find it. Please write a new post in those mentioned forums detailing your problem scope, code snippet, and error, so that we can better assist.
Thanks for the comments; I made it to work for categorial variables. Now I am trying to add row annotations for categorial variables. In otherwords I am trying to add a heatmap on continuous variables as row annotations for another heatmap. Do I have to to define the bin sizes and treat the continuous variables as categorial variables, or is there a easier way to get around this step?
Thanks, Lavanya
you can use the continuous annotations as is, pheatmap will take care of it