Performs agglomerative hierarchical clustering on a gene distance matrix, cuts the tree dynamically with dynamicTreeCut::cutreeDynamic, tightens clusters by removing outliers with tighten_modules(), and drops singleton/small clusters.

ClusterGenes(
  gene_dist,
  clustering_method = "average",
  min_gene = 2,
  deepSplit = 1,
  z_thresh = 3
)

Arguments

gene_dist

A dist object (or symmetric matrix coercible to one) of pairwise gene distances.

clustering_method

Character. Linkage method passed to hclust(). Default "average".

min_gene

Integer. Minimum cluster size to retain. Default 2.

deepSplit

Integer (0–4). Controls the sensitivity of dynamic tree cutting; higher values produce more, smaller clusters. Default 1.

z_thresh

Numeric. MAD outlier threshold passed to tighten_modules(). Default 3.

Value

A named factor of cluster assignments (levels re-indexed as consecutive integers). Genes removed as singletons or outliers are dropped from the result.

Examples

if (FALSE) {
gene_partition <- ClusterGenes(as.dist(gene.dist.mat))
}