alifestd_calc_mrca_id_matrix_asexual_polars

alifestd_calc_mrca_id_matrix_asexual_polars(phylogeny_df: ~polars.dataframe.frame.DataFrame, *, progress_wrap: ~typing.Callable = <function <lambda>>) ndarray

Calculate the Most Recent Common Ancestor (MRCA) taxon id for each pair of taxa.

Taxa sharing no common ancestor will have MRCA id -1.

Parameters

phylogeny_dfpolars.DataFrame or polars.LazyFrame

The phylogeny as a dataframe in alife standard format.

Must represent an asexual phylogeny in working format (i.e., topologically sorted with contiguous ids and an ancestor_id column, or an ancestor_list column from which ancestor_id can be derived).

progress_wrapcallable, optional

Wrapper for progress display (e.g., tqdm).

Returns

numpy.ndarray

Array of shape (n, n) with dtype int64, containing MRCA ids for each pair of organisms. Entries are -1 where organisms share no common ancestor.

See Also

alifestd_calc_mrca_id_matrix_asexual :

Pandas-based implementation.