alifestd_calc_clade_trait_frequency_asexual
- alifestd_calc_clade_trait_frequency_asexual(phylogeny_df: DataFrame, mutate: bool = False, *, mask_trait_absent: ndarray, mask_trait_present: ndarray) ndarray
Calculate what fraction of nodes within each clade have a given trait.
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 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.