cassiopeia/mixins
directory contains utility modules that provide essential functionality for the Cassiopeia library. These modules include custom exceptions, logging setup, utility functions, and warning classes. The directory serves as a central location for shared components that are used across different parts of the Cassiopeia codebase.
mixins
directory provides several key functionalities:
ngs_tools
library, enabling consistent and configurable logging throughout the Cassiopeia library.
__init__.py
: This file serves as the entry point for the mixins
package. It imports and exposes symbols from the other modules in the directory, making them easily accessible to other parts of the Cassiopeia library.
errors.py
: This file defines a comprehensive set of custom exception classes. These exceptions are tailored to specific error conditions that may occur in different components of Cassiopeia, such as tree operations, data simulation, and various solver algorithms.
logging.py
: This file sets up the logging system for Cassiopeia using the ngs_tools
library. It creates a logger object configured to log messages at the INFO level and above.
utilities.py
: This file contains a collection of utility functions that are used across the Cassiopeia library. These functions include operations for handling ambiguous states in character matrices, importing modules safely, and finding duplicate groups in data.
warnings.py
: This file defines custom warning classes for different components of Cassiopeia. These warnings allow for more specific and contextual warning messages to be raised during the execution of various library functions.
mixins
directory relies on the following external libraries:
ngs_tools
: Used for setting up the logging system.functools
: Used in utility functions for operations like reducing lists.importlib
: Used for dynamically importing modules in utility functions.numpy
: Used in utility functions for array operations.pandas
: Used in utility functions for data manipulation.mixins
directory does not directly use configuration files or environment variables. However, the logging setup in logging.py
configures the logger to use the INFO level. This configuration might be further customized in other parts of the Cassiopeia library that use this logger.
In summary, the cassiopeia/mixins
directory provides a set of essential tools and utilities that form the backbone of error handling, logging, and common operations in the Cassiopeia library. These components enhance the overall functionality, reliability, and maintainability of the library by providing consistent mechanisms for handling errors, logging events, and performing common data operations.