Library for the Development and Use of Phylogenetic Network Methods
Probabilistic graphical model for phylogenetics with typed model nodes and visitor pattern support.
Class to handle any errors related to building the model or running likelihoods computations on the model.
Class that implements a version of probabilistic graphical modeling, for phylogenetics. Generally, it is made up of a network, along with various parameters and components that are attached to the model in order to compute either a model likelihood or simulate data over a set of model parameters.
Initialize a model object.
Returns the root node of the model.
The operator move has asked for permission to work on this model. Pass the move this model and get the model that is the result of the operation on this model.
| Parameter | Type | Description |
|---|---|---|
| move | Move | A concrete subclass instance of Move. |
Writes summary of calculations to a file, and gets the current state of the model and creates a network obj so that the newick format can be output.
| Parameter | Type | Description |
|---|---|---|
| tree_filename | str | A string that is the name of the file to output a newick string to. If the filename does not |
| exist | a new file will be created in the directory in which one is operating in. | |
| summary_filename | str | A string that is the name of the file to output logging information. If the filename does not exist, a new file will be created in the current directory. |
Class that defines the graphical structure and shared interactions between any node in the Model.
Initialize a ModelNode object.
| Parameter | Type | Description |
|---|---|---|
| children | list, optional | Children of this node. Defaults to None. |
| parents | list, optional | Parents of this node. Defaults to None. |
| node_type | str, optional | A string that describes the type of node. |
Adds a successor to this node.
| Parameter | Type | Description |
|---|---|---|
| model_node | ModelNode | A ModelNode to add as a child. |
Adds a predecessor to this node.
| Parameter | Type | Description |
|---|---|---|
| model_node | ModelNode | A ModelNode to add as a parent. |
Adds other_node as a parent, and adds this node as a child of other_node.
| Parameter | Type | Description |
|---|---|---|
| other_node | ModelNode | A ModelNode to join this ModelNode to. |
Removes other_node as a parent, and removes this node as a child of other_node.
| Parameter | Type | Description |
|---|---|---|
| other_node | ModelNode | A ModelNode to unjoin this ModelNode from. |
Removes a child to this node.
| Parameter | Type | Description |
|---|---|---|
| model_node | ModelNode | A ModelNode to remove as a child. |
Removes a parent to this node.
| Parameter | Type | Description |
|---|---|---|
| model_node | ModelNode | A ModelNode to remove as a parent. |
Get the parent nodes to this node, but only the ModelNodes.
| Parameter | Type | Description |
|---|---|---|
| of_type | type, optional | A type to filter the parent nodes by. |
Get the children nodes to this node, but only the ModelNodes.
| Parameter | Type | Description |
|---|---|---|
| of_type | type, optional | A type to filter the child nodes by. |
Calculates the in degree of the current node (ie number of parents) If 0, this node is a root of the Model.
Calculates the out degree of the current node (ie number of children) If 0, this node is a leaf.
Get the type of this node.
Accept a visitor and return the result of the visit.
| Parameter | Type | Description |
|---|---|---|
| visitor | ModelVisitor | A visitor to visit this node. |
A leaf node in the model graph.
Initialize a LeafNode object.
| Parameter | Type | Description |
|---|---|---|
| name | str | The name of this leaf node. |
Returns the number of samples for this leaf node.
Returns the name of this leaf node.
Returns information about the branch associated with this leaf node. Since it is a leaf node, there must be exactly one network parent and thus only one branch
Set the branch length of the branch associated with this leaf node.
| Parameter | Type | Description |
|---|---|---|
| branch_length | float | The new branch length. |
Set the data for this leaf node.
An internal node in the model graph.
Initialize an InternalNode object.
| Parameter | Type | Description |
|---|---|---|
| branch_length | Branch, optional | The branch associated with this internal node. Defaults to a new Branch object. |
Returns information about the branch associated with this internal node. Since it is a internal node, there must be exactly one network parent and thus only one branch
Set the branch length of the branch associated with this leaf node.
| Parameter | Type | Description |
|---|---|---|
| branch_length | float | The new branch length. |
Returns the name of this leaf node.
A reticulation node in the model graph.
Initialize a ReticulationNode object.
| Parameter | Type | Description |
|---|---|---|
| branch_1 | Branch, optional | The first branch. Defaults to 0.5. |
| branch_2 | Branch, optional | The second branch. Defaults to 0.5. |
Returns the name of this leaf node.
Returns information about the branch associated with this reticulation node. Since it is a reticulation node, there must be exactly two network parents and thus two branches
Set the branch length and inheritance probability of the branch associated with this reticulation node.
| Parameter | Type | Description |
|---|---|---|
| parent_id | str | The id of the parent node. |
| branch_length | float, optional | The new branch length. Defaults to None. |
| inheritance_probability | float, optional | The new inheritance probability. Defaults to None. |
A root node in the model graph.
Initialize a RootNode object.
Returns the name of this leaf node.
A root aggregator node in the model graph.
Initialize a RootAggregatorNode object.
Returns the name of this leaf node.
Returns the result of this root aggregator node.
Convert an array of integers into a binary array of bits.
| Parameter | Type | Description |
|---|---|---|
| arr | np.array | Numpy array of positive integers |
| m | int | Number of bits of each integer to retain (ie DNA, 4) |