I then acquire my clusters using the following script:
r.dend <- row_dend(phase_heatmap) #If needed, extract row dendrogram
rcl.list <- row_order(phase_heatmap) #Extract clusters (output is a list)
lapply(rcl.list, function(x) length(x)) #check/confirm size gene clusters
library(magrittr) # needed to load the pipe function '%%'
clu_df <- lapply(names(rcl.list), function(i){
out <- data.frame(GeneID = rownames(axillary.mat[rcl.list[[i]],]),
Cluster = paste0("cluster", i),
stringsAsFactors = FALSE)
return(out)
}) %>% #pipe (forward) the output 'out' to the function rbind to create 'clu_df'
do.call(rbind, .)
With these clusters, I want to make a new Heatmap with annotations in text boxes corresponding to specific clusters (Clusters 1, 2, 4, 5, 6, 8, 9, and 10) with the following script:
I am able to make a Heatmap with the following data (attached in a csv file) AxillaryDESeq_OrthoPlagio_DEG_CPM.csv
I use the following script to make my Heatmap and subsequently get the assigned clusters:
I then acquire my clusters using the following script:
With these clusters, I want to make a new Heatmap with annotations in text boxes corresponding to specific clusters (Clusters 1, 2, 4, 5, 6, 8, 9, and 10) with the following script:
I keep getting the following error:
Not sure where the error is coming in. Any help would be appreciated. Thanks.