Presentation is loading. Please wait.

Presentation is loading. Please wait.

. Phylogenetic Trees (2) Lecture 12 Based on: Durbin et al Section 7.3, 7.8, Gusfield: Algorithms on Strings, Trees, and Sequences Section 17.

Similar presentations


Presentation on theme: ". Phylogenetic Trees (2) Lecture 12 Based on: Durbin et al Section 7.3, 7.8, Gusfield: Algorithms on Strings, Trees, and Sequences Section 17."— Presentation transcript:

1 . Phylogenetic Trees (2) Lecture 12 Based on: Durbin et al Section 7.3, 7.8, Gusfield: Algorithms on Strings, Trees, and Sequences Section 17.

2 2 Recall: The Four Points Condition Theorem: A set M of L objects is additive iff any subset of four objects can be labeled i,j,k,l so that: d(i,k) + d(j,l) = d(i,l) +d(k,j) ≥ d(i,j) + d(k,l) We call {{i,j},{k,l}} the “split” of {i,j,k,l}. The four point condition doesn’t provides an algorithm to construct a tree from distance matrix, or to decide that there is no such tree (ie, that the set is not additive). The first methods for constructing trees for additive sets used neighbor joining methods:

3 3 Constructing additive trees: The neighbor joining problem Let i, j be neighboring leaves in a tree, let k be their parent, and let m be any other vertex. The formula shows that we can compute the distances of k to all other leaves. This suggest the following method to construct tree from a distance matrix: 1.Find neighboring leaves i,j in the tree, 2. Replace i,j by their parent k and recursively construct a tree T for the smaller set. 3.Add i,j as children of k in T.

4 4 Neighbor Finding How can we find from distances alone a pair of nodes which are neighboring leaves? Closest nodes aren’t necessarily neighboring leaves. A B C D Next we show one way to find neighbors from distances.

5 5 Neighbor Finding: Seitou&Nei method Theorem (Saitou&Nei) Assume all edge weights are positive. If D(i,j) is minimal (among all pairs of leaves), then i and j are neighboring leaves in the tree. i j kl m T1T1 T2T2 The proof is rather involved, and will be skipped.skipped.

6 6 Saitou&Nei proof (to be skipped) Notations used in the proof p(i,j) = the path from vertex i to vertex j; P(D,C) = (e 1,e 2,e 3 ) = (D,E,F,C) A B C D e1e1 e3e3 e2e2 For a vertex i, and an edge e=(i’,j’): N i (e) = |{k : e is on p(i,k)}|. N D (e 1 ) = 3, N D (e 2 ) = 2, N D (e 3 ) = 1 N C (e 1 ) = 1 EF

7 7 Saitou&Nei proof i j kl Rest of T

8 8 Saitou&Nei proof Proof of Theorem: Assume for contradiction that D(i,j) is minimized for i,j which are not neighboring leaves. Let (i,l,...,k,j) be the path from i to j. let T 1 and T 2 be the subtrees rooted at k and l which do not contain edges from P(i,j) (see figure). i j kl T1T1 T2T2 Notation: |T| = #(leaves in T).

9 9 Saitou&Nei proof Case 1: i or j has a neighboring leaf. WLOG j has a neighbor leaf m. A. D(i,j) - D(m,j)=(L-2)(d(i,j) - d(j,m) ) – (r i +r j ) + (r m + r j ) =(L-2)(d(i,k)-d(k,m) )+r m -r i B. r m -r i ≥ (L-2)(d(k,m)-d(i,l)) + (4-L)d(k,l) i j kl m T2T2 Substituting B in A: D(i,j) - D(m,j) ≥ (L-2)(d(i,k)-d(i,l)) + (4-L)d(k,l) = 2d(k,l) > 0, contradicting the minimality assumption. (since for each edge e  P(k,l), N m (e) ≥ 2 and N i (e)  L-2)

10 10 Saitou&Nei proof Case 2: Not case 1. Then both T 1 and T 2 contain 2 neighboring leaves. WLOG |T 2 | ≥ |T 1 |. Let n,m be neighboring leaves in T 1. We shall prove that D(m,n) < D(i,j), which will again contradict the minimality assumption. i j k l m n p T1T1 T2T2

11 11 Saitou&Nei proof i j k l m n p T1T1 T2T2 A. 0 ≤ D(m,n) - D(i,j)= (L-2)(d(m,n) - d(i,j) ) + (r i +r j ) – (r m +r n ) B. r j -r m < (L-2)(d(j,k) – d(m,p)) + (|T 1 |-|T 2 |)d(k,p) C. r i -r n < (L-2)(d(i,k) – d(n,p)) + (|T 1 |-|T 2 |)d(l,p) Adding B and C, noting that d(l,p)>d(k,p): D. (r i +r j ) – (r m +r n ) < (L-2)(d(i,j)-d(n,m)) + 2(|T 1 |-|T 2 |)d(k,p) Substituting D in the right hand side of A: D(m,n ) - D(i,j)< 2(|T 1 |-|T 2 |)d(k,p) ≤ 0, as claimed.

12 12 A simpler neighbor finding method: Select an arbitrary node r. u For each pair of labeled nodes (i,j) let C(i,j) be defined by the following figure: C(i,j) i j r Claim (from final exam, Winter 02-3): Let i, j be such that C(i,j) is maximized. Then i and j are neighboring leaves.

