partition
Module¶
This module defines the Partition() class, which indicates a particular evolutionary unit.
-
class
partition.
Partition
(**kwargs)¶ Required keyword arguments:
- size, integer giving the root length of this partition (only required when no root sequence is given)
- models (or model), either a single Model object (for cases of branch homogeneity), or a list of Model objects (for cases of branch heterogeneity).
Optional keyword arguments:
- root_sequence, a string giving the ancestral sequence for this partition. Note that, when provided, the size argument is not needed.
- root_model_name, the name attribute of the model to be used at the root of the phylogeny. Applicable only to cases of branch heterogeneity.
- Examples:
>>> # Define a temporally homogeneous partition >>> my_partition = Partition(models = my_model, size = 500) >>> # Define a temporally heterogeneous partition, in which three models (model1, model2, and rootmodel) are used during sequence evolution, and rootmodel is the model at the root of the tree >>> my_other_partition = Partition(models = [model1, model2, rootmodel], size = 134, root_model_name = rootmodel.name)
-
branch_het
()¶ Return True if the partition uses branch heterogeneity, and False if homogeneous.
-
site_het
()¶ Return True if the partition uses site/rate heterogeneity, and False if homogeneous. Also returns False if an MRCA has been provided, as we do not support rate heterogeneity in this case.
-
is_codon_model
()¶ Return True if the partition is evolving with dN/dS heterogeneity, and False otherwise.