cassiopeia.tl.fitch_hartigan#
- cassiopeia.tl.fitch_hartigan(cassiopeia_tree, meta_item, root=None, state_key='S1', label_key='label', copy=False)[source]#
Run the Fitch-Hartigan algorithm.
Performs the full Fitch-Hartigan small parsimony algorithm which, given a set of states for the leaves, infers the most-parsimonious set of states and returns a random solution that satisfies the maximum-parsimony criterion. The solution will be stored in the label key specified by the user (by default ‘label’). This function will modify the tree in place if copy=False.
- Parameters:
- cassiopeia_tree
CassiopeiaTree
CassiopeiaTree that has been processed with the Fitch-Hartigan bottom-up algorithm.
- meta_item
str
A column in the CassiopeiaTree cell meta corresponding to a categorical variable.
- root
Optional
[str
] (default:None
) Root from which to begin this refinement. Only the subtree below this node will be considered.
- state_key
str
(default:'S1'
) Attribute key that stores the Fitch-Hartigan ancestral states.
- label_key
str
(default:'label'
) Key to add that stores the maximum-parsimony assignment inferred from the Fitch-Hartigan top-down refinement.
- copy
bool
(default:False
) Modify the tree in place or not.
- cassiopeia_tree
- Return type:
- Returns:
A new CassiopeiaTree if the copy is set to True, else None.