Exporting and Opening Trees with Node Supports and Bremer Supports in Nexus Format

507 views
Skip to first unread message

Shawn DeNarie

unread,
Jul 7, 2024, 8:01:10 PM7/7/24
to TNT-Tree Analysis using New Technology
Hello Fellow Researchers,

I have recently been working with TNT to conduct a series of phylogenetic analyses with a large morphological data set that I have assembled over the past few years. However, I have been encountering some difficulty with exporting my labeled strict consensus trees into a Nexus-formatted file that I can load into other programs for downstream analyses.

My method so far has been to conduct a traditional search with TBR, first using Wagner trees, then using trees from RAM to account for overflow, when applicable. I have then saved the resulting tree sets as .tre files using the GUI in open parenthetical format, closing each file after saving, and then calculated the consensus trees with node supports and the consensus tree with Bremer supports in separate instances of TNT.

For each consensus tree with node supports, I open my saved .tre file, use the GUI to calculate the strict consensus tree,  save the strict consensus tree to RAM, and then use the command tchoose / to select the strict consensus tree. I then use the command ttags = to store tree tags, resample the strict consensus to calculate and save absolute and GC frequencies, and then export using the command export < [FileName.nex].

For each consensus tree with Bremer supports, I open my saved .tre file, use the command ttags = to store tree tags, use the GUI to calculate and save absolute and relative Bremer supports (stored using the "Show / Save Tree Diagram" option), and use the GUI to calculate and save the Bremer consensus tree (stored using the "Save to RAM" option). I then use the commands tchoose / to select the the tagged Bremer consensus tree, and then export using the command export < [FileName.nex].

This procedure successfully generates Nexus files containing tagged trees that I can then reopen in TNT. However, my problem is that I cannot seem to open these files in most of the other programs that I have tried, including Figtree, R (using packages like ape and phylobase), and TreeView. I can open them partially in Mesquite, but many taxa end up being pruned, I suspect somehow owing to how the files are internally formatted.

I have tried troubleshooting this issue by running smaller versions of my analyses using the same data set and the same procedure, and from doing so have found that the number of stored and saved trees used to calculate the consensus tree does not seem to influence the readability of the Nexus file. I have also tried using different export commands, particularly export - and export >, neither of which produce files with better readability (but the latter of which produces files that throw up a different error when attempting to open in Figtree). I have also attempted to use the ttags ) command prior to exporting the Nexus files, but this does not influence readability of the output files either.

I need to use my tagged trees to produce figures and to conduct downstream analyses such as calculations of stratigraphic consistency and character mapping, so any advice on how to export these trees in a format that can be read by other programs would be very much appreciated. Please let me know if you have any suggestions that may work!

Thank you!

Martín Ramírez

unread,
Jul 9, 2024, 8:59:46 PM7/9/24
to tnt-tree-analysis-u...@googlegroups.com
hello Shawn,

not much experience with exported trees, but perhaps try debugging:
- exporting trees without tags and see if they open in FigTree
- open the newick file with a text editor, and compare with anothee file that opens ok in FigTree
- search for funny symbols in taxa names
- check that taxa names are not truncated, hence some repeated

good luck!

Martin

--
Has recibido este mensaje porque estás suscrito al grupo "TNT-Tree Analysis using New Technology" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a tnt-tree-analysis-using-n...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/tnt-tree-analysis-using-new-technology/11b2e30c-7f11-40b2-b813-69172447a816n%40googlegroups.com.

Buz Wilson

unread,
Jul 9, 2024, 8:59:51 PM7/9/24
to 'Shawn DeNarie' via TNT-Tree Analysis using New Technology
Dear Shawn
I have used Mesquite successfully but with post processing of the TNT nexus files with nodal values.  Mesquite (version3.81) doesn't expect the method that TNT uses to represent these values so it gets it knickers in a twist when it tries to represent the trees and fails as you observed. The method is to enclose all  nodal values with single quotes, as in this example attached. I did it by hand as I was in a hurry and didn't want to spend the time writing a [tested and working correctly] bash script to do it - tedious! Then having done that, you can open it with Mesquite, selecting nodal values as text and then saving the tree image as a pdf. This pdf can then be opened in a vector graphic editor (I used GIMP), and the position of the values adjusted as necessary - you can do some of this in Mesquite but I liked to use a different font and size than provided by Mesquite, and wanted to add a few things.
cheers
Buz
-- 
George D.F. (Buz) Wilson, Ph.D.
Saugatuck Natural History Laboratory, LLC
publications: www researchgate net/profile/George-Wilson-12
email: gdfw at SNHLab com
Janiroid20230306_K24.355468_jac33_tree.nex
Janiroid20230306_K24-355468_Jac33.pdf

Shawn DeNarie

unread,
Jul 13, 2024, 7:13:13 PM7/13/24
to TNT-Tree Analysis using New Technology
Hello Martin and Buz,

Thank you both very much for your responses! I found a workable solution thanks to your suggestions, and I have some interesting observations to report.

When I export trees as Nexus files from TNT without any tags, the trees open in both Figtree and Mesquite, so it seems that the formatting of the tree tags is the issue. Hence, as Buz suggested, I tried manually enclosing all the node values with single quotes (e.g., 'XX/XX') using a text editor, and this change enabled the trees to be opened in Mesquite, though not in Figtree. However, upon inspecting the Nexus tree files, I noticed that there were spaces at various points within the tree string. I removed these (i.e., find and replace " " with ""), and this change enabled the trees to be opened in both Figtree and Mesquite!

Notably, both when TNT calculates Bremer supports and when TNT calculates node supports through resampling, the resulting trees will have empty tags saved to each terminal branch. The reason why these labels don't contain values is evidently because these support metrics aren't calculated for individual terminals. However, the reason why they are saved is unclear. In any case, if these node labels (appearing as "/" if including two supports metrics, such as absolute and relative Bremer supports, as I have), then they will be interpreted as part of the taxon names when the Nexus trees are opened in Figtree. To remove these empty labels from the taxon names, simply remove the empty quoted labels (i.e., find and replace "'/'" with ""), and the names will load as normal.

This probably isn't the most efficient solution since it involves simple but meticulous manual manipulation of the tree files in a text editor (which I imagine would be especially laborious for trees that include a very large number of terminals). Nevertheless, it at least provides a clear path for opening labeled trees from TNT in other programs, and so I wanted to share these insights here in case they may help anyone else in the future. Of course, if anyone else knows of or discovers any other more efficient and/or automated solutions using TNT itself, I would certainly like to hear of those methods and insights as well!

Nick Matzke

unread,
Jul 16, 2024, 7:16:26 AM7/16/24
to tnt-tree-analysis-u...@googlegroups.com
Hi all,

It may well depend on your specific method for exporting tags in TNT, but I wrote some functions for reading in TNT trees and tags, and exporting to more standard formats, here:

There is also:


...I have a memory of an R package called rtnt but I can't find it in a quick google.

Cheers,
Nick


Reply all
Reply to author
Forward
0 new messages