alifestd_from_newick_polars
- alifestd_from_newick_polars(newick: str, *, branch_length_dtype: type = <class 'float'>, create_ancestor_list: bool = False, dtype_id: ~polars.datatypes.classes.DataType | None = Int64) DataFrame
Convert a Newick format string to a phylogeny dataframe.
Parses a Newick tree string and returns a polars DataFrame in alife standard format with columns: id, ancestor_id, taxon_label, origin_time_delta, and branch_length. Optionally includes ancestor_list.
Parameters
- newickstr
A phylogeny in Newick format.
- branch_length_dtypetype, default float
Dtype for branch length values. Use
intto get nullable integer columns (pl.Int64). Missing branch lengths will benullfor integer dtypes orNaNfor float dtypes.- create_ancestor_listbool, default False
If True, include an
ancestor_listcolumn in the result.- dtype_idpl.DataType or None, default pl.Int64
Polars dtype for the
idandancestor_idcolumns. If None, the smallest signed integer dtype is chosen automatically based on the number of commas in the Newick string.
Returns
- pl.DataFrame
Phylogeny dataframe in alife standard format.
See Also
- alifestd_from_newick :
Pandas-based implementation.
- alifestd_as_newick_asexual :
Inverse conversion, from alife standard to Newick format.