This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Any software to view newick/nexus trees command line?

Sorry, not sure if they are called newick or nexus tree formats, but it's the common format outputed by PHYML, MrBayes, etc.

MrBayes outputs a tree at the end of the analysis in the terminal and it looks really good, even has support values. Is there any software that can do that?

Adrian

EDIT: Sorry, forgot to mention silly me, I use CentOS.

phylogeny cmd

5 answers

If I understand correctly, you want to view tree as an ASCII art on the command line like this:

You can try Newick utilities that will do this. It seems you can do this in BioPython also.

ETE's get_ascii function provides text-based visualization, allowing also to show internal nodes features.

from ete2 import Tree
t = Tree("((A, B)Internal_1:0.7, (C, D)Internal_2:0.5)root:1.3;", format=1)
t.add_features(size=4)
print t.get_ascii(attributes=["name", "dist", "size"])
#
#                            /-A, 0.0
#             /Internal_1, 0.7
#            |               \-B, 0.0
# -root, 1.3, 4
#            |               /-C, 0.0
#             \Internal_2, 0.5
#                            \-D, 0.0
#

Check also the upcoming ETE's command line tools, tree view and other tools will be supported:

http://phylohack.wordpress.com/2014/11/27/about-the-upcoming-ete-command-line-tools/

currently available as beta: https://github.com/jhcepas/ete/releases/tag/latest_beta

UPDATE:

ete3 provides text-based visualization from the command line:

ete3 view --text MyTreeFile.nw

Using dendropy - a python tree manipulating package:

import dendropy

tree = dendropy.Tree.get_from_path('treefile.nwk', 'newick')
print tree.as_ascii_plot()

It can print support values (I didn't have them in my example)

part of my tree (looks better in terminal):

\--+
|          /------ 509169
|   /------+
|   |      |  /--- 314565
|   |      \--+
|   |         \--- 190485
\---+
|      /------ 291331
|  /---+
|  |   |  /--- 342109
|  |   \--+
\--+      \--- 360094
|
|      /--- 190486
\------+
\--- 316273

There are a few open source programs for viewing trees such as treeview.

Try this

I don't think Treeview can show phylogenetic trees in the terminal -- I think it can open a window if prompted. In any event, I think for a tree viewing program, you can't get any better than FigTree. I think the original question was for a tree viewer for the command line. Here's a pretty comprehensive list of tree viewing programs out there: Tree Editors

PAUP* can do this, too. After you run it in terminal:

  • >paup> exec <file_containing_nexus_format_of_trees>
  • paup> showtrees n

It will show the n-th tree in the file.

If you are looking for a GUI, Dendroscope is a very nice and fast tree visualization software.

Log in to answer this question.