## Newick and LaTeX

My internship at the EBI was essentially about phylogenetics. Cool. But then came the moment I had to write the report of the work done during these 6 months. I realized at this moment that writing about phylogenetics is a tough task because the newick format is not very explicit. For instance, that tree:

(((((((sapiens:0.0067,troglodytes:0.006667):0.00225,gorilla:0.008825):0.00968,abelii:0.018318):0.01434,mulatta:0.037471):0.021965,jacchus:0.066131):0.089083,(musculus:0.084509,norvegicus:0.091589):0.271974):0.020593,((scrofa:0.079,taurus:0.1689125):0.0201675,(caballus:0.109397,familiaris:0.152303):0.010727):0.032898);

What do you think about it? Yeah, not easy to understand, of course. I thought about taking screenshots of Dendroscope at first, but it became quite long to open every tree, to take a screenshot, to save it somewhere with a proper name, etc. For my report, I needed to display a lot of trees to compare them. To me, the easiest way to do that would be to use the Newick sources I had for every tree.
I discovered a great package on LaTeX for displaying newick trees, quite flexible and easy-to-use: Newicktree.

However, there are still some problems — or constraints — in using this library:

• you must use latex to compile it, not pdflatex. The package creates EPS pictures which are compatible with the latex compilation only
• you must have installed the PSTricks package, and the sub-packages pst-nodes and pst-tree

If you are using OSX or Unix, you should find the PSTricks packages easily thanks to the Tex Live Utility (in MacTex for Mac) or install it manually as any other package. We have to do the same thing for the Newicktree package, or we can place it in the compiling folder.

Then, we simply have to declare the usepackage as always:

\usepackage{newicktree}

And somewhere in the document, we can ask for drawing the tree:

\begin{newicktree}
\small
\setunitlength{35cm} \righttree
\usebranchlengths \nobranchlengths
\drawtree{(((((((sapiens:0.0067,troglodytes:0.006667):0.00225,gorilla:0.008825):0.00968,abelii:0.018318):0.01434,mulatta:0.037471):0.021965,jacchus:0.066131):0.089083,(musculus:0.084509,norvegicus:0.091589):0.271974):0.020593,((scrofa:0.079,taurus:0.1689125):0.0201675,(caballus:0.109397,familiaris:0.152303):0.010727):0.032898);}
\par \scalebar1
\end{newicktree}


It is quite intuitive, but here are some explanations:

• \setunitlength{35cm}: how long a branch length of 1 should be on the paper — I use it as a scale
• \righttree: I want the tree with the leaves displayed on the right
• \usebranchlenths: I want to have a phenogram, not a cladogram
• \nobranchlengths: but I don’t want to display the lengths

There are many other options, and there is a manual for this, right here.

Finally, as I used it in a report, I put everything in a figure so I can cite it and list it in the contents. Here is the result.

\begin{figure}
\begin{newicktree}
\small\setunitlength{35cm} \righttree
\usebranchlengths \nobranchlengths
\drawtree{(((((((sapiens:0.0067,troglodytes:0.006667):0.00225,gorilla:0.008825):0.00968,abelii:0.018318):0.01434,mulatta:0.037471):0.021965,jacchus:0.066131):0.089083,(musculus:0.084509,norvegicus:0.091589):0.271974):0.020593,((scrofa:0.079,taurus:0.1689125):0.0201675,(caballus:0.109397,familiaris:0.152303):0.010727):0.032898);}
\par \scalebar1
\end{newicktree}
\caption{The species tree used for this study}
\label{species_tree}
\end{figure}
1. 1
2. 1