Label specific rows in pheatmap
1
0
Entering edit mode
Dina ▴ 50
@c2bd1bf1
Last seen 6 weeks ago
United States

This is pretty simple, have a heatmap with a lot of genes. I want to hide all rownames except the handful of genes I want to highlight. I have searched on google, on this forum, but could not find a solution.

Anyone have advice?

Code below


pheatmap(MyData,
         cluster_rows = T,cluster_cols = F,
         clustering_distance_rows = 'euclidean',
         clustering_distance_cols = 'euclidean',
         clustering_method = 'ward.D',
         annotation_row = gene_functions,
          fontsize_row = 6,
         fontsize_col = 10,
         cellwidth=10,
         cellheight = 1,
         show_colnames = T, show_rownames=F)

I did find this post that definitely is close to what I want: Add selected row names on pheatmap

I suspect the answer i want is an adjustment of the code in that post, to tell it exactly which rows i want it to exclude or include. Thanks

heatmaps pheatmap • 389 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 2 days ago
United States

You have found the answer to your question in the post you link to. Just convert the row.names of the rows you don't want to include to be character(0) and then you won't see them.

0
Entering edit mode

I have been fiddling with the code in the link and havent had any luck. The issue is the 25 genes I want to include are randomly distributed in the rownames

How do i convert row names i dont want to character(0)? I have a list/data frame with only the names that i want to show.

Does this mean what I would be doing is converting the unwanted names to be essentially blank in MyData then tell the lab.rows to be all the row names but since some are blank they just wont show up?

thanks!

ADD REPLY
0
Entering edit mode
ind <- !row.names(your matrix) %in%  <vector of rownames you want>
row.names(your matrix)[ind] <- ""

This is a basic R manipulation that you will need to understand if you plan to use R. Reading the intro to R that you can find at r-project.org is highly recommended.

ADD REPLY

Login before adding your answer.

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