| 1 |
|
| 2 |
Estimation of evolutionary rates and tree rerooting |
| 3 |
--------------------------------------------------- |
| 4 |
|
| 5 |
Treetime can estimate substitution rates and determine which rooting of the tree is most consistent with the sampling dates of the sequences. |
| 6 |
This functionality is implemented as subcommand ``clock``\ : |
| 7 |
|
| 8 |
.. code-block:: bash |
| 9 |
|
| 10 |
treetime clock --tree data/h3n2_na/h3n2_na_20.nwk --dates data/h3n2_na/h3n2_na_20.metadata.csv --sequence-len 1400 --outdir clock_results |
| 11 |
|
| 12 |
This command will print the following output: |
| 13 |
|
| 14 |
.. code-block:: bash |
| 15 |
|
| 16 |
Root-Tip-Regression: |
| 17 |
--rate: 2.826e-03 |
| 18 |
--r^2: 0.98 |
| 19 |
|
| 20 |
The R^2 value indicates the fraction of variation in |
| 21 |
root-to-tip distance explained by the sampling times. |
| 22 |
Higher values corresponds more clock-like behavior (max 1.0). |
| 23 |
|
| 24 |
The rate is the slope of the best fit of the date to |
| 25 |
the root-to-tip distance and provides an estimate of |
| 26 |
the substitution rate. The rate needs to be positive! |
| 27 |
Negative rates suggest an inappropriate root. |
| 28 |
|
| 29 |
|
| 30 |
The estimated rate and tree correspond to a root date: |
| 31 |
|
| 32 |
--- root-date: 1996.75 |
| 33 |
|
| 34 |
|
| 35 |
--- re-rooted tree written to |
| 36 |
clock_results/rerooted.newick |
| 37 |
|
| 38 |
--- wrote dates and root-to-tip distances to |
| 39 |
clock_results/rtt.csv |
| 40 |
|
| 41 |
--- root-to-tip plot saved to |
| 42 |
clock_results/root_to_tip_regression.pdf |
| 43 |
|
| 44 |
|
| 45 |
In addition, a number of files are saved in the directory specified with `--outdir`: |
| 46 |
|
| 47 |
* a rerooted tree in newick format |
| 48 |
* a table with the root-to-tip distances and the dates of all terminal nodes |
| 49 |
* a graph showing the regression of root-to-tip distances vs time |
| 50 |
* a text-file with the rate estimate |
| 51 |
|
| 52 |
|
| 53 |
.. image:: figures/clock_plot.png |
| 54 |
:target: figures/clock_plot.png |
| 55 |
:alt: rtt |
| 56 |
|
| 57 |
|
| 58 |
Confidence intervals of the clock rate |
| 59 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 60 |
|
| 61 |
In its default setting, ``treetime clock`` the evolutionary rate and the Tmrca by simple least-squares regression. |
| 62 |
However, these root-to-tip distances are correlated due to shared ancestry no valid confidence intervals can be computed for this regression. |
| 63 |
This covariation can be efficiently accounted if the sequence data set is consistent with a simple strict molecular clock model, but can give misleading results when the molecular clock model is violated. |
| 64 |
This feature is hence off by default and can be switched on using the flag |
| 65 |
|
| 66 |
.. code-block:: bash |
| 67 |
|
| 68 |
--covariation |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
Filtering of tips |
| 74 |
^^^^^^^^^^^^^^^^^ |
| 75 |
|
| 76 |
More often than not, a subset of sequences in an alignment are outliers and don't follow the molecular clock model. |
| 77 |
Such outliers can badly skew rerooting and estimation of the substitution rates. |
| 78 |
To guard against such problems, ``treetime clock`` marks sequences as suspect if they deviate more than a certain amount from the clock model. |
| 79 |
TreeTime first performs a least-square root-to-tip vs date regression and then marks tips whose residuals are greater than ``n`` inter-quartile distances of the residual distribution. |
| 80 |
The parameter ``n`` is set via |
| 81 |
|
| 82 |
.. code-block:: bash |
| 83 |
|
| 84 |
--clock-filter <n> |
| 85 |
|
| 86 |
and is 3 by default. |
| 87 |
For the example Ebola virus data set, the command |
| 88 |
|
| 89 |
.. code-block:: bash |
| 90 |
|
| 91 |
treetime clock --tree data/ebola/ebola.nwk --dates data/ebola/ebola.metadata.csv --sequence-len 19000 |
| 92 |
|
| 93 |
|
| 94 |
.. image:: figures/ebola_outliers.png |
| 95 |
:target: figures/ebola_outliers.png |
| 96 |
:alt: ebola rtt |
| 97 |
|