alifestd_mark_sample_tips_uniform_polars

alifestd_mark_sample_tips_uniform_polars(phylogeny_df: DataFrame, n_sample: int, seed: int | None = None, *, mark_as: str = 'alifestd_mark_sample_tips_uniform_polars') DataFrame

Mark a random subsample of n_sample tips.

Adds a boolean column mark_as indicating retained tips.

If n_sample is greater than the number of tips in the phylogeny, all tips are marked.

Only supports asexual phylogenies.

Parameters

phylogeny_dfpolars.DataFrame

The phylogeny as a dataframe in alife standard format.

Must represent an asexual phylogeny.

n_sampleint

Number of tips to mark.

seedint, optional

Integer seed for deterministic behavior.

mark_asstr, default “alifestd_mark_sample_tips_uniform_polars”

Column name for the boolean mark.

Raises

NotImplementedError

If phylogeny_df has no “ancestor_id” column.

Returns

polars.DataFrame

The phylogeny with an added boolean mark column.

See Also

alifestd_mark_sample_tips_uniform_asexual :

Pandas-based implementation.