alifestd_mark_sample_tips_lineage_stratified_asexual
- alifestd_mark_sample_tips_lineage_stratified_asexual(phylogeny_df: ~pandas.core.frame.DataFrame, n_sample: int | None = None, mutate: bool = False, seed: int | None = None, *, criterion_delta: str = 'origin_time', criterion_stratify: str = 'origin_time', criterion_target: str = 'origin_time', n_tips_per_stratum: int = 1, progress_wrap: ~typing.Callable = <function <lambda>>, mark_as: str = 'alifestd_mark_sample_tips_lineage_stratified_asexual') DataFrame
Mark leaves per stratified group, chosen by proximity to the lineage of a target leaf.
Adds a boolean column
mark_asindicating retained tips.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
Desired number of retained tips. If
None, every distinctcriterion_stratifyvalue forms its own group.- mutatebool, default False
Are side effects on the input argument phylogeny_df allowed?
- seedint, optional
Random seed for reproducible target-leaf selection.
- criterion_deltastr, default “origin_time”
Column name used to compute the off-lineage delta for each leaf.
- criterion_stratifystr, default “origin_time”
Column name used to stratify leaves into groups.
- criterion_targetstr, default “origin_time”
Column name used to select the target leaf.
- n_tips_per_stratumint, default 1
Number of tips to retain per stratified group.
- progress_wrapCallable, optional
Pass tqdm or equivalent to display a progress bar.
- mark_asstr, default “alifestd_mark_sample_tips_lineage_stratified_asexual”
Column name for the boolean mark.
Raises
- ValueError
If criterion_delta, criterion_stratify, or criterion_target is not a column in phylogeny_df.
- ValueError
If
n_sampleis notNoneandn_tips_per_stratumdoes not evenly dividen_sample.
Returns
- pandas.DataFrame
The phylogeny with an added boolean mark column.