phylox.rearrangement.move.apply_move_sequence
- phylox.rearrangement.move.apply_move_sequence(network, seq_moves)
Apply a sequence of moves to the network, not in place. returns the resulting network.
- Parameters:
network – a phylogenetic network (phylox.DiNetwork).
seq_moves – a sequence of moves (list of phylox.rearrangement.move.Move) to apply to the network.
- Returns:
a new phylogenetic network (phylox.DiNetwork) with the moves applied.
- Example:
>>> from phylox import DiNetwork >>> from phylox.rearrangement.move import apply_move_sequence, Move >>> network = DiNetwork( ... edges=[(0,1),(1,2),(1,3),(2,4),(2,5),(3,6),(3,7)], ... ) >>> seq_moves = [ ... Move( ... move_type=MoveType.TAIL, ... moving_edge=(3,6), ... target=(0,1), ... origin=(1,7), ... ), ... Move( ... move_type=MoveType.VPLU, ... start_edge=(1,2), ... end_edge=(1,7), ... network=network, ... ), ... ] >>> new_network = apply_move_sequence(network, seq_moves) >>> edges = set(new_network.edges()) >>> edges == {(0, 3), (3, 1), (1, -1), (-1, 2), (1, -2), (-2, 7), (2, 4), (2, 5), (3, 6), (-1, -2)} True