plotting trees in R: node labels from nexus tree files
1
1
Entering edit mode
4.0 years ago
jmah ▴ 30

Hi,

I am trying to plot a phylogeny from RevBayes in R.

The trees are in nexus format. For some reason, node labels do not import when I use ape::read.nexus(). When checking the phylo object, it shows that branch lengths have been imported, but no node labels. I am able to see the node labels in Figtree. I've tried exporting to Newick format in Figtree, but then node labels are lost.

Here's the phylo object:

Phylogenetic tree with 46 tips and 45 internal nodes.

Tip labels: Tadh_1, Tadh_20, Tadh_25, Tadh_26, Tadh_27, Tadh_18, ...

Rooted; includes branch lengths.

Here's a fragment of the tree in my nexus file:

Begin trees; tree TREE1 = [&R](((((((((Tadh_1[&index=13]:0.315435,Tadh_20[&index=8]:0.315435)[&index=47,posterior=0.052038,age_95%_HPD={0.229588,0.415859}]:0.028293,Tadh_25[&index=11]:0.343728)[&index=48,posterior=0.017375,age_95%_HPD={0.26249,0.436248}]:0.040193, ... etc.

thanks for any help!

RevBayes nexus ape R ggtree • 3.7k views
ADD COMMENT
0
Entering edit mode

To clarify, the node labels I am after are the posterior probabilities ("posterior").

ADD REPLY
0
Entering edit mode
4.0 years ago
Guangchuang Yu ★ 2.6k

The read.beast() function in the treeio package should be able to parse the file and then you can use the ggtree package to visualize the tree with or without associated data (e.g. posterior values).

ADD COMMENT
0
Entering edit mode

Thank you! I'll give that a try. Also, thanks for making ggtree! I love that package.

ADD REPLY

Login before adding your answer.

Traffic: 2529 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