Utils Module
utils
Functions
find_path
find_path(hierarchy, path, cell_type)
Find the path from the root to a given cell type in a hierarchy.
Args: hierarchy: A dictionary representing the hierarchy. path: The current path. cell_type: The cell type to find.
Returns: The path from the root to the cell type (a list of strings or None).
find_lca
find_lca(path1, path2)
Find the lowest common ancestor (LCA) of two paths.
Args: path1: The first path. path2: The second path.
Returns: int: The index of the lowest common ancestor in the paths.
compute_cell_hierarchy_distance
compute_cell_hierarchy_distance(hierarchy, cell1, cell2)
Compute the distance between two cell types in a hierarchy.
The distance is the number of edges between the two cells in the hierarchy.
Args: hierarchy: A dictionary representing the hierarchy. cell1: The first cell type. cell2: The second cell type.
Returns: The distance between the two cell types (an integer or None).