Documentation

NewickReader.php

Parses a Newick string into a PhylogeneticNode tree Freely inspired by BioPHP's project biophp.org Created 30 September 2026 Last modified 9 October 2026

Table of Contents

Classes

NewickReader
A small recursive-descent parser over the Newick grammar (J. Felsenstein's specification) : tree := subtree ";" subtree := ("(" subtree ("," subtree)* ")")? label? (":" number)? Blanks, tabs and newlines may appear anywhere but inside an unquoted label or a branch length, and so may comments in square brackets, NHX annotations ("[&&NHX:S=human]") included : both are skipped. A quoted label ('Homo sapiens (human)') may hold any character, a single quote being written twice. An unquoted label runs until the next structural character, blank or comment.
On this page

Search results