phylox.generators.randomTC.random_tc_network
- phylox.generators.randomTC.random_tc_network.random_tree_child_sequence(leaves, reticulations, seed=None)
Returns a random tree-child sequence with a given number of leaves and reticulations :param leaves: number of leaves :param reticulations: number of reticulations :param seed: seed for the random number generator :return: a random tree-child sequence
- Example:
>>> from phylox.generators.randomTC.random_tc_network import random_tree_child_sequence >>> seq = random_tree_child_sequence(5, 2) >>> len(seq) 6
- phylox.generators.randomTC.random_tc_network.random_tree_child_subsequence(seq, r, seed=None)
Returns a random tree-child subsequence with a given number of reticulations :param seq: a tree-child sequence :param r: number of reticulations in the subsequence :param seed: seed for the random number generator :return: a random tree-child subsequence
- Example:
>>> from phylox.generators.randomTC.random_tc_network import random_tree_child_subsequence >>> seq = [(4,1), (4, 1), (3, 1), (2, 1), (2, 1), (2,1)] >>> newSeq = random_tree_child_subsequence(seq, 1) >>> len(newSeq) 4
- phylox.generators.randomTC.random_tc_network.generate_network_random_tree_child_sequence(leaves, reticulations, label_leaves=True, seed=None)
Returns a random tree-child network with a given number of leaves and reticulations :param leaves: number of leaves :param reticulations: number of reticulations :param label_leaves: whether to label the leaves :return: a random tree-child network
- Example:
>>> from phylox.generators.randomTC.random_tc_network import generate_network_random_tree_child_sequence >>> network = generate_network_random_tree_child_sequence(5, 2) >>> len(network.leaves) 5 >>> network.reticulation_number 2