partition Module

This module defines the Partition() class, which indicates a particular evolutionary unit.

class partition.Partition(**kwargs)

Required keyword arguments:

  1. size, integer giving the root length of this partition (only required when no root sequence is given)
  2. 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:

  1. root_sequence, a string giving the ancestral sequence for this partition. Note that, when provided, the size argument is not needed.
  2. 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.
>>> # 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 =       

Return True if the partition uses branch heterogeneity, and False if homogeneous.


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.


Return True if the partition is evolving with dN/dS heterogeneity, and False otherwise.