Many speculative biologists are interested in constructing evolutionary trees – diagrams which show the branching relationships between taxa, in which the branch lengths are arbitrary (cladograms), scaled by the amount of evolutionary change (phylograms), or in terms of absolute time (chronograms). In real-world evolutionary biology, trees are reconstructed from data (generally morphological, molecular-genetic, or both), either through an optimization algorithm like maximum parsimony, or more commonly these days through statistical models, generally under maximum-likelihood or Bayesian frameworks.
For the speculative biologist, it is of course unusual to simulate such character data and infer a tree. Instead, we typically want to represent relationships which we have invented. There are plenty of graphical tools which one can use to generate a custom tree, from free-handing in any basic illustration software, to programs that facilitate the process through node and branch behavior. For example, PowerPoint can create shapes which have fixed points along their perimeter to which lines can be attached, making the lines stay connected when the shapes are moved. A great free option for this ‘flowchart’ approach is draw.io.
However, some people may prefer a more nuts-and-bolts approach, in which the underlying tree structure can be separated from the graphical representation. This approach can provide a great deal of freedom, because the structure can be saved and reused in a variety of visualizations without having to start from scratch. One method is to use Newick strings, which are the most common way in which real trees are represented. Another advantage to Newick format is that phylogenetic visualization tools like PearTree and many R tools (ape, phytools, ggtree. . .) are built to natively handle these data and come with lots of useful and common visualization options.
Building a Newick string can be somewhat tedious if a tree is large and/or structurally complex, and may be initially unintuitive, but Newick format is actually quite straightforward in its basic usage. I see a lot of questions on this sub about how to visualize cladograms, so I figure a little primer may be useful to some folks here.
A Newick string is simply a string of alphanumeric characters with particular syntax. A variety of extensions to the format exist, which allow for detailed annotation. A Newick string can also be used in other formats like Nexus, which further extend the options. Here, I’ll focus on basic Newick. A few useful terms to review:
- Tips or terminal branches are the ‘leaves’ of the tree, often (but not necessarily) species.
- A sister group is a pair of taxa (sister taxa) which are more closely related to one another than to any other taxon; in other words, they share a more recent common ancestor with one another than with any other taxa.
- 'Most recent common ancestor' is abbreviated MRCA. Sometimes this is called a last common ancestor, as in the abbreviation ‘LUCA’ (last universal common ancestor).
- A clade is a group of taxa containing a common ancestor and all of its descendants.
- A bifurcating tree has exactly two descendants at each node; nodes represent common ancestors.
- A polytomy occurs when more than two branches arise from the MRCA. Polytomies are thought to be rare in nature, representing highly accelerated diversification. Usually when we see a polytomy on a tree, it’s because we lack sufficient evidence to resolve actual bifurcations (‘splits’). Tip: To make a realistic looking tree, only include polytomies purposefully where they are biologically plausible, or fit into the lore (maybe your scientists don't have good data?)
- It is important to understand that nodes can be ‘rotated’ arbitrarily, changing the graphical representation without changing the underlying structure.
With that in mind, how do we build a Newick tree? The basic premise is that there is a set of special characters that indicate the tree structure. All Newick strings end with a semicolon. Nodes are represented by matched parentheses (curved brackets). Within parentheses, taxa (usually tips) are represented by their names, which are largely arbitrary but contain some restrictions, e.g., blanks are disallowed and must be represented by underscores. Sister taxa (or multiple branches in a polytomy) are separated by commas. Here are some simple trees in Newick format:
(Plants, (Fungi, Animals));
((mammal, reptile), (crab, (butterfly, wasp)));
((Genus1_speciesA, Genus1_speciesB), (Genus2_speciesA, Genus2_speciesB));
The graphical representations of these trees are attached. Note that the specific visualization, with tips on the right and square or diagonal splits, is one of many arbitrary choices you can make in the visualization program.
Newick strings don't have to be bifurcating. Here's a polytomy between species A, species D, and a clade containing species B and C:
(A, (B, C), D);
Note that in the same way that nodes can be rotated without changing their structure, so can the order of taxa in a Newick string.
(A (B, C)); = (A, (C, B)); = ((B, C), A);
What if you want to add information like branch lengths? These are represented using a colon and a number directly after a taxon name, e.g.
((Megarhinus:0.3521,(Skrillio:0.2165,(Gempus:0.1286, (Bendigo_wendigo:0.2331,Bendigo_friendigo:0.1941):0.08442):0.05277):0.1212):0.69420, Grampster:1.235);
Here, the tree viewing software has the 'node heights' displayed - it figures these out based on the specified branch lengths.
Newick strings can contain further information, like statistical branch support, or other annotations.
The general rules for special characters and syntax:
- An unquoted label cannot contain blanks, parentheses, square brackets, single quotes, colons, semicolons, or commas.
- These characters can be included in labels enclosed by single quotes
- To use a single quote character inside a quoted label, use two single quotes.
- Comments or other annotations are enclosed in square brackets and can appear anywhere outside of labels or branch lengths.
- Blanks and tabs are allowed anywhere outside of unquoted labels or branch lengths.
- Newlines are allowed anywhere outside of labels or branch lengths.
The latter rules are great because they allow us to break down large or complicated trees. Construct your Newick string like a code block with newlines and indentation so you can see which clades are nested within others:
(
(A:0.2, B:0.15):0.6,
(C:0.31, D:0.1):0.42
):1.1;
Here, the visualization software has been told to annotate branches with their lengths and to show 'node heights'.
So! Go out and write Newick strings, save them as text files, open them in a free tree viewer, and have fun making the graphic look nice. Most tree viewers will allow you to export the formatted tree in multiple file types. For example, the attached images were exported as .jpg, but I usually export trees as .pdfs, which will open in (e.g.) Adobe Illustrator with editable objects. Most tree viewers can also add additional annotations, colors, and background highlights; rotate nodes; display radial or square trees, etc.
Commonly, Newick files use extensions like .nw, .new, or .newick, but they're just character strings so it's arbitrary.
Once you've got the hang of Newick files, check out Nexus, a related beast that can help with large trees using label dictionaries and so on.
Have fun!
[Edit to add: The examples here were drawn in FigTree, the precursor to PearTree linked above]