How to show only highly clustered genes in a heatmap, and the rest will hide
1
0
Entering edit mode
18 months ago
rishav513 ▴ 30

Hello all,

I have done the correlation analysis between the genes at a particular condition and now am trying to plot a heatmap through complexheatmap, but the problem is that i have 270 genes and when i am trying to plot the heatmap keeping the option "show_row_names = TRUE" , it is showing all the genes in the plot and it is really hard to visualize, so, i want to show the only highly correlated genes in heatmap and hide all others .

Any suggestion would be really helpful.

R ComplexHeatmap • 1.5k views
ADD COMMENT
1
Entering edit mode
18 months ago

You could try setting the row_labels option to only the labels you want like this:

Heatmap(..., row_labels = ..., show_row_names = TRUE)

Alternatively, you could turn off row names and add only the labels you want using row annotations. Maybe something like this:

Heatmap(..., show_row_names = FALSE) + rowAnnotation(labels = ...)
ADD COMMENT
0
Entering edit mode

Thank You very much

ADD REPLY
0
Entering edit mode

But I have one query, row_labels seems to work manually, which means I have to manually put the names of each gene by seeing the plot. Couldn't it be possible that complexheatmap automatically shows the name of only highly correlated genes and hide all other gene names from the rows

ADD REPLY
1
Entering edit mode

You can programmatically generate the labels vector by keeping some genes in it and putting an empty strings where you don't want a gene.

ADD REPLY
0
Entering edit mode

Yaa sure, i will try that

ADD REPLY
0
Entering edit mode

Also, I have to change the row clustering order of the plot. Suppose out of 270 genes, I want to show only the top 50 correlated genes in my heatmap then how can I do this as clustering is according to 270, not to 50. Even if I manually put the names of top 50 genes using row_labels, then how to arrange the plot according to row_labels

ADD REPLY
1
Entering edit mode

In this case, just subset the data you feed to Heatmap() so that it only contains the genes of interest. Otherwise see if this solution works for you.

ADD REPLY

Login before adding your answer.

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