Created by Brian Moore
In the previous tutorial we described how to impose constraints within the XML file that collectively provide a means of calibrating divergence times. Here, we describe how to specify a starting tree for the MCMC that satisfies those temporal and topological constraints.
This entails 3 main steps: (1) commenting out existing commands in the XML file that generate a default starting tree, (2) transforming the consensus phylogram (estimated from a previous MrBayes analysis) into a chronogram (which we will demonstrate using nonparametric rate smoothing algorithm implemented in TreeEdit), and (3) specifying the resulting chronogram as the starting tree in the XML file.
Open the edited XML file in a text editor; in the following tutorial we used TextWrangler. Note that the screen captures below include the line numbers in the edited xml file to help you identify the location of the corresponding edits to the XML file.
Step 1: Commenting out the default starting tree
The XML file generated by BEAUti includes commands to generate a starting tree under a stochastic coalescent process. These random starting trees are very likely to violate the temporal and/or topological constraints that we specified to calibrate divergence times, and will therefore cause an error when we attempt initiate the MCMC. Accordingly, we will ensure that BEAST will ignore the commands for generating a random coalescent tree, which could be achieved either by deleting these commands, or by commenting them from the file. In XML, a comment is initiated with <!-- and terminated with -->, such that everything between these two tokens is ignored when the program is executed. There are two elements in the XML file that need to be commented out; the ‘constantSize’ and ‘coalescentTree’ elements.
Comment out the ‘constantSize’ element as depicted below.
Comment out the ‘coalescentTree’ element as depicted below.
Step 2: Preparing a user-specified starting tree
We need to specify a starting tree that satisfies the temporal and topological constraints associated with fossil calibration. The starting tree that we will use is based on the consensus phylogram previously estimated using MrBayes, ‘Platanus_con_tree.tre’, which is included in the example data files available here.
We will transform this phylogram (in which the branch lengths reflect the expected number of substitutions per site) into a chronogram (in which the branch lengths are proportional to absolute time) using nonparametric rate smoothing (NPRS). The NPRS algorithm has been implemented in several programs, including the original implementation in r8s, as well as in the APE package that is described elsewhere in this wiki. Here we demonstrate how to perform NPRS using the program TreeEdit.
Double click on the TreeEdit icon to launch the application. From the File menu, select the ‘Open...’ option, and navigate to the directory that contains the file ‘Platanus_con_tree.tre’.
With the 'cursor' tool, select the branch subtending ‘Platanus_kerrii’, which is sister to the remaining four species. You should see that the selected branch is now highlighted, as depicted below.
Select the 'rooting' tool by clicking on the icon that is sixth from the left at the top of the TreeEdit window, and click on the branch subtending ‘Platanus_kerrii’. You should see that the tree becomes rooted along the selected branch, as depicted below.
Select the 'cursor' tool clicking on the icon that is first from the left at the top of the TreeEdit window. From the Trees menu, select the ‘Transform branch lengths...’ option. A window will appear listing several options: click the ‘Ultrametric:’ button, then select the ‘Non-parametric rate smoothing’. These options are depicted below.
After clicking on the ‘OK’ button, the tree will be rendered ultrametric (i.e., such that the distance from the root to each tip is equal). Select the 'node information' tool clicking on the icon that is seventh from the left at the top of the TreeEdit window. You should see that the internal nodes of the tree are now numbered, as depicted below.
Press and hold down on the 'node information' tool to display the list of options, and then scroll down to select the ‘Node heights’ option, which will display the height of the internal nodes in expected number of substitutions, as depicted below.
With the cursor tool, select the branch that is sister to ‘Platanus_kerrii’, (i.e., the branch subtending the clade that includes ‘Platanus_orientalis’, ‘Platanus_racemosa’, ‘Platanus_maxicana’, and ‘Platanus_occidentalis’). You should see that the selected clade is now highlighted, as depicted below.
From the Trees menu, select the ‘Scale tree...’ option. A window will appear listing several options: click the ‘Scale To:’ button, then select the ‘Scale selected height to:’ button, and type the value ‘50.0’ in the adjacent window (this value falls within the range that we previously specified for the age of this clade in our XML file). Next, click ‘OK’. You should see that ages of all the remaining nodes in the tree are scaled accordingly, as depicted below.
From the File menu, select the ‘Export...’ option. An ‘Export Tree(s)’ window will appear listing several options: click to de-select the ‘Use Translation List for Taxon Names’ button, and then click ‘OK’. An ‘Export Data File’ window will appear: specify the name and location of the tree file, and then click ‘OK’, as depicted below.
The preceding steps provide a chronogram that can now be used as a starting tree in our XML file.
Step 3: Adding the user-specified starting tree to the XML file
We are now ready to specify the starting tree in the XML file with the following steps.
Using TextWrangler, add a ‘newick’ element to the XML file, as depicted below.
In TextWrangler, open the file that we previously generated with TreeEdit. Select and copy the first tree in the NEXUS file, as depicted below.
Paste the NPRS chronogram into the ‘newick’ tree element, as depicted below.
Finally, specify ‘newick’ as the starting tree in the first line of the ‘treeModel’ element, as depicted below.
Ready to roll! (At last!)
We're finally ready to initiate the BEAST analysis, which we will describe in the next part of the tutorial.