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.