mrp¶
A couple of functions for the supertree method MRP, Matrix Representation (for? with?) Parsimony
See also p4.alignment.Alignment.mrpSlice()
-
mrp
(trees, taxNames=None)[source]¶ Code a list of trees with matrix representation.
The input should be a list of p4 Tree objects.
The argument ‘taxNames’ need not be supplied, but you can if you want to.
This returns an alignment, with a character set for each input tree.
For example, you might say:
read('myTrees.phy') a = mrp(var.trees) a.writeNexus('a.nex')
-
reverseMrp
(alignment)[source]¶ Reconstruct trees from a matrix representation.
This needs character sets, one for each tree.
You might say:
read('a.nex') # read the matrix representation in a = var.alignments[0] # give the alignment a name a.setNexusSets() # apply var.nexusSets to the alignment tt = reverseMrp(a) # the function returns a list of tree objects for t in tt: t.write()