13 13 Neighbor Joining Algorithm u Set M to contain all leaves, and select a root r. |M|=L u If L =2, return tree of two vertices Iteration: u Choose i,j such that C(i,j) is maximal u Create new vertex k, and set u remove i,j, and add k to M u Recursively construct a tree on the smaller set, then add i,j as children on k, at distances d(i,k) and d(j,k). i j k m

14 14 Complexity of Neighbor Joining Algorithm Naive Implementation: Initialization: θ(L 2 ) to compute the C(i,j)’s. Each Iteration: u O(L) to update {C(i,k):i  L} for the new node k. u O(L 2 ) to find the maximal C(i,j). Total of O(L 3 ). i j k m

15 15 Complexity of Neighbor Joining Algorithm Using Heap to store the C(i,j)’s: Initialization: θ(L 2 ) to compute and heapify the C(i,j)’s. Each Iteration: u O(1) to find the maximal C(i,j). u O(L logL) to delete {C(m,i), C(m,j)} and add C(m,k) for all vertices m. Total of O(L 2 log L). (implementation details are omitted)

16 16 Ultrametric trees A more recent (and more efficient) way for constructing and identifying additive trees. Idea: Reduce the problem to constructing trees by the “heights” of the internal nodes. For leaves i,j, D(i,j) represent the “height” of the common ancestor of i and j. A E D C B 8 5 3 3

17 17 Ultrametric Trees Definition: T is an ultrametric tree for a symmetric positive real matrix D if: 1. The leaves of T correspond to the rows&columns of D 2. Internals nodes have at least two sons, and the Least Common Ancestor of i and j is labeled by D(i,j). 3. The labels decrease along paths from root to leaves ABCDE A08853 B0388 C088 D05 E0 A E D C B 8 5 3 3

18 18 We will study later the following question: Given a symmetric positive real matrix D, Is there an ultrametric tree T for D? Centrality of Ultrametric Trees But first we show that algorithm that constructs ultrametric trees from a matrix (or decides that no such tree exists) can be used to construct trees for additive sets and other related problems.

19 19 Use the labels to define weights for all internal edges in the natural way. For this, consider the labels of leaves to be 0. We get an additive ultrametric tree whose height is the label of the root. E D C B 8 5 3 3 2 53 A 33 5 3 3 Transforming Ultrametric Trees to Weighted Trees Note that in this tree all leaves are at the same height. This is why it is called ultrametric.

20 20 Transforming Weighted Trees to Ultrametric Trees A weighted Tree T can be transformed to an ultrametric tree T’ as follows: Step 1: Pick a node k as a root, and “hang” the tree at k. a b c d 2 2 3 4 1 a b cd 2 1 3 4 2 k=a

21 21 Transforming Weighted Trees to Ultrametric Trees Step 2: Let M = max i d(i,k). M is taken to be the height of T’. Label the root by M, and label each internal node j by M-d(k,j). a b c d 2 2 3 4 1 a b cd 2 1 3 4 2 9 7 4 k=a, M=9

22 22 Transforming Weighted Trees to Ultrametric Trees Step 3: “Stretch” edges of leaves so that they are all at distance M from the root M=9 a b cd 2 1 3 4 2 9 7 4 (9) (6) (2)(0) a b cd 7 9 7 4 2 3 4 9 4

23 23 Reconstructing Weighted Trees from Ultrametric Trees M = 9 Weight of an internal edge is the difference between its endpoints. Weights of an edge to leaf i is obtained by substracting M-d(k,i) from its current weight. a b cd 7(-6) 9 7 4 4 9 (-9) 4(-2) a b cd 1 2 3 4 0 2

24 24 Solving the Additive Tree Problem by the Ultrametric Problem: Outline We solve the additive tree problem by reducing it to the ultrametric problem as follows: 1.Given an input matrix D = D(i,j) of distances, transform it to a matrix D’= D’(i,j), where D’(i,j) is the height of the LCA of i and j in the corresponding ultrametric tree T’. 2.Construct the ultrametric tree, T’, for D’. 3.Reconstruct the additive tree T from T’.

25 25 How D’ is constructed from D D’(i,j) should be the height of the Least Common Ancestror of i and j in T’, the ultrametric tree hanged at k: Thus, D’(i,j) = M - d(k,m), where d(k,m) is computed by: a b cd 2 1 3 4 2 9 7

26 26 The transformation of D to D’ abcd a999 b77 c4 d abcd a397 b86 c6 d Distance matrix D a b c d 2 1 3 4 2 9 Ultrametric matrix D’ a b cd 9 7 4 M=9 T T’

27 27 Identifying Ultrametric Trees Definition: A symmetric matrix D is ultrametric iff for each 3 indices i, j, k D(i,j) ≤ max {D(i,k),D(j,k)}. (ie, there is a tie for the maximum value) Theorem: D has an ultrametric tree iff it is ultrametric Proof: Next lecture.


Download ppt ". Phylogenetic Trees (2) Lecture 12 Based on: Durbin et al Section 7.3, 7.8, Gusfield: Algorithms on Strings, Trees, and Sequences Section 17."

Similar presentations


Ads by Google