> ## Documentation Index
> Fetch the complete documentation index at: https://demo.agenticlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# data_utilities_test.py

Here's a high-level description and documentation of the provided code:

## High-level description

This file contains unit tests for the data utilities stored in `cassiopeia/data/utilities.py`. It tests various functions related to character matrix operations, bootstrap sampling, dissimilarity map computations, and other utility functions used in the Cassiopeia lineage tracing framework.

## Code Structure

The code is structured as a single test class `TestDataUtilities` that inherits from `unittest.TestCase`. This class contains multiple test methods, each testing a specific functionality of the data utilities module.

## Symbols

### TestDataUtilities

#### Description

A test class containing various unit tests for the data utilities module.

#### Internal Logic

1. Sets up test data in the `setUp` method, including character matrices, priors, and allele tables.
2. Defines multiple test methods, each focusing on a specific utility function or feature.

### test\_bootstrap\_character\_matrices\_no\_priors

#### Description

Tests the bootstrap sampling of character matrices without priors.

### test\_bootstrap\_character\_matrices\_with\_priors

#### Description

Tests the bootstrap sampling of character matrices with priors.

### test\_bootstrap\_allele\_tables

#### Description

Tests the bootstrap sampling of allele tables.

### test\_bootstrap\_allele\_tables\_non\_cassiopeia\_allele\_table

#### Description

Tests the bootstrap sampling of allele tables with non-standard column names.

### test\_bootstrap\_allele\_tables\_priors

#### Description

Tests the bootstrap sampling of allele tables with priors.

### test\_to\_newick\_no\_branch\_lengths

#### Description

Tests the conversion of a tree to Newick format without branch lengths.

### test\_to\_newick\_branch\_lengths

#### Description

Tests the conversion of a tree to Newick format with branch lengths.

### test\_lca\_characters

#### Description

Tests the computation of least common ancestor (LCA) characters.

### test\_lca\_characters\_ambiguous

#### Description

Tests the computation of LCA characters with ambiguous states.

### test\_lca\_characters\_ambiguous2

#### Description

Tests another case of LCA character computation with ambiguous states.

### test\_lca\_characters\_ambiguous\_and\_missing

#### Description

Tests the computation of LCA characters with both ambiguous and missing states.

### test\_resolve\_most\_abundant

#### Description

Tests the resolution of ambiguous states by selecting the most abundant state.

### test\_simple\_phylogenetic\_weights\_matrix

#### Description

Tests the computation of a simple phylogenetic weight matrix.

### test\_simple\_phylogenetic\_weights\_matrix\_inverse

#### Description

Tests the computation of an inverse simple phylogenetic weight matrix.

### test\_phylogenetic\_weights\_matrix\_inverse\_fn

#### Description

Tests the computation of a phylogenetic weight matrix with a custom inverse function.

### test\_net\_relatedness\_index

#### Description

Tests the computation of the net relatedness index.

### test\_inter\_cluster\_distance\_basic

#### Description

Tests the computation of inter-cluster distances.

### test\_inter\_cluster\_distance\_custom\_input

#### Description

Tests the computation of inter-cluster distances with custom input.

## Dependencies

* unittest
* networkx
* numpy
* pandas
* cassiopeia.data
* cassiopeia.mixins.errors
* cassiopeia.preprocess.utilities

The test suite can be run by executing this file directly using Python.
