alifestd_calc_mrca_id_vector_asexual_polars

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

Calculate the Most Recent Common Ancestor (MRCA) taxon id for target_id and each other taxon.

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).

target_idint

The target organism id to compute MRCA against.

progress_wrapcallable, optional

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

Returns

numpy.ndarray

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

See Also

alifestd_calc_mrca_id_vector_asexual :

Pandas-based implementation.