
Calculate dendrogram cluster assignments
calculate_dendrogram_cuts.RdCuts each cell-type dendrogram into clusters (the cell groups of a TF module) in two steps:
the dendrogram is cut with dynamic tree cutting (
dynamicTreeCut::cutreeDynamic(),method = "tree",deepSplit = TRUE, which splits clusters more finely thanFALSE);each cluster is made to cover a single range of correlation values with the module. With
method = "tree", a cluster can be a branch from which smaller branches were split off as other clusters, so its features can lie in separated ranges of correlation (e.g. 0.14, 0.17-0.19 and 0.26-0.39, with other clusters in between). The assigned features are sorted by their correlation, and each run of consecutive features with the same cluster becomes a piece. A piece with fewer thanmin_cluster_sizefeatures is joined to the neighbouring piece (just below or just above in correlation) with the smallest gap between their correlations, the smallest gap first, until every piece has at leastmin_cluster_sizefeatures. The pieces are the final clusters, numbered from the lowest to the highest correlation.
Features left unassigned by the dynamic tree cut stay unassigned. Step 2 needs the correlations stored in the
dendrograms by identify.cell.groups(); for dendrograms without them, only step 1 is done (with a message).
Arguments
- cell_dendrograms
A list of
hclustobjects (or objects convertible tohclust), one per TF module, as returned byidentify.cell.groups().- min_cluster_size
Integer. Minimum number of features per cluster: passed to
dynamicTreeCut::cutreeDynamic()'sminClusterSizeargument, and used in step 2. Default is 3.