alifestd_reroot_at_id_asexual

alifestd_reroot_at_id_asexual(phylogeny_df: DataFrame, new_root_id: int, mutate: bool = False) DataFrame

Reroot phylogeny, preserving topology.

Reverses the descendant-to-ancestor relationships of all ancestors of the new root. Does not update branch_lengths or edge_lengths columns if present.

Parameters

phylogeny_dfpandas.DataFrame

The phylogeny as a dataframe in alife standard format.

Must represent an asexual phylogeny.

new_root_idint

The ID of the node to use as the new root of the phylogeny.

mutatebool, default False

Are side effects on the input argument phylogeny_df allowed?

Returns

pandas.DataFrame

The rerooted phylogeny in alife standard format.