Help - Newick syntax errors

From TreeGraph help
Jump to: navigation, search

TreeGraph 2 is able to read trees from Newick strings (see Open files for details). If an input string contains syntactical errors the Newick syntax error dialog is shown.

Information provided by the dialog

  • Message: A textual description of the error
  • Position: The position near which the error was found (The index of the character relative to the start of the Newick string in the file, not relative to the start of the file or the line.)
  • Source: An excerpt from the newick string containing the error ("^" marks the position of the error.)

Error messages

Illegal length statement

This error message tells you that your Newick string contains a ":" which is not followed by a length value.

  • Erroneous: ((A:5, B:3):2, C:);
  • Correct: ((A:5, B:3):2, C:3);

Token X expected but token Y found

At the specified position the token X should be located but instead the token Y was used, which is invalid there.

  • Erroneous: )((A, B), (C, D)); (Token SUBTREE_START expected but token SUBTREE_END found.)
  • Correct: ((A, B), (C, D));

Unexpected token X

Your input contains a token which is invalid at its position. This error message can also be displayed if an unterminted name was used followed by a terminated one.

  • Erroneous: (('A', 'B'), ('C, 'D'));
  • Correct: (('A', 'B'), ('C', 'D')); or (('A', 'B'), (C, 'D'));

Unterminated name

A started node name has not been terminated before the end of the string (or file). Note that after a "'" all characters (including other Newick or Nexus elements) are considered as part of this node name until the next "'".

  • Erroneous: (('A', 'B'), ('C', 'D));
  • Correct: (('A', 'B'), ('C', 'D')); or (('A', 'B'), ('C', D));

Unterminated subtree

The Newick string contains a subtree which is started by "(" and not terminated by ")".

  • Erroneous: ((A, B), (C, D);
  • Correct: ((A, B), (C, D));

This error can also occur if you have an ";" inside the Newick string. In this case all characters behind the semicolon are not considered as part of the tree description.

  • Erroneous: ((A, B;), (C, D));
  • Correct: ((A, 'B;'), (C, D));

See also