resplitClusters {scDblFinder} | R Documentation |
Split (re-cluster) clusters of an existing graph-based clustering that are above a certain size
resplitClusters(g, cl = NULL, max.size = 500, min.size = 50, renameClusters = TRUE, iterative = TRUE)
g |
An object of class 'igraph' |
cl |
A vector of cluster labels corresponding to the nodes of 'g'. If ommited, a new clustering will be run using 'igraph::cluster_fast_greedy'. |
max.size |
The maximum cluster size |
min.size |
The minimum cluster size (default none). If given, this overrides 'max.size'. |
renameClusters |
Logical; whether to rename clusters |
iterative |
Logical; whether to resplit until no cluster is above the size limit or no improvement is made (default TRUE). If FALSE, splits each cluster once. |
A vector of cluster assignments.
m <- t(sapply( seq(from=0, to=5, length.out=50), FUN=function(x) rpois(50,x) ) ) g <- scran::buildSNNGraph(rankTrans(m)) table(resplitClusters(g, min.size=2, max.size=20))