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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hierarchy
|
Dict[str, Dict]
|
A dictionary representing the hierarchy. |
required |
path
|
List[str]
|
The current path. |
required |
cell_type
|
str
|
The cell type to find. |
required |
Returns:
Type | Description |
---|---|
Optional[List[str]]
|
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path1
|
List[str]
|
The first path. |
required |
path2
|
List[str]
|
The second path. |
required |
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hierarchy
|
Dict[str, Dict]
|
A dictionary representing the hierarchy. |
required |
cell1
|
str
|
The first cell type. |
required |
cell2
|
str
|
The second cell type. |
required |
Returns:
Type | Description |
---|---|
Optional[int]
|
The distance between the two cell types. (an integer, ... or None) |