alifestd_downsample_tips_uniform_polars

alifestd_downsample_tips_uniform_polars(phylogeny_df: DataFrame, n_downsample: int, seed: int | None = None) DataFrame

Create a subsample phylogeny containing n_downsample tips.

If n_downsample is greater than the number of tips in the phylogeny, the whole phylogeny is returned.

Only supports asexual phylogenies.

Parameters

phylogeny_dfpolars.DataFrame

The phylogeny as a dataframe in alife standard format.

Must represent an asexual phylogeny.

n_downsampleint

Number of tips to retain.

seedint, optional

Integer seed for deterministic behavior.

Raises

NotImplementedError

If phylogeny_df has no “ancestor_id” column.

Returns

polars.DataFrame

The downsampled phylogeny in alife standard format.

See Also

alifestd_downsample_tips_uniform_asexual :

Pandas-based implementation.