Preprocessing
This chapter explains how gene trees from the input gene forest are processed by aphid prior to calculating likelihood.
When referring to a tree,
the construct "LCA(species_group)"
refers to the single last common ancestor of these species in the tree,
i.e. the closest node upstream from all species in the group.
Pruning
Every gene tree is first pruned
so that only species of interest are kept.
Species of interest are species occuring in either
the triplet,
the outgroup or
the other
section of the input [taxa] table.
This process reduces the number of node in every tree,
but the branch lengths are conserved.
For instance,
pruning species
A, C, E and H
in the following raw gene tree
with branch lengths a, b, c, etc.:
│q
┌───┴────────┐
│ │p
│ ┌─────┴──────┐
│ │ │o
│ │ ┌───┴────────┐
│a │f │ │n
│ │ │ ┌─────┴──┐
│ ┌──┴──┐ │ │l │
│ │ │e │g ┌──┴──┐ │
│ │b │ │ │ │k │m
│ │ ┌─┴─┐ │ │h ┌─┴─┐ │
│ │ │c │d │ │ │i │j │
A B C D E F G H I
results in the following pruned tree:
│q
│+
│p
┌────┴─────┐
│ │o
│ │+
│f │n
│ ┌──┴──┐
┌─┴─┐ │l │
│ │ ┌─┴─┐ │
│b │e │ │k │m
│ │+ │h │+ │
│ │d │ │i │
B D F G I
The process may a leave an artefactual nonzero scar
on the root branch length
when external nodes like A are pruned.
In subsequent analysis, every "tree" refers to a pruned tree whose root branch length is ignored.
Topology pass
The topology of every tree is analyzed with respect to the species of interest. A tree is rejected if either:
- One or several
tripletspecies are missing from the tree. - The
tripletspecies form a paraphyletic group. - No
outgroupspecies appear in the tree. - The
outgroupspecies form a paraphyletic group. - The
LCA(triplet, outgroup)is not the root of the tree. - If the
triplet_other_monophylyparameter is set:- One or several
otherspecies branch from theoutgroupside of the root.
- One or several
For example, given the following species of interest:
triplet_other_monophyly = false
[taxa]
triplet = "((T, U), V)"
outgroup = "O P Q"
other = "X Y Z"
The following tree topology is included:
│
┌─────────┴───────────┐
│ ┌────┴───┐
┌─────┴──────┐ │ │
│ │ │ │
│ ┌───┴──┐ ┌──┴──┐ │
│ │ │ │ │ │
│ ┌──┴──┐ │ │ ┌─┴─┐ │
│ │ │ │ │ │ │ │
│ ┌─┴─┐ │ │ │ │ │ │
Y T U V Z O P Q X
But it is excluded with
triplet_other_monophyly = true
because the other species X branches between LCA(outgroup) and the root,
instead of between LCA(triplet) and the root.
In subsequent analysis, every "tree" refers to a tree with an accepted topology.
Geometry pass
The geometry pass is an iterative combination of one or two filters applied at once. It happens in several steps:
- Step 1: calculate individual metrics for every gene tree
- Step 2: calculate global statistics over the whole forest based on the results (obtained in step 1).
- Step 3: calculate local statistics for every tree based on the global stastitics (obtained in step 2).
- Step 4: filter out trees whose local statistics (obtained in step 3) fall outside the desired range.
- Repeat from step 2 until no tree gets filtered out on step 4.
Individual metrics (step 1)
Three "mean branch lengths" are calculated for every gene tree \(g\) :
- The overal mean length from root to leaves,
called
mean_length: \(l_g\) - The mean length from
LCA(triplet)to the triplet species, calledmean_triplet: \(t_g\) - The mean length from root to either
outgrouporotherspecies (excludingtripletspecies), calledmean_rest: \(r_g\)
In addition, if the max_clock_ratio parameter is set,
then the "shape" of every tree is calculated as
\[
q_g = \frac{t_g}{r_g}
\]
Global statistics (step 2)
The global_mean_length is calculated over all \(G\) trees as:
\[
L = \frac{\sum_g{l_g}}{G}
\]
In addition, if the max_clock_ratio parameter is set,
the "global shape" of the whole tree forest is calculated as
\[
Q = \frac{\sum_g{t_g}}{\sum_g{r_g}}
\]
Local statistics (step 3)
The relative mutation_rate of every tree is calculated as:
\[
𝛼_g = \frac{l_g}{L}
\]
This mutation rate is the value used during likelihood calculation,
along with the corresponding gene sequence length.
In addition, if the max_clock_ratio parameter is set,
the 'imbalance' of every tree is calculated as:
\[
i_g = \max(\frac{Q}{q_g}, \frac{q_g}{Q})
\]
Filter (step 4)
Trees with any branch count larger than
max_branch_count are rejected as outliers.
Trees with a relative mutation rate larger than
max_relative_mutation_rate are rejected as outliers.
If a tree has a high imbalance value,
it means that it is dissimilar to its enclosing forest,
and the hypothesis that mutation rate is constant accross the tree
is weakened.
Therefore, trees with imbalance greater than max_clock_ratio, if set,
are also rejected.
Filtering is over if no tree has been rejected at this step, otherwise a new filtering pass is repeated from step 2.
In subsequent analysis, every "tree" refers to a tree with an accepted geometry, and the local statistics used are the latest.