Skip to content

Commit a621ed2

Browse files
committed
added figures and files for starting tree section
1 parent feb7aad commit a621ed2

13 files changed

Lines changed: 603 additions & 8 deletions

.DS_Store

-10 KB
Binary file not shown.

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ By default, the initial value for the tree does not appear in BEAUti, so our fir
252252
253253
<figure>
254254
<a id="fig:tree_panel"></a>
255-
<img style="width:80.0%;" src="figures/ape_tree_panel.png" alt="">
255+
<img style="width:80.0%;" src="figures/beauti_tree_panel.png" alt="">
256256
<figcaption>Figure 10: The Starting tree panel showing the default random tree.</figcaption>
257257
</figure>
258258
<br>
@@ -279,8 +279,8 @@ Our analysis only contains extant species, and our tree has no polytomies so we
279279

280280
<figure>
281281
<a id="fig:newick_tree_panel"></a>
282-
<img style="width:80.0%;" src="figures/ape_newick_tree_panel.png" alt="">
283-
<figcaption>Figure 10: The Starting tree panel showing our Newick initial tree.</figcaption>
282+
<img style="width:80.0%;" src="figures/beauti_newick_tree_panel.png" alt="">
283+
<figcaption>Figure 11: The Starting tree panel showing our Newick initial tree.</figcaption>
284284
</figure>
285285
<br>
286286

@@ -292,20 +292,33 @@ We can now run our updated analysis.
292292
> Open **BEAST2** and choose `primates_run_newick.xml` as the Input file. Then click **Run**.
293293
>
294294
295-
On this small example, we will not see a strong difference in performance from adding an initial tree. However, initial trees can be helpful for larger and more complex inferences to converge.
295+
We can load the log files `primates_run.log` and `primates_run_newick.log` (found in the `Output` section of the tutorial) into **Tracer** to compare both runs. On this small example, the ESS of the run with an initial tree are slightly higher on most parameters than with the random tree, but both runs have converged and we do not see a strong difference in performance from adding an initial tree. However, initial trees can be very helpful for larger and more complex inferences to converge.
296296

297297
## Common issues with initial trees
298298

299-
A frequent issue with using initial tree is that **BEAST2** expects a dated tree, i.e. a tree with branch lengths in units of time, whereas initial trees are often generated using a maximum likelihood software such as **IQ-TREE**, which will output a tree with branch lengths in units of number of substitutions. This is exactly the case in our example, and if we plot the primates tree provided above we will notice this very easily. For instance, all our samples come from the present, but our example tree is not ultrametric.
299+
A frequent issue with using an initial tree is that **BEAST2** expects a dated tree, i.e. a tree with branch lengths in units of time, whereas initial trees are often generated using a maximum likelihood software such as **IQ-TREE**, which will output a tree with branch lengths in units of number of substitutions. This is exactly the case in our example, and if we plot the primates tree provided above we will notice this very easily. For instance, all our samples come from the present, but our primates initial tree is not ultrametric.
300300

301301
This was not an issue in our earlier inference because **BEAST2** was able to correct the tip ages (with the **Adjust Tip Heights** option) and we had no other time calibration points. However, in a real analysis we will likely have several calibrations to help calibrate our molecular clock. Let us check what happens when we add a root calibration at the root of the tree.
302302

