cassiopeia.data.get_lca_characters#

cassiopeia.data.get_lca_characters(vecs, missing_state_indicator)[source]#

Builds the character vector of the LCA of a list of character vectors, obeying Camin-Sokal Parsimony.

For each index in the reconstructed vector, imputes the non-missing character if only one of the constituent vectors has a missing value at that index, and imputes missing value if all have a missing value at that index.

Importantly, this method will infer ancestral characters for an ambiguous state. If the intersection between two states (even ambiguous) is non-zero and not the missing state, and has length exactly 1, we assign the ancestral state this value. Else, if the intersection length is greater than 1, the value ‘0’ is assigned.

Parameters:
vecs List[Union[List[int], List[Tuple[int, ...]]]]

A list of character vectors to generate an LCA for

missing_state_indicator int

The character representing missing values

Return type:

List[int]

Returns:

A list representing the character vector of the LCA