alifestd_mark_sample_tips_canopy_asexual

alifestd_mark_sample_tips_canopy_asexual(phylogeny_df: DataFrame, n_sample: int | None = None, mutate: bool = False, criterion: str = 'origin_time', *, mark_as: str = 'alifestd_mark_sample_tips_canopy_asexual') DataFrame

Mark the n_sample leaves with the largest criterion values.

Adds a boolean column mark_as indicating retained tips.

If n_sample is None, it defaults to the number of leaves that share the maximum value of the criterion column. If n_sample is greater than or equal to the number of leaves in the phylogeny, all leaves are marked. 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_sampleint, optional

Number of tips to mark. 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_sample leaves with the largest values in this column are marked. Ties are broken arbitrarily.

mark_asstr, default “alifestd_mark_sample_tips_canopy_asexual”

Column name for the boolean mark.

Raises

ValueError

If criterion is not a column in phylogeny_df.

Returns

pandas.DataFrame

The phylogeny with an added boolean mark column.