Shg456
Shg456

Reputation: 1

Save phylo tree made by phylobase and plot it together with additional data

I have a phylogenetic tree that I created with phylobase and it contains additional data (traits). But I'm having trouble saving it in nex or newick format. I tried saving with ape, but ape deleted all the additional data I had. I need that data to be plotted together with a phylogenetic tree. I have also tried to directly plot without saving, and that doesn't work because it is an unrooted tree. I have the rooted tree. But I'm confused about solving this. I want to plot it based on a rooted tree with the data in the unrooted tree. However, this unrooted tree cannot be saved. What do I have to do?

Plotting phylo tree together with some traits.

This is screenshot of my unrooted tree enter image description here

This is my rooted tree enter image description here

Upvotes: 0

Views: 128

Answers (1)

Thomas Guillerme
Thomas Guillerme

Reputation: 1857

From your images your rooted tree is a "phylo" object and not a "phylo4d" object. You can plot "phylo" objects using:

ape::plot.phylo(my_tree)

And save them using write.tree (newick) or write.nexus (nexus)

ape::write.tree(my_tree, file = "my_tree.tre")
ape::write.nexus(my_tree, file = "my_tree.nex")

Upvotes: 0

Related Questions