Transcript Document

Triplet and Quartet Distances
Between Trees of Arbitrary Degree
Gerth Stølting Brodal
Rolf Fagerberg
Aarhus University
University of Southern Denmark
Thomas Mailund, Christian N. S. Pedersen, Andreas Sand
Aarhus University, Bioinformatics Research Center
ACM-SIAM Symposium on Discrete Algorithms, New Orleans, Louisiana, USA, 8 January 2013
Time
Rooted Evolutionary Tree
Bonobo
Chimpanzee
Human
Neanderthal
Gorilla
Orangutan
Unrooted Evolutionary Tree
Dominant modern approach to study evolution is from DNA analysis
Constructing Evolutionary Trees –
Binary or Arbitrary Degrees ?
Sequence data
Distance matrix
1 2 3 ··· n
1
2
3
1
2
3
···
···
n
n
Binary trees
(despite no evidence
in distance data)
Arbitrary degree
(compromise ; good
support for all edges)
....
Neighbor Joining
Saitou, Nei 1987
[ O(n3) Saitou, Nei 1987 ]
Arbitrary degrees
(strong support for all
edges ; few branches)
....
Buneman Trees
Refined Buneman Trees
Moulton, Steel 1999
[ O(n3) Brodal et al. 2003 ]
[
Buneman 1971
O(n3)
Berry, Bryan 1999 ]
Data Analysis vs Expert Trees –
Binary vs Arbitrary Degrees ?
Cultural Phylogenetics of the Tupi Language Family in Lowland South America.
R. S. Walker, S. Wichmann, T. Mailund, C. J. Atkisson. PLoS One. 7(4), 2012.
Neighbor Joining on linguistic data
Linguistic expert classification
(Aryon Rodrigues)
Evolutionary Tree Comparison
split
1357|2468
8
2
4
5
7
6
?

4
5
8
3
2
1
1
3
6
7
T1
T2
Common
Only T1
Only T2
1357|2468
35|124678
57|123468
13567|248
48|123567
Robinson-Foulds distance = # non-common splits = 2 + 1 = 3
D. F. Robinson and L. R. Foulds. Comparison of weighted labeled trees. In Combinatorial
mathematics, VI, Lecture Notes in Mathematics, pages 119–126. Springer, 1979.
[Day 1985] O(n) time algorithm using 2 x DFS + radix sort
Robinson-Foulds Distance (unrooted trees)
D. F. Robinson and L. R. Foulds. Comparison of weighted labeled trees. In Combinatorial
mathematics, VI, Lecture Notes in Mathematics, pages 119–126. Springer, 1979.
3
4
6
3
6
8
2
1
5
?

2
1
8
5
7
T1
4
T2
Common
Only T1
Only T2
(none)
12567|348
1257|3468
157|23468
57|123468
125678|34
12578|346
1578|2346
578|12346
78|123456
7
RF-dist(T1 , T2) = 4 + 5 = 9
RF-dist(T1\{8} , T2\{8}) = 0
Robinson-Foulds very
sensitive to outliers
Quartet Distance (unrooted trees)
G. Estabrook, F. McMorris, and C. Meacham. Comparison of undirected phylogenetic trees
based on subtrees of four evolutionary units. Systematic Zoology, 34:193-200, 1985.
n
Consider all
quartets, i.e. topologies of subsets of 4 leaves {i,j,k,l}
4
j
l
j
l
i
k
i
k
resolved : ij|kl
unresolved : ijkl
(only non-binary trees)
5
5
2
3
4
1
3
4
2
T1
1
T2
Quartet
{1,2,3,4}
{1,2,3,5}
{1,2,4,5}
{1,3,4,5}
{2,3,4,5}
T1
14|23
13|25
14|25
14|35
25|34
T2
14|23
15|23
1245
1345
23|45
n
Quartet-dist(T1 , T2) =
- # common quartets = 5 - 1 = 4
4
Triplet Distance (rooted trees)
D. E. Critchlow, D. K. Pearl, C. L. Qian: The triples distance for rooted bifurcating
phylogenetic trees. Systematic Biology, 45(3):323-334, 1996.
n
Consider all
triplets, i.e. topologies of subsets of 3 leaves {i,j,k}
3
i
j
k
i
1
5
4
T1
2
k
unresolved : ijk
resolved : k|ij
3
j
(only non-binary trees)
2
4
3
1
T2
5
Triplet
{1,2,3}
{1,2,4}
{1,2,5}
{1,3,4}
{1,3,5}
{1,4,5}
{2,3,4}
{2,3,5}
{2,4,5}
{3,4,5}
T1
2|13
1|24
1|25
4|13
5|13
1|45
3|24
3|25
5|24
3|45
n
Triplet-dist(T1 , T2) =
- # common triplets = 10 - 5 = 5
3
T2
2|13
4|12
5|12
4|13
5|13
1|45
4|23
5|23
2|45
3|45
Computational Results
Rooted
Triplet distance
Unrooted
Quartet distance
5
2
3
3
1
5
4
Binary
O(n2)
O(nlog n)
4
O(n3)
2
CPQ 1996
[SODA 2013]
D 1985
1
O(n2)
O(nlog2 n)
O(nlog n)
BTKL 2000
BFP 2001
BFP 2003
10
1 9
3
5
8
7
3
1
5
12
4 62
Degrees  d
O(n2)
O(nlog n)
BDF 2011
[SODA 2013]
6
7
O(d 9nlog n)
O(n2.688)
O(dnlog n)
13
11
SPMBF 2007
NKMP 2011
[SODA 2013]
Distance Computation
n
Triplet-dist(T1 , T2) =
–A–E=B+C+D
3
T2
Resolved
Unresolved
A : Agree
Resolved
i
T1
j
i
k
k
Unresolved
j
k
C
B : Disagree
j
i
j
k
i
i
k
i
i
k
j
D
k
j i
j
E
k
j
j
k
i
i
j
n
A+B+C+D+E=
3
D + E and C + E unresolved in one tree
Sufficient to compute A and E or A and B
k
Parameterized Triplet & Quartet Distances
0α1
B + α·(C + D) ,
T2
Resolved
Unresolved
A : Agree
Resolved
i
T1
j
i
k
k
Unresolved
j
k
C
B : Disagree
j
i
j
k
i
i
k
i
i
k
j
D
k
j i
j
E
k
j
j
k
i
i
j
k
BDF 2011 O(n2) for triplet, NKMP 2011 O(n2.688) for quartet
[SODA 13] O(n·log n) and O(d·n·log n), respectively
Counting Unresolved Triplets in One Tree
v
ni·nj·nk
v i<j<k
n1 n2 n3 ··· nd
Triplet anchored at v
Computable in O(n) time using DFS + dynamic programming
Quartets
(root tree arbitrary)
v
ni·nj·nk·nl + n −
v
i<j<k<l
ni·nj·nk
nl
l
i<j<k
n1 n2 n3 ··· nd
Quartet anchored at v
Counting Agreeing Triplets
(Basic Idea)
0
v
w
j
1
j
i
c
d
i i
T1
ni
vT1 wT2 c 1≤i≤d 2
T2
c
w
c
w
c
n − n − ni + ni
ni
1≤i≤d
w
Efficient Computation
0
v
Limit recolorings in T1 (and T2) to O(n·log n)
1
0
Recolor
v
1
1
1
(precondition)
0
v
2
0
Recolor
v
Recurse
0
1
v
...
T1
0
d
v
1
Recolor &
recurse
Count T2
contribution
1
Reduce recoloring cost in T2 to O(n·log2 n)
T2
arbitrary
height
degree
7
2
4
1
6
3
H(T2)
9 8 5
2
4
1 3
6 9
7
Reduce recoloring cost in T2 from O(n·log2 n) to O(n·log n)
 Contract T2 and reconstruct H(T2) during recursion
