phylo2vec.utils.newick.create_label_mapping#
- phylo2vec.utils.newick.create_label_mapping(newick)[source]#
Create an integer-taxon label mapping (label_mapping) from a string-based newick (where leaves are strings) and produce a mapped integer-based newick (where leaves are integers) this also remove annotations pertaining to parent nodes
- Parameters:
newick (str) – Newick with string labels
- Returns:
newick_int (str) – Newick with integer labels
label_mapping (Dict[int, str]) – Mapping of leaf labels (as integers) to taxa