alifestd_screen_trait_defined_clades_fisher_asexual

alifestd_screen_trait_defined_clades_fisher_asexual(phylogeny_df: DataFrame, mutate: bool = False, *, mask_trait_absent: ndarray, mask_trait_present: ndarray) ndarray

Perform a screen for trait-defined clades based on Fisher’s exact test.

This function computes a Fisher’s exact test comparing the trait frequency (number of clade members with the trait, number of clade members without the trait) in a clade with its sister clade. Returned values are one-tailed p-values for the hypothesis that the trait frequency in the clade is greater than in the sister clade.

Root clades will be compared to themselves, as they have no sister clade. As such, root clades will take on p-values > 0.5.

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.