alifestd_calc_distance_matrix_asexual

alifestd_calc_distance_matrix_asexual(phylogeny_df: ~pandas.core.frame.DataFrame, mutate: bool = False, *, criterion: str = 'origin_time', progress_wrap: ~typing.Callable = <function <lambda>>) ndarray

Calculate pairwise distances between all taxa via their MRCAs.

The distance between two taxa is computed as the sum of criterion differences between each taxon and their Most Recent Common Ancestor (MRCA):

distance[i, j] = (criterion[i] - criterion[mrca])
  • (criterion[j] - criterion[mrca])

Taxa sharing no common ancestor will have distance NaN.

Pass tqdm or equivalent as progress_wrap to display a progress bar.

Input dataframe is not mutated by this operation unless mutate set True.

Parameters

phylogeny_dfpd.DataFrame

Phylogeny in alife standard format.

mutatebool, default False

If True, allows in-place modification of phylogeny_df.

criterionstr, default “origin_time”

Column name used to measure distance between taxa and their MRCA.

progress_wrapcallable, optional

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

Returns

np.ndarray

n x n float64 matrix of pairwise distances. Entry [i, j] is NaN when organisms i and j share no common ancestor.

See Also

alifestd_calc_mrca_id_matrix_asexual :

Computes the MRCA id matrix used internally by this function.

alifestd_find_pair_distance_asexual :

Computes distance for a single pair of taxa.