pairwise alignmentstaffweb.ncnu.edu.tw/shieng/pairwise_alignment.pdf · 2003. 9. 25. · pairwise...

Post on 21-Jan-2021

6 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Pairwise Alignment

Guan-Shieng Huang

shieng@ncnu.edu.tw

Dept. of CSIE, NCNU

Pairwise Alignment – p.1/55

Approach

1. Problem definition

2. Computational method (algorithms)

3. Complexity and performance

Pairwise Alignment – p.2/55

Motivations

• Reconstructing long sequences of DNA formoverlapping sequence fragments

• Determining physical and genetic maps fromprobe data under various experimentprotocols

• Database searching

Pairwise Alignment – p.3/55

• Comparing two of more sequences forsimilarities

• Protein structure prediction (building profiles)• Comparing the same gene sequenced by two

different labs

Pairwise Alignment – p.4/55

Similarity & Difference

1. Common Ancestor Assumption

2. Mutation:(a) substitution (transition, transversion)(b) deletion(c) insertion

We use indel to refer to deletion or insertion.

Pairwise Alignment – p.5/55

What is the difference between acctga andagcta?

acctgaagctgaagct - a

Pairwise Alignment – p.6/55

Key Issues

1. notion of similarity/difference

2. the scoring system used to rank alignments

3. the algorithm used to find optimal scoringalignment

4. the statistical method used to evaluate thesignificance of an alignment score

Pairwise Alignment – p.7/55

Edit Distance

Measure similarity by

1. substitution: −1

2. indel: −2

3. match: +1

a c c t g aa g c t - a1 -1 1 1 -2 1 = 1

Pairwise Alignment – p.8/55

a c c t g aa - g c t a1 -2 -1 -1 -1 1 = −3

a c c t g a- a g c t a

-2 -1 -1 -1 -1 1 = −5

Pairwise Alignment – p.9/55

x: x1x2x3 . . . xm

y: y1y2y3 . . . yn

Alphabet:• Σ = {A,G,C, T} for DNA sequence

• Σ = {A,G,C, U} for RNA sequence

• Σ = {A,C,D,E, F,G,H, I,K, L,

M,N, P,Q,R, S, T, V,W, Y } for proteins

Pairwise Alignment – p.10/55

s(a, b): the score to substitute a by b

s(a,−): delete a

s(−, b): insert b

Pairwise Alignment – p.11/55

Nomenclature

BIOLOGY COMPUTER SCIENCE- sequence - string, word- subsequence - substring (contiguous)- N/A - subsequence- N/A - exact matching- alignment - inexact matching

Pairwise Alignment – p.12/55

Algorithm for PairwiseAlignment

To find the best alignment (with the highestscore) through

• Brute-force• Dynamic programming

Pairwise Alignment – p.13/55

Brute-force Algorithm

Try all possible alignments of x and y.

F (m, n) = F (m − 1, n) + F (m, n − 1) + F (m − 1, n − 1)

k

l

=

k − 1

l − 1

+

k − 1

l

m + n

m

=

m + n − 1

m − 1

+

m + n − 1

m

C(m, n) = C(m − 1, n) + C(m, n − 1)

∴ F (m, n) ≥ C(m, n) =

m + n

m

,

2n

n

'22n

√πn

.

Pairwise Alignment – p.14/55

Dynamic Programming Approach

F (i, j): the score for the best alignment betweenx1 . . . xi and y1 . . . yj.

F (i, j) = max

F (i − 1, j − 1) + 1, xi = yi (match)

F (i − 1, j − 1) − 1, xi 6= yi (substitution)

F (i − 1, j) − 2, align xi with a gap

F (i, j − 1) − 2, align yj with a gap

Pairwise Alignment – p.15/55

