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

# cas9_lineage_tracing_simulator_test.py

Here's a high-level description and documentation for the target file:

## High-level description

This file contains unit tests for the Cas9-based lineage tracing data simulator in the Cassiopeia package. It tests various aspects of the simulator, including basic setup, error handling, and data generation functionality.

## Code Structure

The main class `TestCas9LineageTracingDataSimulator` contains multiple test methods that check different aspects of the `Cas9LineageTracingDataSimulator` class. The tests cover basic setup, error handling, and data generation functionality.

## Symbols

### TestCas9LineageTracingDataSimulator

#### Description

A unittest.TestCase class that contains test methods for the Cas9LineageTracingDataSimulator.

#### Internal Logic

The class sets up a basic tree structure and several instances of Cas9LineageTracingDataSimulator with different configurations in the `setUp` method. It then tests various aspects of the simulator in separate test methods.

### setUp

#### Description

Sets up the test environment by creating a basic tree structure and initializing several Cas9LineageTracingDataSimulator instances with different configurations.

### test\_basic\_setup

#### Description

Tests the basic setup of the Cas9LineageTracingDataSimulator, including the number of characters, mutation rates, and priors.

### test\_setup\_errors

#### Description

Tests various error conditions in the setup of Cas9LineageTracingDataSimulator, such as invalid input parameters.

### test\_get\_cassettes

#### Description

Tests the `get_cassettes` method of the Cas9LineageTracingDataSimulator.

### test\_introduce\_states

#### Description

Tests the `introduce_states` method of the Cas9LineageTracingDataSimulator.

### test\_silence\_cassettes

#### Description

Tests the `silence_cassettes` method of the Cas9LineageTracingDataSimulator.

### test\_collapse\_sites

#### Description

Tests the `collapse_sites` method of the Cas9LineageTracingDataSimulator.

### test\_simulator\_basic

#### Description

Tests the basic functionality of the Cas9LineageTracingDataSimulator by overlaying data on a tree and checking the resulting character matrix.

### test\_no\_collapse

#### Description

Tests the Cas9LineageTracingDataSimulator without collapsing sites.

### test\_no\_resection

#### Description

Tests the Cas9LineageTracingDataSimulator without resection.

### test\_simulator\_with\_state\_generating\_distribution

#### Description

Tests the Cas9LineageTracingDataSimulator with a state-generating distribution.

### test\_simulator\_with\_per\_character\_priors

#### Description

Tests the Cas9LineageTracingDataSimulator with per-character priors.

### test\_simulator\_with\_per\_character\_rates

#### Description

Tests the Cas9LineageTracingDataSimulator with per-character mutation rates.

## Dependencies

* unittest
* networkx
* numpy
* pandas
* cassiopeia

## Error Handling

The test methods use assertions to check for expected behavior and raise exceptions for unexpected results.

Your response should not exceed 3000 words or 4000 tokens. Focus on providing clear, concise information that can be directly inferred from the code. Include optional sections only when they provide significant value for understanding the code.
