DEP icon indicating copy to clipboard operation
DEP copied to clipboard

plot_heatmap: extract specific cluster group from heatmap

Open phoebeshayin opened this issue 3 years ago • 1 comments

Hi,

Thank you for this very useful tool!

Is there a way to extract a specific cluster of proteins that was differentiated by k-means clustering in the heatmap?

phoebeshayin avatar Jun 29 '22 08:06 phoebeshayin

Hi,

I know this comes late, but it can be solved by assigning plot_heatmap into a variable and setting argument plot = FALSE:

df <- plot_heatmap(dep, type = "centered", kmeans = TRUE, k = 4, col_limit = 4, show_row_names = FALSE, indicate = c("condition", "replicate"), plot = FALSE)

df is now a dataframe with 'protein' column and 'k' column, containing info into which cluster the particular protein belongs to, so you can extract the proteins of some cluster easily: df[df$k == cluster_number, ]

KristinaGomoryova avatar Sep 04 '23 11:09 KristinaGomoryova