5
8
binary
height
O(log n)
Counting Agreeing Triplets (II)
C2
node in H(T2) =
component
composition in T2
T1
0
v
j
i j
i
i
C1
1
i
j
i
d
i
j
i
Contribution to agreeing triplets at node in H(T2)
ni
1≤i≤d
C1
· ni↑∗
C2
+
1≤i≤d
ni
C1
2
n∗
C2
−ni
C2
+
1≤i≤d
n∗
C1
−ni
C1
n(ii)
From O(n·log2 n) to O(n·log n)
T1
Compressed version
of T2 of size O(nv)
0
v
H(T2)
w
1
Update O(1) counters for all
colors through node
j
i
d
ni
nv
Colored path lengths
2≤i≤d
a(4)
T1
a(5)
log |T2| =
ni
Total cost for updating counters
a(3)
a(2)
a(1)
l=a(0)
leaf l∈T1 ancestor a(j)
not heavy child
2≤i≤d
(j+1)
nv
ni ∙ log
ni
na
log a(j) = n· log n
n
Counting Quartets...
 Root T1 and T2 arbitrary
 Keep up to 15+38d different counters per node in H(T2)...
Bottleneck in computing disagreeing resolved-resolved quartets
T1
1
T2
0
v
i
j
d
G1
i j
i j
G2
n(ij)G1 ·n(ij)G2
1≤i<d i<j≤d
double-sum  factor d time
Distance Computation
n
Triplet-dist(T1 , T2) =
–A–E=B+C+D
3
T2
Resolved
Unresolved
A : Agree
Resolved
i
T1
j
i
k
k
Unresolved
j
k
C
B : Disagree
j
i
j
k
i
i
k
i
i
k
j
D
k
j i
j
E
k
j
j
k
i
i
j
n
A+B+C+D+E=
3
D + E and C + E unresolved in one tree
Sufficient to compute A and E or A and B
k
Summary
Rooted
Triplet distance
Unrooted
Quartet distance
5
2
3
3
Binary
1
5
4
2
O(n2)
O(nlog n)
CPQ 1996
[SODA 2013]
o(n·log n) ?
O(n3)
O(n2)
O(nlog2 n)
O(nlog n)
4
BTKL 2000
BFP 2001
BFP 2003
10
1 9
3
D 1985
1
5
8
7
3
Degrees  d
1
5
12
4 62
O(n2)
O(nlog n)
BDF 2011
[SODA 2013]
6
7
O(d 9nlog n)
O(n2.688)
O(dnlog n)
d = maximal degree of any node in T1 and T2
13
11
SPMBF 2007
NKMP 2011
[SODA 2013]
O(n·log n) ?