{

x1x2 . . . xi−1 xi

y1y2 . . . yj−1 yj

⇒ F (i − 1, j − 1) + s(xi, yi)

{

x1x2 . . . xi−1 xi

y1y2 . . . yj −⇒ F (i − 1, j) − d

{

x1x2 . . . xi −

y1y2 . . . yj−1 yj

⇒ F (i, j − 1) − d

Pairwise Alignment – p.16/55

Alignment Graph

F (i − 1, j − 1) F (i − 1, j)

F (i, j − 1) F (i, j)

+s(xi , y

j )

−d

−d

Initial value:

F (0, 0) = 0, F (0, j) = −jd, F (i, 0) = −id.

Pairwise Alignment – p.17/55

Example- a c c t g a

- 0 -2 -4 -6 -8 -10 -12

a -2 1 -1 -3 -5 -7 -9

g -4 -1 0 -2 -4 -4 -6

c -6 -3 0 1 -1 -3 -5

t -8 -5 -2 -1 2 0 -2

a -10 -7 -4 -3 0 1 1

Pairwise Alignment – p.18/55

Example- a c c t g a

- 0 -2 -4 -6 -8 -10 -12

a -2 1 -1 -3 -5 -7 -9

g -4 -1 0 -2 -4 -4 -6

c -6 -3 0 1 -1 -3 -5

t -8 -5 -2 -1 2 0 -2

a -10 -7 -4 -3 0 1 1backtrace

Pairwise Alignment – p.19/55

a c c t g aa g c t - a

Pairwise Alignment – p.20/55

Complexity

1. time = O(mn)

2. space= O(mn) if we need to find out theoptimal alignment

The problem for space is more serious when m

and n are very large.

Pairwise Alignment – p.21/55

Linear-space AlignmentAlgorithm

B(i, j): the best alignment score of the suffixesxm−i+1 . . . xm and yn−j+1 . . . yn

F (i, j): forward matrix, B(i, j): backward matrixThen

F (m,n) = max0≤k≤n

{F (m

2, k) + B(

m

2, n − k)}.

m2

m2

k n − k

Pairwise Alignment – p.22/55

Algorithm

1. Compute F while saving the m2

-th row.

2. Compute B while saving the m2

-th row.

3. Find the column k∗ such that

F (m

2, k∗) + B(

m

2, n − k∗) = F (m,n).

4. Recursively partition the problem to two sub-problems:

(a) Find the path from (0, 0) to (m2, k∗).

(b) Find the path from (m2, k∗) to (m,n).

Pairwise Alignment – p.23/55

Example- a c c t g a

- 0 -2 -4 -6 -8 -10 -12

a -2 1 -1 -3 -5 -7 -9

g -4 -1 0 -2 -4 -4 -6

c -6 -3 0 1 -1 -3 -5

t -8 -5 -2 -1 2 0 -2

a -10 -7 -4 -3 0 1 1(F (i, j) matrix)

Pairwise Alignment – p.24/55

- a g t c c a

- 0 -2 -4 -6 -8 -10 -12

a -2 1 -1 -3 -5 -7 -9

t -4 -1 0 0 -2 -4 -6

c -6 -3 -2 -1 1 -1 -3

g -8 -5 -2 -3 -2 0 -2

a -10 -7 -4 -3 -4 -2 1(B(i, j) matrix)

Pairwise Alignment – p.25/55

-4 -1 0 -2 -4 -4 -6

-6 -3 -2 -1 1 -1 -3

F (m

2, k∗) + B(

m

2, n − k∗) = F (m,n).

In this case, F (m,n) = 1 and k∗ = 2.

Hence, the best alignment of (acctga,agcta) is the

concatenation of (ac,ag) and (ctga,cta).

Pairwise Alignment – p.26/55

Analysis of Complexity

Clearly, the required space is O(min(m,n)). Fortime complexity, let T (m,n) be the time bound ofthe algorithm.Hence, we have

T (m,n) = T (bm

2c, k) + T (d

m

2e, n − k) + O(mn)

for some k.

Pairwise Alignment – p.27/55

T (m,n) = T (m

2, k) + T (

m

2, n − k) + cmn)

for some k.Suppose T (m,n) = αmn, then the right handside becomes

αm

2· k + α

m

2· (n − k) + cmn =

αmn

2+ cmn.

Let α = 2c, then it equals to the left-hand side.

Pairwise Alignment – p.28/55

For more information on linear-space algorithmsin pairwise alignment, seeChao, K. M., Hardison, R. C., and Miller, W.1994. Recent developments in linear-spacealignment methods: a survey. Journal ofComputational Biology, 1:271–291.

Pairwise Alignment – p.29/55

Revisiting Dynamic Programming

• Principle of optimality• Recurrence• Bottom up

Pairwise Alignment – p.30/55

Substitution matrices

• Suppose we have two models:1. random model2. match model

• Given any two aligned sequencesx = x1 x2 . . . xn

y = y1 y2 . . . yn

where xi is aligned with yi.

Pairwise Alignment – p.31/55

• In random model R, we suppose each letter a occursindependently with some frequency qa. Hence,

Pr(x, y|R) =∏

i

qxi

j

qyj.

• In match model M, letters a and b are aligned with jointprobability pab. Suppose residues a and b have beenderived indep. from some unknown residue c. Hence,

Pr(x, y|M) =∏

i

pxiyi.

Pairwise Alignment – p.32/55

• Define the odds ratio as

Pr(x, y|M)

Pr(x, y|R)=

i pxiyi∏

i qxi

j qyj

=∏

i

pxiyi

qxiqyi

.

• The log-odds ratio:

S =∑

i

s(xi, yi) where s(a, b) = log(pab

qaqb

).

• S > 0 means that x, y are more likely to be an instanceof the match model. (Maximum Likelihood)

• BLOSUM & PAM matrices for proteins

Pairwise Alignment – p.33/55

PAM matrices

1. Dayhoff, Schwartz, Orcutt (1978)

2. The most widely used matrix is PAM250.

Pairwise Alignment – p.34/55

Pairwise Alignment – p.35/55

BLOSUM Matrices

1. Henikoff & Henikoff (1992)

2. Derived from a set of aligned, ungappedregions from protein families called theBLOCKS database.

3. BLOSUM62 is the standard for ungappedmatching.

4. BLOSUM50 is better for alignment with gaps.

Pairwise Alignment – p.36/55

BLOSUM50

Pairwise Alignment – p.37/55

Pairwise Alignment Problems

1. Global alignment (Needleman & Wunsch,1970)

2. Local alignment (Smith-Waterman, 1981)

3. End-space free alignment

4. Gap penality

The version we currently used was due to Gotoh

(1982).

Pairwise Alignment – p.38/55

Global Alignment

Given two sequences x and y, what is the maxi-

mum similarity between them? Find a best align-

ment.

Pairwise Alignment – p.39/55

Local Alignment

Given two sequences x and y, what is the maxi-

mum similarity between a subsequence of x and

a subsequence of y? Find most similar subse-

quences.

Pairwise Alignment – p.40/55

End-space Free Alignment

or

Pairwise Alignment – p.41/55

Global Alignment

F (i, j) = max

F (i − 1, j − 1) + s(xi, yj),

F (i − 1, j) − d,

F (i, j − 1) − d.

with initial value

F (0, 0) = 0, F (0, j) = −jd, F (i, 0) = −id.

And F (m,n) is the score.

Pairwise Alignment – p.42/55

Example

Pairwise Alignment – p.43/55

Local Alignment

Motivation:• Ignore stretches of non-coding DNA.• Protein domains

Pairwise Alignment – p.44/55

Local Alignment

F (i, j) = max

0,

F (i − 1, j − 1) + s(xi, yj),

F (i − 1, j) − d,

F (i, j − 1) − d.

with initial value F (0, 0) = F (0, j) = F (i, 0) = 0. And the

highest value of F (i, j) over the whole matrix is the score.

Pairwise Alignment – p.45/55

Example

Pairwise Alignment – p.46/55

Ends-free Alignment

Motivation:• shotgun sequence assembly

Pairwise Alignment – p.47/55

Ends-free Alignment

F (i, j) = max

F (i − 1, j − 1) + s(xi, yj),

F (i − 1, j) − d,

F (i, j − 1) − d.

with initial value

F (0, 0) = F (0, j) = F (i, 0) = 0.

And the highest value of F (i, j) in the last column F (i∗, n)

or the last row F (m, j∗) is the score.

Pairwise Alignment – p.48/55

Example

Pairwise Alignment – p.49/55

Complexity

All of the above algorithms can be implemented

in time O(mn) and in space O(m + n).

Pairwise Alignment – p.50/55

Gap Penality

• A gap is any maximal consecutive run ofspaces in an alignment.

• The length of a gap is the number of indeloperations in it.

a t t c - - g a - t g g a c ca - - c g t g a t t - - - c c

Pairwise Alignment – p.51/55

Motivation:• Insertion or deletion of an entire sequence

often occurs as a single mutation event.• Two protein sequences might be relatively

similar over several intervals.• cDNA: the complement of mRNA

Pairwise Alignment – p.52/55

Gap Penality Models

1. constant gap penalty model: Wg × #gaps

2. affine gap penalty model: (y = ax + b)Wg × #gaps + Ws × #spaces

3. convex gap penalty model: Wg + log(q) whereq is the length of the gap.

4. arbitrary gap penalty model

Wg: gap-open penalty, Ws: gap-extension penalty

Pairwise Alignment – p.53/55

Complexity

1. constant gap penalty model:Time= O(mn)

2. affine gap penalty model:Time= O(mn)

3. convex gap penalty model:Time= O(mn lg(m + n))

4. arbitrary gap penalty model:Time = O(mn(m + n))

Pairwise Alignment – p.54/55

Conclusion

Pairwise Alignment – p.55/55

top related