alifestd_downsample_tips_canopy_asexual
- alifestd_downsample_tips_canopy_asexual(phylogeny_df: DataFrame, n_downsample: int | None = None, mutate: bool = False, criterion: str = 'origin_time') DataFrame
Retain the n_downsample leaves with the largest criterion values and prune extinct lineages.
If n_downsample is
None, it defaults to the number of leaves that share the maximum value of the criterion column. If n_downsample is greater than or equal to the number of leaves in the phylogeny, the whole phylogeny is returned. Ties are broken arbitrarily.Only supports asexual phylogenies.
Parameters
- phylogeny_dfpandas.DataFrame
The phylogeny as a dataframe in alife standard format.
Must represent an asexual phylogeny.
- n_downsampleint, optional
Number of tips to retain. If
None, defaults to the count of leaves with the maximum criterion value.- mutatebool, default False
Are side effects on the input argument phylogeny_df allowed?
- criterionstr, default “origin_time”
Column name used to rank leaves. The n_downsample leaves with the largest values in this column are retained. Ties are broken arbitrarily.
Raises
- ValueError
If criterion is not a column in phylogeny_df.
Returns
- pandas.DataFrame
The pruned phylogeny in alife standard format.