Thank you for answer, into data there's two type data. 0 and 1 I wanna make heatmap for value 1 but I'm still stuck on it. How can I reduce? I used rowsum() in r for remove the column contain only 0. But it's still too large. I was thinking about cluster data then make heatmap but I don't know how to cluster data.
Hi, I tried make heatmap in R for data has 14637 obs. But my map is not look okay.
pheatmap(df1,
display_numbers = F,
color = colorRampPalette(c('black','red'))(100),
cluster_rows = F,
cluster_cols = F,
fontsize_number = 6,
border_color = NA,
use_raster = TRUE)
That is my code I used.
That is the how heatmap look like, anyone can help me with this problem.
Thank you so much.
1 answer
It is clear why your heatmap doesn't look good. You have too many rows. Heatmaps of over 100-200 rows are generally not useful for visualization because they are impossible to read. Reduce your data to the <100 genes most relevant to your scientific question in the geneset or choose a different visualization option.
Another issue is that you definitely need to turn on row clustering with cluster_rows = T on a smaller sample because an unordered heatmap completely defies its purpose.
I used cluster_rows = T, it does not work.
Possibly you have too many rows? Try to visualize a subset, like with df1[1:100, ] and see how that looks.
When I used as.data.frame(df1[1:100, ]) this code its look like that
looks like what? Can you show an example, please? Also, could you please explain what your data come from?
Sorry I added picture but it does not showing. It looks like that, it's a matrix of 0 and 1. I wanna group them and then make heatmap. It's tau score of rna-seq data (value > 0.8 its equal to 1 if its smaller than 0.8 its equal to 0)
data1_tau data2_tau data4_tau data3_tau data5_tau data6_tau data7_tau data8_tau data9_tau data10_tau
(gene)A1BG-AS1 0 0 0 0 0 1 0 0 0 0
The picture above is not the heatmap but your data seemingly. To group the rows you need to turn on row clustering in pheatmap, or try heatmap2 for testing. Your data looks binary (0,1), so I wouldn't expect shades between black and red. Please read the documentation of pheatmap carefully and try out some examples first.
Try this code: pheatmap(as.data.frame(df1[1:100, ]), display_numbers = F, color = c('black','red'), cluster_rows = TRUE, clustering_distance_rows = 'binary', cluster_cols = F, fontsize_number = 6, border_color = NA, use_raster = TRUE)
Edit: If your data is binary, there is no need for a color ramp palette, and distance method should be binary.
Log in to answer this question.
What do you want to do with this data? Any specific directions or thought process for analysis?
This is large data contain tau score. I converted data into matrix only contain 0 and 1 (value > 0.8 its equal to 1 if it's smaller than 0.8 it's equal to 0) and now I want to cluster data into two group and make heatmap for them.
When you performed clustering you can use cutree function to obtain any number of clusters you want. see here : Basically you save pheatmap output to new variable and use cutree to obtain clusters by value of k