Newick Format

From Biowiki
(Redirected from New Hampshire Format)
Jump to: navigation, search

Newick Format

"Newick" or "New Hampshire" format is a string representation of a phylogenetic tree using nested parentheses. It's exported by all major phylogenetic software including PHYLIP, PAML, DART and many more.

The format is described, with some napkin-science history, on the PHYLIP section of Joe Felsenstein's site.

Here is the grammar for Newick format (from Gary Olsen):

	Items in { } may appear zero or more times.
	Items in [ ] are optional, they may appear once or not at all.
	All other punctuation marks (colon, semicolon, parentheses, comma and
			single quote) are required parts of the format.

				  tree ==> descendant_list [ root_label ] [ : branch_length ] ;

	descendant_list ==> ( subtree { , subtree } )

			  subtree ==> descendant_list [internal_node_label] [: branch_length]
						 ==> leaf_label [: branch_length]

				root_label ==> label
	internal_node_label ==> label
				leaf_label ==> label

					  label ==> unquoted_label
							  ==> quoted_label

		  unquoted_label ==> string_of_printing_characters
			 quoted_label ==> ' string_of_printing_characters '

			branch_length ==> signed_number
							  ==> unsigned_number

	Unquoted labels may not contain blanks, parentheses, square brackets,
		  single_quotes, colons, semicolons, or commas.
	Underscore characters in unquoted labels are converted to blanks.
	Single quote characters in a quoted label are represented by two single
	Blanks or tabs may appear anywhere except within unquoted labels or
	Newlines may appear anywhere except within labels or branch_lengths.
	Comments are enclosed in square brackets and may appear anywhere
		  newlines are permitted.

Other notes:
	PAUP (David Swofford) allows nesting of comments.
	[[Tree Align]] (Jotun Hein) writes a root node branch length (with a value of
	PHYLIP (Joseph Felsenstein) requires that an unrooted tree begin with a
		  trifurcation; it will not "uproot" a rooted tree.



			  +-+ One
		  |  +--+ Two
	  |  | +----+ Three
	  |  +-+
	  |	 +--+ Four
	  +------+ Five

-- Biowiki page created by Alex Coventry - 28 Feb 2005