| 1 |
|
| 2 |
Analyzing homoplasies and recurrent mutations using TreeTime |
| 3 |
------------------------------------------------------------ |
| 4 |
|
| 5 |
Homoplasies are common if the same mutations are selected independently in many lineages, for example resistance mutations under treatment or cell-culture adaptation. |
| 6 |
Homoplasies are also observed if the sequences used to build a tree underwent recombination or if there was contamination during sample prep and sequencing. |
| 7 |
For all these reasons, a quick and easy way of gathering statistics on homoplasies and spotting sites and sequences that are disproportionally affected by homoplasies is useful. |
| 8 |
|
| 9 |
After joint reconstruction of ancestral states, it is straight-forward to gather statistics on how often a particular site mutates and how often it hits a particular state. |
| 10 |
The ``treetime homoplasy`` does exactly that. |
| 11 |
To perform a simple analysis of homoplasies in a set of sequences, call TreeTime as |
| 12 |
|
| 13 |
.. code-block:: bash |
| 14 |
|
| 15 |
treetime homoplasy --aln data/zika/zika.fasta --tree data/zika/zika.nwk |
| 16 |
|
| 17 |
This command will reconstruct ancestral sequences and count how many time a particular site changed along the tree and how often the exact same mutation was observed. |
| 18 |
|
| 19 |
The basic output looks like this: |
| 20 |
|
| 21 |
.. code-block:: bash |
| 22 |
|
| 23 |
The TOTAL tree length is 6.617e-02 and 674 mutations were observed. |
| 24 |
Of these 674 mutations, |
| 25 |
- 544 occur 1 times |
| 26 |
- 54 occur 2 times |
| 27 |
- 6 occur 3 times |
| 28 |
- 1 occur 4 times |
| 29 |
|
| 30 |
This block reports how many times specific mutations, e.g. ``G27A``\ , were observed. |
| 31 |
The next output block summarizes how often sites in the sequence are hit by mutations. |
| 32 |
This can be compared to a null expectation that mutations are uniformly and independently distributed along the sequence according to a Poisson distribution with the same number of mutations. |
| 33 |
|
| 34 |
.. code-block:: bash |
| 35 |
|
| 36 |
Of the 10807 positions in the genome, |
| 37 |
- 10175 were hit 0 times (expected 10153.59) |
| 38 |
- 480 were hit 1 times (expected 633.25) |
| 39 |
- 69 were hit 2 times (expected 19.75) |
| 40 |
- 12 were hit 3 times (expected 0.41) |
| 41 |
- 5 were hit 4 times (expected 0.01) |
| 42 |
|
| 43 |
This null expectation is almost always going to be rejected since many sites will not tolerate mutations and the evolutionary rate varies considerably across sites. |
| 44 |
Nonetheless, this can be a useful comparison. |
| 45 |
|
| 46 |
Lastly, there is a block that highlights mutations that are most homoplasic. |
| 47 |
By default, ``treetime homoplasy`` will list the first 10 mutations -- this behavior can be adjusted using the option ``-n``. |
| 48 |
|
| 49 |
.. code-block:: bash |
| 50 |
|
| 51 |
The ten most homoplasic mutations are: |
| 52 |
mut multiplicity |
| 53 |
G9344A 4 |
| 54 |
T428A 3 |
| 55 |
T2060C 3 |
| 56 |
A2925G 3 |
| 57 |
G4319A 3 |
| 58 |
T8207C 3 |
| 59 |
C9287T 3 |
| 60 |
A9C 2 |
| 61 |
C11G 2 |
| 62 |
A19C 2 |
| 63 |
|
| 64 |
Additional output |
| 65 |
^^^^^^^^^^^^^^^^^ |
| 66 |
|
| 67 |
``treetime homoplasy`` can be run with the flag ``--detailed`` which will print additional statistics, mostly concerning terminal branches. |
| 68 |
The first extra outputs are on the mutation statistics on terminal branch in analogy to the statistics for the total tree above. |
| 69 |
|
| 70 |
.. code-block:: bash |
| 71 |
|
| 72 |
The TERMINAL branch length is 3.962e-02 and 408 mutations were observed. |
| 73 |
Of these 408 mutations, |
| 74 |
- 353 occur 1 times |
| 75 |
- 23 occur 2 times |
| 76 |
- 3 occur 3 times |
| 77 |
|
| 78 |
The ten most homoplasic mutation on terminal branches are: |
| 79 |
mut multiplicity |
| 80 |
A2925G 3 |
| 81 |
G4319A 3 |
| 82 |
G9344A 3 |
| 83 |
T73G 2 |
| 84 |
... |
| 85 |
|
| 86 |
Lastly, the script outputs a list of sequences that have many mutations on the terminal branches leading up to them that also occur elsewhere in the tree. |
| 87 |
This is can often be a sign of contamination or other problematic sequence. |
| 88 |
|
| 89 |
.. code-block:: bash |
| 90 |
|
| 91 |
Taxons that carry positions that mutated elsewhere in the tree: |
| 92 |
taxon name #of homoplasic mutations |
| 93 |
Natal_RGN|KU527068|2015-07-01|brazil 10 |
| 94 |
Haiti/1/2016|KX051563|2016-02-05|haiti 8 |
| 95 |
PuertoRico/ZF8/2016|PuertoRico/ZF8/2016|2016-06-13|puerto_rico 8 |
| 96 |
Brazil/PE243/2015|KX197192|2015-07-01|brazil 7 |
| 97 |
.... |
| 98 |
|
| 99 |
VCF input and reduced alignments |
| 100 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 101 |
|
| 102 |
When working with larger genomes, sequences are often represented as variants relative to a reference and stored as a vcf file or only variable positions are collated in a fasta file. |
| 103 |
Trees build from such 'variable position only alignments' or SNP matrices have branch length that don't reflect real divergence and need to be rescaled. |
| 104 |
|
| 105 |
If you have a vcf sequence input and a tree build on informative sites only (which will result in much longer branch length), you need to provide a rescaling factor unless branch length in your tree are already rescaled. |
| 106 |
In our case, this would be 271/4411532=0.0000614. |
| 107 |
|
| 108 |
.. code-block:: bash |
| 109 |
|
| 110 |
treetime homoplasy --aln data/tb/lee_2015.vcf.gz --vcf-reference data/tb/tb_ref.fasta --tree data/tb/lee_2015.nwk --rescale 0.0000614 |
| 111 |
|
| 112 |
Similarly, if you have an alignment with informative sites only, you should supplement the number of constant sites not included |
| 113 |
|
| 114 |
.. code-block:: bash |
| 115 |
|
| 116 |
treetime homoplasy --aln data/tb/lee_2015.informative_sites.fasta --tree data/tb/lee_2015.nwk --rescale 0.0000614 --const 4411361 |
| 117 |
|