Learn R Programming

pathfindR (version 1.3.0)

hierarchical_pw_clustering: Hierarchical Clustering of Pathways

Description

Hierarchical Clustering of Pathways

Usage

hierarchical_pw_clustering(kappa_mat, enrichment_res, use_names = FALSE,
  clu_method = "average", plot_hmap = FALSE, plot_dend = TRUE)

Arguments

kappa_mat

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.

Examples

Run this code
# NOT RUN {
hierarchical_pw_clustering(kappa_mat, enrichment_res)
hierarchical_pw_clustering(kappa_mat, enrichment_res, method = "complete")
# }

Run the code above in your browser using DataLab