alifestd_ladderize_asexual
- alifestd_ladderize_asexual(phylogeny_df: DataFrame, reverse: bool = False, mutate: bool = False) DataFrame
Reorder rows so children are sorted by number of descendant leaves, gathering children into contiguous rows.
By default, subtrees with fewer leaves come first (ascending). Set
reverse=Trueto sort descending (more leaves first).A topological sort will be applied if phylogeny_df is not topologically sorted. Dataframe reindexing (e.g., df.index) may be applied.
Input dataframe is not mutated by this operation unless mutate set True. If mutate set True, operation does not occur in place; still use return value to get transformed phylogeny dataframe.
Note: after ladderizing, ids will no longer be contiguous with respect to row indices. Call
alifestd_assign_contiguous_idson the result to reassign contiguous ids if needed.