matrix of kappa statistics (output of `create_kappa_matrix`)
enrichment_res
data frame of pathway enrichment results
use_names
boolean to indicate whether to use pathway names instead of IDs (default = FALSE, i.e. use IDs)
clu_method
the agglomeration method to be used (default = "average", see `?hclust`)
plot_hmap
boolean to indicate whether to plot the kappa statistics
heatmap or not (default = FALSE)
plot_dend
boolean to indicate whether to plot the clustering dendrogram
partitioned into the optimal number of clusters (default = TRUE)
Value
a vector of clusters for each term in the enrichment results.
Details
The function initially performs hierarchical clustering
of the terms in `enrichment_res` using the kappa statistics
(defining the distance as `-kappa_statistic`). Next,
the clustering dendrogram is cut into k = 2, 3, ..., n - 1 clusters (where
n is the number of terms). The optimal number of clusters is determined as the
k value which yields the highest average silhouette width.