High-level description
This file contains unit tests for the utilities stored incassiopeia/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 aTestDataUtilities 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 thesetUp method and defines multiple test methods to verify the functionality of different utility functions.
test_bootstrap_character_matrices_no_priors
Description
Tests thesample_bootstrap_character_matrices function without providing priors.
test_bootstrap_character_matrices_with_priors
Description
Tests thesample_bootstrap_character_matrices function with provided priors.
test_bootstrap_allele_tables
Description
Tests thesample_bootstrap_allele_tables function for standard allele tables.
test_bootstrap_allele_tables_non_cassiopeia_allele_table
Description
Tests thesample_bootstrap_allele_tables function for non-standard allele tables.
test_bootstrap_allele_tables_priors
Description
Tests thesample_bootstrap_allele_tables function with provided indel priors.
test_to_newick_no_branch_lengths
Description
Tests theto_newick function without including branch lengths.
test_to_newick_branch_lengths
Description
Tests theto_newick function including branch lengths.
test_lca_characters
Description
Tests theget_lca_characters function for finding the lowest common ancestor characters.
test_lca_characters_ambiguous
Description
Tests theget_lca_characters function with ambiguous character states.
test_lca_characters_ambiguous2
Description
Another test for theget_lca_characters function with different ambiguous character states.
test_lca_characters_ambiguous_and_missing
Description
Tests theget_lca_characters function with both ambiguous and missing character states.
test_resolve_most_abundant
Description
Tests theresolve_most_abundant function for resolving the most common state in an ambiguous character.
test_simple_phylogenetic_weights_matrix
Description
Tests thecompute_phylogenetic_weight_matrix function for a simple tree.
test_simple_phylogenetic_weights_matrix_inverse
Description
Tests thecompute_phylogenetic_weight_matrix function with inverse weights.
test_phylogenetic_weights_matrix_inverse_fn
Description
Tests thecompute_phylogenetic_weight_matrix function with a custom inverse function.
test_net_relatedness_index
Description
Tests thenet_relatedness_index function for calculating the Net Relatedness Index.
test_inter_cluster_distance_basic
Description
Tests thecompute_inter_cluster_distances function for basic inter-cluster distance calculation.
test_inter_cluster_distance_custom_input
Description
Tests thecompute_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
