Given a weighted adjacency matrix, generate a cluser-to-cluster graph based on a similarity-matrix of connected cells. Generate the minimum spanning tree on the cluster-to-cluster graph. Use one of the max dist clusters from this graph, unless: The cluster is given, then proceed to find the root cell The root cell is given, then use its cluster

FindRootCluster(
  cluster_labels,
  flat_embedding,
  dist_graph,
  dist_flat,
  reverse = FALSE
)

Arguments

cluster_labels

the cluster label for each cell

flat_embedding

rows are cells and columns are coordinates in n-col space

dist_graph

distances on a connected graph

dist_flat

flat distance matrix for all cells

reverse

a boolean variable whether to take the root cluster based on minimum dispersion on the flat embedding

Value

a list containing:

cluster_adj_matrix

a weighted upper-triangular adjacency matrix for the clusters based on avg pseudotime between their cells

graph_cluster

an igraph object on the clusters, with a minimum spanning tree

root_cluster

index of the root cluster

cluster_mst

an igraph mst object