Library for the Development and Use of Phylogenetic Network Methods
Network topology modification operations for MCMC search (add/remove hybrid, NNI, node height).
Add a hybrid (reticulation) edge between *source* and *destination*. Two new internal nodes are inserted -- one splitting *source* and one splitting *destination* -- and a directed edge is created from the source-side node to the destination-side node (which is marked as a reticulation). If *source* and *destination* are the same edge, a bubble (parallel pair of edges) is created instead.
| Parameter | Type | Description |
|---|---|---|
| net | The network to modify in place. | |
| source | The edge on which to place the new outgoing node. | |
| destination | The edge on which to place the new reticulation node. | |
| t_src | Optional time at which to place the source-side node. | |
| t_dest | Optional time at which to place the destination-side node. |
Removes a hybrid edge from a network. src: dest: a x | | | | | | v v n1- - - - - - - - ->n2 | | | | v v b y
| Parameter | Type | Description |
|---|---|---|
| net | Network | A network. |
| hybrid_edge | Edge | An edge in E, whose destination node is a reticulation node. |
Perform a nearest neighbor interchange (NNI) on the network.
| Parameter | Type | Description |
|---|---|---|
| net | Network | A network. |
Alter the node height of a node in a network, without altering the node heights of any surrounding nodes (parents, children). A node height can be moved up or down within the range min child height < new h < max parent height (refer to assumptions.txt). It is an error to attempt to move a node outside of these bounds -- the operation will abort and no changes to the network will be made. If extend is set (True), then the subtree branch lengths will be retained instead of altered. The new height of 'n', then, must not be closer to the root than the parent of 'n' whose height is furthest from the root. Attempting this is an error -- the operation will abort and no changes to the network will be made.
| Parameter | Type | Description |
|---|---|---|
| n | Node | A node whose height needs to be changed. |
| net | Network | The network that contains node n. |
| height | float | The new height of node n. |
| extend | bool, optional | Flag to retain subtree branch lengths. Defaults to False. |