Any software to view newick/nexus trees command line?
5
3
Entering edit mode
10.1 years ago
Adrian Pelin ★ 2.6k

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 • 10k views
ADD COMMENT
4
Entering edit mode
10.1 years ago
Siva ★ 1.9k

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.

ADD COMMENT
4
Entering edit mode
10.1 years ago
jhc ★ 3.0k

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
ADD COMMENT
0
Entering edit mode

Thanks. You've saved my day.

ADD REPLY
3
Entering edit mode
10.1 years ago
Asaf 10k

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
ADD COMMENT
1
Entering edit mode
10.1 years ago
CraigM ▴ 90

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

Try this

ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode
9.0 years ago
rezam ▴ 20

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.

ADD COMMENT

Login before adding your answer.

Traffic: 1386 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6