Library for the Development and Use of Phylogenetic Network Methods
Network topology move operations for MCMC search (add/remove/flip reticulation, SPR).
This exception is raised whenever there is a fatal error in executing a network move.
Abstract superclass for all model move types. A move can be executed on a model that is passed in, and edits an aspect of the model.
Moves in general do not require any parameters
| Parameter | Type | Description |
|---|---|---|
| model | Model | A Model obj |
A function that will undo what "execute" did.
| Parameter | Type | Description |
|---|---|---|
| model | Model | A phylogenetic network model object. |
Applies the exact move as execute, on a different but identical (with respect to topology) Model object to a model that has had "execute" called on it.
| Parameter | Type | Description |
|---|---|---|
| model | Model | A phylogenetic network model obj. |
Returns the hastings-ratio for a move-- that is the ratio of valid states to return to post-move, to the number of valid states to transition to pre-move.
A move that adds a reticulation to a network.
Initializes a move that adds a reticulation to a network.
Adds a reticulation to a network.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Undoes the addition of a reticulation to a network.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Applies the same addition of a reticulation to another model.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Returns the Hastings ratio for the addition move.
A move that removes a reticulation from a network.
Initializes a move that removes a reticulation from a network.
A move that flips the direction of a reticulation edge.
Initializes a move that flips the direction of a reticulation edge.
Removes a reticulation edge from the network
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Undoes the flipping of the reticulation edge.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Applies the same flipping of the reticulation edge to another model.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Return the hastings ratio for this move
For use in Infer_MP_Allop, this move alters the genetic parentage of an entire subnetwork, while maintaining the same ploidy values for each leaf.
Initializes a move that switches the parentage of a subnetwork.
| Parameter | Type | Description |
|---|---|---|
| debug_id | int | The debug id for the move. |
Selects a random object from a list.
| Parameter | Type | Description |
|---|---|---|
| mylist | list | The list of objects to select from. |
| rng | np.random.Generator | The random number generator. |
Executes the Swap-Parentage Move.
| Parameter | Type | Description |
|---|---|---|
| model | Model | A model object, for which there must be a populated network field |
Undoes the Swap-Parentage Move
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Executes the same topology change on another model
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Returns the Hastings ratio for the Swap-Parentage Move.
Deletes an edge from the network.
| Parameter | Type | Description |
|---|---|---|
| net | Network | The network object. |
| edge | Edge | The edge to delete. |
A move that performs a Subtree Prune and Regraft operation on a network.
Initializes a move that performs a Subtree Prune and Regraft operation.
| Parameter | Type | Description |
|---|---|---|
| debug_id | int | The debug id for the move. |
Selects a random object from a list.
| Parameter | Type | Description |
|---|---|---|
| mylist | list | The list of objects to select from. |
| rng | np.random.Generator | The random number generator. |
Executes the Subtree Prune and Regraft move.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Undoes the Subtree Prune and Regraft move.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Perform the same Subtree Prune and Regraft move on another model.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model object containing the network. |
Returns the Hastings ratio for the Subtree Prune and Regraft move.
Given an edge, a -> b, place a node c, such that a -> c -> b. This requires the deletion of edge a -> b, then the addition of edges a -> c and c -> b.
| Parameter | Type | Description |
|---|---|---|
| edge | Edge | An edge, a -> b |
| node | Node | A node, c. |
| net | Network | The network that contains nodes a, b, and c |
Given two nodes in a network, connect them and check whether or not a reticulation is created.
| Parameter | Type | Description |
|---|---|---|
| src | Node | The parent of the new edge |
| dest | Node | The child of the new edge |
| net | Network | Network for which to add the edge |