Hello everyone. I'm sorry if my question looks dumb, I'm new to R.
I used this code to make a heatmap with differentialy expressed genes:
heatmap <- pheatmap(zscore,
cluster_rows = T,
cluster_cols = T,
clustering_distance_rows = "euclidean",
clustering_distance_cols = "euclidean",
cutree_rows = 5,
cutree_cols = 3,
fontsize_col = 10,
fontsize_row = 0.5,
col = brewer.pal(10, "RdYlGn"),
)
I did the cutree_rows in 5 because I saw 5 interesting clusters. Now, I want to grab the elements of each row cluster. Then I tried to use cutree because I saw on this forum someone using it.
heatmap_clust <- cbind(zscore,
cluster = cutree(heatmap$tree_row,
k = 5))
I seem to be doing something wrong, since the output is not the same as the row names in the graph (specially, the clusters are out of order -- e.g. cluster number 4 on the spreadsheet is not the 4th cluster to appear on the image). Can someone please elucidate what is wrong and what should I do? Thank you!