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

# cassiopeia_tree_test.py

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

## High-level description

This file contains unit tests for the utilities stored in `cassiopeia/data/utilities.py`. It tests various functions related to bootstrapping character matrices and allele tables, converting trees to Newick format, computing phylogenetic weight matrices, and calculating inter-cluster distances.

## Code Structure

The code defines a `TestDataUtilities` class 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

The class sets up test data in the `setUp` method and defines multiple test methods to verify the functionality of different utility functions.

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

#### Description

Tests the `sample_bootstrap_character_matrices` function without providing priors.

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

#### Description

Tests the `sample_bootstrap_character_matrices` function with provided priors.

### test\_bootstrap\_allele\_tables

#### Description

Tests the `sample_bootstrap_allele_tables` function for standard allele tables.

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

#### Description

Tests the `sample_bootstrap_allele_tables` function for non-standard allele tables.

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

#### Description

Tests the `sample_bootstrap_allele_tables` function with provided indel priors.

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

#### Description

Tests the `to_newick` function without including branch lengths.

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

#### Description

Tests the `to_newick` function including branch lengths.

### test\_lca\_characters

#### Description

Tests the `get_lca_characters` function for finding the lowest common ancestor characters.

### test\_lca\_characters\_ambiguous

#### Description

Tests the `get_lca_characters` function with ambiguous character states.

### test\_lca\_characters\_ambiguous2

#### Description

Another test for the `get_lca_characters` function with different ambiguous character states.

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

#### Description

Tests the `get_lca_characters` function with both ambiguous and missing character states.

### test\_resolve\_most\_abundant

#### Description

Tests the `resolve_most_abundant` function for resolving the most common state in an ambiguous character.

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

#### Description

Tests the `compute_phylogenetic_weight_matrix` function for a simple tree.

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

#### Description

Tests the `compute_phylogenetic_weight_matrix` function with inverse weights.

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

#### Description

Tests the `compute_phylogenetic_weight_matrix` function with a custom inverse function.

### test\_net\_relatedness\_index

#### Description

Tests the `net_relatedness_index` function for calculating the Net Relatedness Index.

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

#### Description

Tests the `compute_inter_cluster_distances` function for basic inter-cluster distance calculation.

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

#### Description

Tests the `compute_inter_cluster_distances` function with custom input data.

## Dependencies

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

This test suite ensures that the data utility functions in the Cassiopeia package are working correctly and handling various edge cases appropriately.
