class Constraints(taxNames, constraintTree)[source]

A container for tree topology constraints.


A list of taxNames in the same order as in the data or alignment, and the same order as in other tree or trees objects.


A partially resolved tree object that describes the constraints. You need to include all the taxNames.

For example:

tNames = ['A', 'B', 'C', 'D', 'E']
read('(A, B, (E, D), C);')
constTree = var.trees.pop()
c = Constraints(tNames, constTree)
t = p4.func.randomTree(taxNames=tName, constraints=c)

You can pass a Constraints object to p4.func.randomTree() and Mcmc() to enforce constraints.