alifestd_screen_trait_defined_clades_naive_asexual

alifestd_screen_trait_defined_clades_naive_asexual(phylogeny_df: DataFrame, mutate: bool = False, *, mask_trait_absent: ndarray, mask_trait_present: ndarray, defining_mut_thresh: float = 0.75, defining_mut_sister_thresh: float = 0.75) ndarray

Perform a naive screen for trait-defined clades.

This function checks if the trait frequency in a clade is above a certain threshold (defining_mut_thresh), and if the trait frequency in the sister clade is below a certain threshold (defining_mut_sister_thresh). Clades are defined as a node and all descendant nodes.

The mask_trait_absent parameter can be used to exclude nodes from consideration, for instance &’ing with alifestd_mark_leaves can be used to only consider trait frequency among descendant leaves.

Returns a numpy array of bool with the same length as the input DataFrame, with array elements as the number of nodes in the clade that have the trait. Returned array matches row order of the input DataFrame.