# Utils Module

<a id="geniml.utils"></a>

<a id="geniml.utils.natural_chr_sort"></a>

## `natural_chr_sort`

```python
def natural_chr_sort(a, b)
```

<a id="geniml.utils.timer_func"></a>

## `timer_func`

```python
def timer_func(func)
```

<a id="geniml.utils.read_chromosome_from_bw"></a>

## `read_chromosome_from_bw`

```python
def read_chromosome_from_bw(file, chrom)
```

<a id="geniml.utils.find_path"></a>

## `find_path`

```python
def find_path(hierarchy: Dict[str, Dict], path: List[str], cell_type: str) -> Optional[List[str]]
```

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).

<a id="geniml.utils.find_lca"></a>

## `find_lca`

```python
def find_lca(path1: List[str], path2: List[str]) -> int
```

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.

<a id="geniml.utils.compute_cell_hierarchy_distance"></a>

## `compute_cell_hierarchy_distance`

```python
def compute_cell_hierarchy_distance(hierarchy: Dict[str, Dict], cell1: str, cell2: str) -> Optional[int]
```

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).
