This function writes one or more trees to a NEXUS format file. Within the NEXUS file, the trees are stored in the Newick-with-Attributes (NWKA) format.

write_nwka_nexus(trees, file, translate = TRUE, translate_quotes = TRUE)

Arguments

trees

An object of class "phylo" or "multiPhylo".

file

A file name.

translate

If this is TRUE (the default), the produced nexus tree will contain, in addition to the Trees block, a Taxa block containing the taxon labels, as well as a Translate instruction in the Trees block. Otherwise, it will only contain a Trees block without a Translate instruction.

translate_quotes

If this is TRUE (the default), the entries in the Taxa block and in the Translate instruction will be placed within single quotes. Otherwise, they will be written without single quotes.

Details

Only the tip labels are included in the Taxa block and the Translate instruction (if applicable).

The trees inside the NEXUS file will be stored in NWKA format, including all of the available attributes. This is compatible with the NEXUS specification, because attributes that cannot be represented in standard Newick format are enclosed within square brackets ([]);

The tip names can be specified either as a Name element in the tree's tip.attributes element, or as the tip.label element of the tree. If both are specified, the values stored in the Name attribute take precedence (this allows backward compatibility for trees created using ape).

The node names and support values can similarly be specified either with a Name or Support element in the tree's node.attributes, or as the tree's node.label. If all the node labels can be parsed as numbers, they will be assumed to contain support values; otherwise, they will be assumed to contain node names. If the node.attributes already contain a Name or Support element, the node labels will be ignored.

References

https://github.com/arklumpus/TreeNode/blob/master/NWKA.md

See also