alifestd_calc_clade_lookback_n_asexual

alifestd_calc_clade_lookback_n_asexual(phylogeny_df: DataFrame, lookback_n: int, mutate: bool = False) ndarray

Find ancestor ids of nodes that are lookback_n nodes away in the phylogeny.

The root node will be returned if the lookback distance exceeds available nodes.

Returns a numpy array of the same length as the input DataFrame, with array elements as the number of nodes in the clade that have the trait. Returned array matches row order of the input DataFrame.