ivy.newick module

Parse newick strings.

The function of interest is parse, which returns the root node of the parsed tree.

class ivy.newick.Tokenizer(infile)[source]

Bases: shlex.shlex

Provides tokens for parsing newick strings.

parse_embedded_comment()[source]
ivy.newick.add_label_chars(chars)[source]
ivy.newick.nexus_iter(infile)[source]
ivy.newick.parse(data, ttable=None, treename=None)[source]

Parse a newick string.

Parameters:
  • data – Any file-like object that can be coerced into shlex, or a string (converted to StringIO)
  • ttable (dict) – Mapping of node labels in the newick string to other values.
Returns:

The root node.

Return type:

Node

ivy.newick.parse_ampersand_comment(s)[source]
ivy.newick.test_parse_comment()[source]