cassiopeia.tl.score_small_parsimony#

cassiopeia.tl.score_small_parsimony(cassiopeia_tree, meta_item, root=None, infer_ancestral_states=True, label_key='label')[source]#

Computes the small-parsimony of the tree.

Using the meta data stored in the specified cell meta column, compute the parsimony score of the tree.

Parameters:
cassiopeia_tree CassiopeiaTree

CassiopeiaTree object with cell meta data.

meta_item str

A column in the CassiopeiaTree cell meta corresponding to a categorical variable.

root str | NoneOptional[str] (default: None)

Node to treat as the root. Only the subtree below this node will be considered.

infer_ancestral_states bool (default: True)

Whether or not ancestral states must be inferred (this will be False if fitch_hartigan has already been called on the tree.)

label_key str | NoneOptional[str] (default: 'label')

If ancestral states have already been inferred, this key indicates the name of the attribute they’re stored in.

Return type:

int

Returns:

The parsimony score.

Raises:

CassiopeiaError if label_key has not been populated.