303303
> Download the second **BEAST2** input file `primates_run_newick_root.xml`.
304+
> Open **BEAUti** and load in the `primates_run_newick_root.xml` file by navigating to **File > Load**.
305+
> Check the added root calibration in the **Priors** panel.
306+
>
307+
308+
We can see here that we have added a distribution on the root node in order to infer a dated tree. Now we can run this analysis.
309+
304310
> Open **BEAST2** and choose `primates_run_newick_root.xml` as the Input file. Then click **Run**.
305311
>
306312
307313
Our analysis does not start, and by looking at the error message in [Figure 12](#fig:error_root) we can see that our root calibration has probability **-Infinity**. This is because the root calibration that we have set has an **offset** of **20 My**, meaning that the root age has to be above that value. On the other hand, the initial tree we have provided has a root age of 0.887, which is completely incompatible with the calibration.
308314

315+
<figure>
316+
<a id="fig:error_root"></a>
317+
<img style="width:80.0%;" src="figures/beast_error_root.png" alt="">
318+
<figcaption>Figure 12: The error obtained when running an analysis with a root calibration.</figcaption>
319+
</figure>
320+
<br>
321+
309322
We can solve this issue by scaling our initial tree so that the root age is increased. Since our root age has to be greater than 20, we need a scaling factor of at least 20/0.887 = 22.55 to have a tree which is compatible with the calibration.
310323

311324
> Open **BEAUti** and load in the `primates_run_newick_root.xml` file by navigating to **File > Load**.
@@ -321,13 +334,24 @@ We can now test that our updated analysis runs correctly.
321334
322335
Unfortunately, the **Scale** parameter is applied to the whole tree, and in analyses with many different calibration points it is not always possible to find a scale factor which is compatible with all calibrations, especially if some calibrations have both a minimum and a maximum age. For instance, let us see what happens if we add a second calibration point to our analysis.
323336

324-
> Download the third **BEAST2** input file `primates_run_newick_calibrated_scaled.xml`.
325-
> Open **BEAST2** and choose `primates_run_newick_calibrated_scaled.xml` as the Input file. Then click **Run**.
337+
> Download the third **BEAST2** input file `primates_run_newick_2calib.xml`.
338+
> Open **BEAUti** and load in the `primates_run_newick_2calib.xml` file by navigating to **File > Load**.
339+
> Check the two calibrations in the **Priors** panel.
340+
>
341+
342+
We can see two calibrations in our analysis, one at the root of the tree and one on the human-chimpanzee clade. Now we can run this analysis.
343+
344+
> Open **BEAST2** and choose `primates_run_newick_2calib.xml` as the Input file. Then click **Run**.
326345
>
327346
328347
Again our analysis does not start, and by looking at the error message in [Figure 13](#fig:error_calib) we can see that our second calibration **human_pan** has probability **-Infinity**, which indicates that it is incompatible with the initial tree. In this situation, we would need to either use a dated tree as our starting value for the inference, or manually adjust the tree so that all calibration nodes have an age which is compatible with the calibrations set in the analysis.
329348

330-
349+
<figure>
350+
<a id="fig:error_calib"></a>
351+
<img style="width:80.0%;" src="figures/beast_error_calib.png" alt="">
352+
<figcaption>Figure 13: The error obtained when running an analysis with two calibration points.</figcaption>
353+
</figure>
354+
<br>
331355

332356
# Useful Links
333357

data/primates_tree.tre

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(((Tarsius_syrichta:0.1953927577,Lemur_catta:0.8046072721):0.04090988636,(Saimiri_sciureus:0.1659402847,(M._sylvanus:0.1184122637,(M._fascicularis:0.02839506418,(M._mulatta:0.01111112721,Macaca_fuscata:0.0259259101):0.02271603793):0.028723903):0.08011137694):0.01652187109):0.04160622135,((Hylobates:0.07209060341,(Pan:0.06250219047,Homo_sapiens:0.04860892519):0.0271565225):0.03266784549,Gorilla:0.09081792831):0.003822688013,Pongo:0.09148330614);

figures/.DS_Store

-6 KB
Binary file not shown.

figures/beast_error_calib.png

73.8 KB
Loading

figures/beast_error_root.png

74.3 KB
Loading
34.2 KB
Loading

figures/beauti_tree_panel.png

20.7 KB
Loading

precooked_runs/.DS_Store

-6 KB
Binary file not shown.
8.18 MB
Binary file not shown.

0 commit comments

Comments
 (0)