The state_containers submodule#
This submodule contains functions and classes to store and convert mutation states used for training. It also contains a function to compute an independence model that can be used as a starting point for training a new MHN.
- class mhn.training.state_containers.StateAgeContainer(int[:, :] mutation_data, double[:] ages)#
Bases:
StateContainerThis class is used as a wrapper like the StateContainer class, but also contains age information for each sample.
- get_data_shape(self)#
- Returns:
Number of tumor samples and the number of genes stored in this object
- Return type:
tuple
- get_max_mutation_num(self)#
- Returns:
Maximum number of mutations present in a single sample.
- class mhn.training.state_containers.StateContainer(int[:, :] mutation_data)#
Bases:
objectThis class is used as a wrapper such that the C array containing the States can be referenced in a Python script.
It also makes sure that there aren’t more than 32 mutations present in a single sample as this would break the algorithms.
- get_data_shape(self)#
- Returns:
Number of tumor samples and the number of genes stored in this object
- Return type:
tuple
- get_max_mutation_num(self)#
- Returns:
Maximum number of mutations present in a single sample.
- mhn.training.state_containers.create_indep_model(StateContainer state_container)#
Compute an independence model from the data stored in the StateContainer object, where the baseline hazard Theta_ii of each event is set to its empirical odds and the hazard ratios (off-diagonal entries) are set to exactly 1. The independence model is returned in logarithmic representation.
- Parameters:
state_container (StateContainer) – Data used to compute the independence model.
- Returns:
Independence model in logarithmic representation.
- Return type:
np.ndarray