Help - Generating Bayes Traits input
TreeGraph 2 is able to generate commands necessary in a BayesTraits analysis of ancestral state probabilities. Other necessary files can also be exported with TreeGraph 2.
You can access the "Generate BayesTraits input" dialog from the file menu. For detailed instructions on how to export other necessary files see the explanations below.
Note that this feature was not available before TreeGraph 2.6.0.
Contents
Which files can be generated?
Note that the syntax of BayesTraits changed in version 3. The output generated here currently only works for earlier versions.
With TreeGraph 2 it is possible to generate a text file containing "AddNode" or "AddMRCA" commands for all or only selected nodes in the current tree. This can be done in the "Generate BayesTraits input" dialog (see below). The generated file has to be be complemented by adding other necessary commands in order to use it as a command line parameter for a BayesTraits analysis. Alternatively the "AddNode"/"AddMRCA" commands can be copied to the clipboard and pasted to the command line at the right moment while running a BayesTraits analysis without the aid of a command file.
Furthermore it is possible to export character data that is stored as node annotations to a text file. The current tree can also be exported to a format readable by BayesTraits. For more information on how to perform either of these steps see below.
The "Generate BayesTraits input" dialog
In this dialog commands for a BayesTraits analysis can be generated.
File
If you want to store the generated commands here you can choose a new or existing text file to which they shall be saved.
Nodes to be reconstructed
Here you can choose if commands for all nodes in the tree or only for currently selected nodes shall be generated.
Type of BayesTraits command
You can specify nodes to run a BayesTraits ancestral state analysis on by using "AddNode" commands to reconstruct internal nodes directly or "AddMRCA" commands to use the most recent common ancestor approach in reconstructing them. If you choose one of these options generated commands for all nodes will be of this type. If you want to use the other command for a part of the nodes you have to select these and open the dialog again.
Node name column
Here you can specify if and in which node/branch data columns of the current document the node names to be used when generating commands are stored.
If names for internal nodes exist already you can choose the node/branch data column in which they are contained in the "Internal nodes/MRCA names" drop down menu. If you choose "Generate internal node names" internal node names will be named "internalNode" and numbered consecutively.
The node/branch data column chosen in the "Terminal node names" drop down menu should contain the names of the leaves of the current tree. Usually this is the node names column.
The "Copy to clipboard" button
If you do not want to store the generated commands in a file you can click the "Copy to clipboard" button instead. After this you can paste the commands e.g. to the command line window or a BayesTraits batch file.
Exporting character tables
Character state information stored in one or more node/branch data columns can be exported using the Exporting node/branch data function of TreeGraph 2.
Choose the "Node names" column and all node/branch data columns containing character state information in the "Column to export" section. Note that the node names are not allowed to contain any special characters if you want to use the character table directly with BayesTraits.
In the "Table settings" section it is important that you uncheck the "Export column headings" box. Character tables with column headings can not be read by BayesTraits! If the node names in your table contain spaces you should also check the "Replace spaces with underscores" box.
Choose "Terminal nodes" as "Nodes to export" to export only the character data of the leaves of your tree.
Finally, you have to choose a destination file to which the character table shall be stored.
Exporting tree files
Trees can be exported with the "Export to tree format" dialog.
To use the exported tree file in BayesTraits you have to choose the Nexus format as file type.
Node names are not allowed to contain any special characters if the tree file shall be used in a BayesTraits analysis. If they contain spaces but no underscores you should choose the "Spaces as underscores" option.
In the Nexus file components section of the dialog check the box for "Use translation table". If you can not see this part of the dialog, first change the file type to "Nexus files".
If your tree does not contain names for internal nodes choose "Do not export internal node names" in the source data section. Else choose a node/branch data column containing internal node names. If you want to run the analysis with commands generated with TreeGraph you have to select the same internal node names column here as in the "Generate BayesTraits input" dialog. In this dialog you should also select the same node/branch data column as "Leaf node names" that you chose for the "Terminal node names" in the "Generate BayesTraits input" dialog.
See also
- Exporting node/branch data
- Exporting trees as Newick/Nexus files
- Importing ancestral state probabilities from BayesTraits
- Exporting pie chart label colors
- WARACS - a collection of Phython scripts that allow visualizing ancestral character state data from both BayesTraits and Mesquite using TreeGraph 2