CENTER FOR BIOLOGICAL SEQUENCE ANALYSIS Distance Matrix Methods Anders Gorm Pedersen Anders Gorm Pedersen Molecular Evolution Group Molecular Evolution Group Center for Biological Sequence Analysis Center for Biological Sequence Analysis Technical University of Denmark Technical University of Denmark [email protected][email protected]
41
Embed
CENTER FOR BIOLOGICAL SEQUENCE ANALYSIS Distance Matrix Methods Anders Gorm Pedersen Molecular Evolution Group Center for Biological Sequence Analysis.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Distance Matrix Methods
Anders Gorm PedersenAnders Gorm Pedersen
Molecular Evolution GroupMolecular Evolution Group
Center for Biological Sequence AnalysisCenter for Biological Sequence Analysis
Technical University of DenmarkTechnical University of Denmark
D12 ≈ d12 = a + b + cD13 ≈ d13 = a + dD14 ≈ d14 = a + b + eD23 ≈ d23 = d + b + cD24 ≈ d24 = c + eD34 ≈ d34 = d + b + e
Goal:
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Exercise (handout)
• Construct distance matrix (count different positions)Construct distance matrix (count different positions)
• Reconstruct tree and find best set of branch lengthsReconstruct tree and find best set of branch lengths
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Optimal Branch Lengths for a Given Tree: Least Squares
• Fit between given tree and Fit between given tree and observed distances can be observed distances can be expressed as “sum of squared expressed as “sum of squared differences”:differences”:
Q = Q = ΣΣ(D(Dijij - d - dijij))22
• Find branch lengths that minimize Find branch lengths that minimize Q - this is the optimal set of branch Q - this is the optimal set of branch lengths for this tree.lengths for this tree.
S1
S3
S2
S4
a
b
c
d e
Distance along tree
D12 ≈ d12 = a + b + cD13 ≈ d13 = a + dD14 ≈ d14 = a + b + eD23 ≈ d23 = d + b + cD24 ≈ d24 = c + eD34 ≈ d34 = d + b + e
Goal:
j>i
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Optimal Branch Lengths: Least Squares
• Longer distances associated with Longer distances associated with larger errorslarger errors
• Squared deviation may be weighted Squared deviation may be weighted so longer branches contribute less so longer branches contribute less to Q:to Q:
Q = Q = ΣΣ(D(Dijij - d - dijij))22
• Power (n) is typically 1 or 2
S1
S3
S2
S4
a
b
c
d e
Distance along tree
D12 ≈ d12 = a + b + cD13 ≈ d13 = a + dD14 ≈ d14 = a + b + eD23 ≈ d23 = d + b + cD24 ≈ d24 = c + eD34 ≈ d34 = d + b + e
• Can be solved using substitution method or matrix-based methods
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Least Squares Optimality Criterion
• Search through all (or many) tree topologiesSearch through all (or many) tree topologies
• For each investigated tree, find best branch lengths using least For each investigated tree, find best branch lengths using least squares criterion (solve N equations with N unknowns)squares criterion (solve N equations with N unknowns)
• Among all investigated trees, the best tree is the one with the smallest Among all investigated trees, the best tree is the one with the smallest sum of squared errors. sum of squared errors.
• Least squares criterion used both for finding branch lengths on Least squares criterion used both for finding branch lengths on individual trees, and for finding best tree.individual trees, and for finding best tree.
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Minimum Evolution Optimality Criterion
• Search through all (or many) tree topologiesSearch through all (or many) tree topologies
• For each investigated tree, find best branch lengths using least For each investigated tree, find best branch lengths using least squares criterion (solve N equations with N unknowns)squares criterion (solve N equations with N unknowns)
• Among all investigated trees, the best tree is the one with the smallest Among all investigated trees, the best tree is the one with the smallest sum of branch lengths (the shortest tree).sum of branch lengths (the shortest tree).
• Least squares criterion used for finding branch lengths on individual Least squares criterion used for finding branch lengths on individual trees, minimum tree length used for finding best tree.trees, minimum tree length used for finding best tree.
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Superimposed Substitutions
• Actual number of Actual number of
evolutionary events:evolutionary events: 55
• Observed number of Observed number of
differences:differences: 22
• Distance is (almost) always Distance is (almost) always underestimatedunderestimated
ACGGTGC
C T
GCGGTGA
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Model-based correction for superimposed substitutions
• Goal: try to infer the real number of evolutionary events (the real Goal: try to infer the real number of evolutionary events (the real distance) based ondistance) based on
1.1. Observed data (sequence alignment)Observed data (sequence alignment)
2.2. A model of how evolution occursA model of how evolution occurs
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Jukes and Cantor Model
• Four nucleotides assumed to be Four nucleotides assumed to be equally frequent (f=0.25)equally frequent (f=0.25)
• All 12 substitution rates assumed to All 12 substitution rates assumed to be equalbe equal
• Under this model the corrected Under this model the corrected distance is:distance is:
DDJCJC = -0.75 x ln(1-1.33 x D = -0.75 x ln(1-1.33 x DOBSOBS))
• Cluster the two nearest nodes:Cluster the two nearest nodes:– Tree: connect pair of nodes to common ancestral node, compute branch lengths from ancestral Tree: connect pair of nodes to common ancestral node, compute branch lengths from ancestral
node to both descendantsnode to both descendants
– Distance matrix: replace the two joined nodes with the new (ancestral) node. Compute new distance Distance matrix: replace the two joined nodes with the new (ancestral) node. Compute new distance matrix, by finding distance from new node to all other nodesmatrix, by finding distance from new node to all other nodes
• Repeat until all nodes are linked in treeRepeat until all nodes are linked in tree
• Results in only one tree, there is no measure of tree-goodness.Results in only one tree, there is no measure of tree-goodness.
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
• For each tip compute For each tip compute uuii = = ΣΣjj DDijij/(n-2)/(n-2)
(essentially the average distance to all other tips, except the denominator is n-2 instead of n-1)(essentially the average distance to all other tips, except the denominator is n-2 instead of n-1)
• Find the pair of tips, i and j, where Find the pair of tips, i and j, where DDijij-u-uii-u-ujj is smallest is smallest
• Connect the tips i and j, forming a new ancestral node. The branch lengths from the ancestral node Connect the tips i and j, forming a new ancestral node. The branch lengths from the ancestral node to i and j are:to i and j are:
vvii = 0.5 D = 0.5 Dijij + 0.5 (u + 0.5 (uii-u-ujj))
vvjj = 0.5 D = 0.5 Dijij + 0.5 (u + 0.5 (ujj-u-uii))
• Update the distance matrix: Compute distance between new node and each remaining tip as Update the distance matrix: Compute distance between new node and each remaining tip as follows:follows:
DDij,kij,k = (D = (Dikik+D+Djkjk-D-Dijij)/2)/2
• Replace tips i and j by the new node which is now treated as a tipReplace tips i and j by the new node which is now treated as a tip
• Repeat until only two nodes remain.Repeat until only two nodes remain.
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D
A - 17 21 27
B - 12 18
C - 14
D -
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D
A - 17 21 27
B - 12 18
C - 14
D -
i ui
A (17+21+27)/2=32.5
B (17+12+18)/2=23.5
C (21+12+14)/2=23.5
D (27+18+14)/2=29.5
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D
A - 17 21 27
B - 12 18
C - 14
D -
i ui
A (17+21+27)/2=32.5
B (17+12+18)/2=23.5
C (21+12+14)/2=23.5
D (27+18+14)/2=29.5
A B C D
A - -39 -35 -35
B - -35 -35
C - -39
D -
Dij-ui-uj
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D
A - 17 21 27
B - 12 18
C - 14
D -
i ui
A (17+21+27)/2=32.5
B (17+12+18)/2=23.5
C (21+12+14)/2=23.5
D (27+18+14)/2=29.5
A B C D
A - -39 -35 -35
B - -35 -35
C - -39
D -
Dij-ui-uj
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D
A - 17 21 27
B - 12 18
C - 14
D -
i ui
A (17+21+27)/2=32.5
B (17+12+18)/2=23.5
C (21+12+14)/2=23.5
D (27+18+14)/2=29.5
A B C D
A - -39 -35 -35
B - -35 -35
C - -39
D -
Dij-ui-uj
C D
X
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D
A - 17 21 27
B - 12 18
C - 14
D -
i ui
A (17+21+27)/2=32.5
B (17+12+18)/2=23.5
C (21+12+14)/2=23.5
D (27+18+14)/2=29.5
A B C D
A - -39 -35 -35
B - -35 -35
C - -39
D -
Dij-ui-uj
C D
vC = 0.5 x 14 + 0.5 x (23.5-29.5) = 4vD = 0.5 x 14 + 0.5 x (29.5-23.5) = 10
4 10X
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D X
A - 17 21 27
B - 12 18
C - 14
D -
X -
C D
4 10X
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D X
A - 17 21 27
B - 12 18
C - 14
D -
X -
C D
4 10X
DXA = (DCA + DDA - DCD)/2 = (21 + 27 - 14)/2 = 17
DXB = (DCB + DDB - DCD)/2 = (12 + 18 - 14)/2 = 8
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B C D X
A - 17 21 27 17
B - 12 18 8
C - 14
D -
X -
C D
4 10X
DXA = (DCA + DDA - DCD)/2 = (21 + 27 - 14)/2 = 17
DXB = (DCB + DDB - DCD)/2 = (12 + 18 - 14)/2 = 8
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B X
A - 17 17
B - 8
X -
C D
4 10X
DXA = (DCA + DDA - DCD)/2 = (21 + 27 - 14)/2 = 17
DXB = (DCB + DDB - DCD)/2 = (12 + 18 - 14)/2 = 8
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B X
A - 17 17
B - 8
X -
C D
4 10X
i ui
A (17+17)/1 = 34
B (17+8)/1 = 25
X (17+8)/1 = 25
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B X
A - 17 17
B - 8
X -
C D
4 10X
A B X
A - -42 -28
B - -28
X -
Dij-ui-uj
i ui
A (17+17)/1 = 34
B (17+8)/1 = 25
X (17+8)/1 = 25
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B X
A - 17 17
B - 8
X -
C D
4 10X
Dij-ui-uj
A B X
A - -42 -28
B - -28
X -
i ui
A (17+17)/1 = 34
B (17+8)/1 = 25
X (17+8)/1 = 25
CE
NT
ER
FO
R B
IOLO
GIC
AL
SE
QU
EN
CE
AN
ALY
SIS
Neighbor Joining Algorithm
A B X
A - 17 17
B - 8
X -
C D
4 10X
Dij-ui-uj
A B X
A - -42 -28
B - -28
X -
i ui
A (17+17)/1 = 34
B (17+8)/1 = 25
X (17+8)/1 = 25
vA = 0.5 x 17 + 0.5 x (34-25) = 13vD = 0.5 x 17 + 0.5 x (25-34) = 4