alifestd_downsample_tips_clade_polars
- alifestd_downsample_tips_clade_polars(phylogeny_df: DataFrame, n_downsample: int, seed: int | None = None) DataFrame
Create a subsample phylogeny containing at most n_downsample tips, comprising a single clade within the original phylogeny. Candidate clades are sampled proportionally to their size.
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 or if ids are non-contiguous or not topologically sorted.
Returns
- polars.DataFrame
The downsampled phylogeny in alife standard format.
See Also
- alifestd_downsample_tips_clade_asexual :
Pandas-based implementation.