PhyNetPy Documentation

Library for the Development and Use of Phylogenetic Network Methods

NetworkMoves Module v1.0.0

Network topology modification operations for MCMC search (add/remove hybrid, NNI, node height).

Author:
Mark Kessler
Source:
NetworkMoves.py

Contents

Module Functions

add_hybrid(net: Network, source: Edge, destination: Edge, t_src: float = None, t_dest: float = None) -> None

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.
remove_hybrid(net: Network, hybrid_edge: Edge) -> None

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.
nni(net: Network) -> None

Perform a nearest neighbor interchange (NNI) on the network.

Parameter Type Description
net Network A network.
node_height_change(n: Node, net: Network, height: float, extend: bool = False) -> None

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.

Navigation

Modules

This Page