Library for the Development and Use of Phylogenetic Network Methods
State management for MCMC accept/reject decisions with model validation.
Class that implements accept/reject functionality for the Metropolis-Hastings algorithm. There are 2 model objects, one of which is the current state, and the other is the model used to test changes and moves to the current accepted version. Rejection is implemented by reverting the change on the proposed model (like git revert). Acceptance is implemented by duplicating the move on the current model (like git merge).
Initialize a State. A State contains two models-- one current model, and one proposed model that contains one singular edit to the current model. At the very beginning of the State and before the execution of a method, the two models will be carbon copies of each other.
| Parameter | Type | Description |
|---|---|---|
| model | Model | None, optional | A Phylogenetic Model. Defaults to |
| None | only used for if bootstrapping is to be used. | |
| validate | Callable[[Model], bool] | A callable function that checks for model validity. The parameter for such a function should be a Model object, and return True if the Model is |
| valid | False if not. Defaults to 'acyclic_routine', which checks that the Model's phylogenetic network is free of cycles. |
Calculates the likelihood of the current model
| Parameter | Type | Description |
|---|---|---|
| Returns | a float that is the model likelihood for the current accepted state |
Set the proposed model to a new model that is the result of applying one move to the former proposed model
| Parameter | Type | Description |
|---|---|---|
| move | Move | Any instantiated subclass of Move. |
Set the proposed model to the former proposed model, the move that was made was not a beneficial one.
| Parameter | Type | Description |
|---|---|---|
| move | Move | Any instantiated subclass of Move. |
The proposed change was beneficial. Make the same move on the current model as was made to the proposed model.
| Parameter | Type | Description |
|---|---|---|
| move | Move | Any instantiated subclass of Move. |
Grab the proposed model.
Generate an initial state by 1) simulating a network 2) building a model based on that network and some input data. Currently only in use for the simplest case, a DNA/Felsenstein model.
| Parameter | Type | Description |
|---|---|---|
| data | Matrix | The nexus file data that has been preprocessed by the Matrix class. |
| submodel | GTR | Any substitution model (can be subtype of GTR) |
Accumulate log output by appending line to the end of the current string. 'line' need not be new line terminated.
| Parameter | Type | Description |
|---|---|---|
| line | str | logging information, plain text. |
Check certain conditions on a network to check for validity.
| Parameter | Type | Description |
|---|---|---|
| prev_move | Move | the move obj that was imposed on the current model |
Checks the Model's network for cycles.
| Parameter | Type | Description |
|---|---|---|
| model | Model | A Model with a phylogenetic network. |