phylo2vec.utils.newick.apply_label_mapping

phylo2vec.utils.newick.apply_label_mapping#

phylo2vec.utils.newick.apply_label_mapping(newick, label_mapping)[source]#

Apply 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)

Parameters:
  • newick (str) – Newick with integer labels

  • label_mapping (Dict[int, str]) – Mapping of leaf labels (as integers) to taxa

Returns:

newick – Newick with string labels

Return type:

str