alifestd_mark_colless_index_corrected_asexual

alifestd_mark_colless_index_corrected_asexual(phylogeny_df: DataFrame, mutate: bool = False, *, mark_as: str = 'colless_index_corrected') DataFrame

Add column colless_index_corrected with the corrected Colless index for each subtree.

The output column name can be changed via the mark_as parameter.

The corrected Colless index IC(T) normalizes the Colless index by tree size. For a subtree with n leaves:

IC(T) = 0 if n <= 2 IC(T) = 2 * C(T) / ((n-1)*(n-2)) if n > 2

where C(T) is the Colless index of the subtree.

This function delegates to alifestd_mark_colless_index_asexual to compute the Colless index, and therefore requires strictly bifurcating trees.

Raises ValueError if the tree is not strictly bifurcating. For trees with polytomies, consider computing the generalized Colless index and normalizing separately.

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.

Parameters

phylogeny_dfpd.DataFrame

Alife standard DataFrame containing the phylogenetic relationships.

mutatebool, optional

If True, modify the input DataFrame in place. Default is False.

Returns

pd.DataFrame

Phylogeny DataFrame with an additional column “colless_index_corrected” containing the corrected Colless imbalance index for the subtree rooted at each node.

Raises

ValueError

If phylogeny_df is not strictly bifurcating.

See Also

alifestd_mark_colless_index_asexual :

Unnormalized Colless index for strictly bifurcating trees.

alifestd_mark_colless_like_index_mdm_asexual :

Colless-like index (MDM) that supports polytomies.

alifestd_mark_colless_like_index_var_asexual :

Colless-like index (variance) that supports polytomies.

alifestd_mark_colless_like_index_sd_asexual :

Colless-like index (std dev) that supports polytomies.