phylox.rearrangement.move.apply_move
- phylox.rearrangement.move.apply_move(network, move)
Apply a move to the network, not in place. returns True if successful, and False otherwise.
- Parameters:
network – a phylogenetic network (phylox.DiNetwork).
move – a move (phylox.rearrangement.move.Move) to apply to the network.
- Returns:
a new phylogenetic network (phylox.DiNetwork) with the move applied.
- Example:
>>> from phylox import DiNetwork >>> from phylox.rearrangement.move import apply_move, Move >>> network = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,3),(2,4),(3,5)], ... ) >>> move = Move( ... move_type=MoveType.HEAD, ... origin=(2,5), ... moving_edge=(1,3), ... target=(2,4), ... ) >>> new_network = apply_move(network, move) >>> edges = set(new_network.edges()) >>> edges == {(0, 1), (1, 2), (1, 3), (2, 3), (3, 4), (2, 5)} True