Local Alignment

1 / 44

# Local Alignment - PowerPoint PPT Presentation

Tutorial 2. Local Alignment. Local alignment. What is local alignment? Dynamic programming How to solve a local alignment matrix Reminder – global alignment. Local alignment.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## Local Alignment

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Tutorial 2

Local Alignment

Local alignment

• What is local alignment?
• Dynamic programming
• How to solve a local alignment matrix
• Reminder – global alignment

Local alignment

Local alignment finds one or more alignments describing the most similar region(s) within the sequences to be aligned.

Local Alignment

• Dynamic Programming algorithm for finding local matches between two sequences.
• What is a local match?:
• It is a best-matching, highest-scoring region between two sequences.
• It is a well conserved region between two sequences.

Dynamic Programming

• Conditions
• Division to sub-problems possible
• The problem can be described in a recursive way
• “Bottom-up” approach

Example – solving Fibonacci

Fib(x) = Fib(x-1)+Fib(x-2),

Fib(0)=0 Fib(1)=1

Fib(5) = Fib(3)+Fib(4)

Fib(5) = Fib(2)+Fib(1)+Fib(3)+Fib(2)

Fib(5) = Fib(1)+Fib(0)+Fib(1)+Fib(2)+Fib(1)+Fib(1)+Fib(0)

Fib(5) = Fib(1)+Fib(0)+Fib(1)+ Fib(1)+Fib(0)+Fib(1)+Fib(1)+Fib(0)

Fib(5) = 1+0+1+1+0+1+1+0 = 5

Without using dynamic programming we will need to calculate Fib(2) three times.

Fibonacci

Dynamic programming solution will work “bottom up”:

1. First calculate Fib(2) from known Fib(0) and Fib(1)

2. Calculate Fib(3) using calculated Fib(2) and known Fib(1).

3. Calculate Fib(4) using calculated Fib(3) and Fib(2).

4. Calculate Fib(5) using calculated Fib(4) and Fib(3).

Alignment

[I,J] Best alignment M1..I, N1..J

Alignment

All possible alignments encoded as path in matrix

Global vs Local

• The differences:
• We can start a new match instead of extending a previous alignment.
• Instead of looking only at the far corner, we look anywhere in the table for the best score

Global

Local

• Scoring System
• Match : +1
• Mismatch: -2
• Indel : -1
Local Alignment

Scoring System

• Match : +1 Ni=Mj
• Mismatch: -1 Ni=Mj
• Indel : -2
Local Alignment

Scoring System

• Match : +1 Ni=Mj
• Mismatch: -1 Ni=Mj
• Indel : -2
Local Alignment

Scoring System

• Match : +1
• Mismatch : -1
• Indel : -2
Local Alignment

Scoring System

• Match : +1
• Mismatch : -1
• Indel : -2

N1

-

Local Alignment

Scoring System

• Match : +1
• Mismatch : -1
• Indel : -2

-M1

Local Alignment

Scoring System

• Match : +1
• Mismatch: -1
• Indel : -2

N1-

M1M2

+1 if M2=N2; -1 if M2=N2

Local Alignment

Fill:

1.We fill the table like in global alignment, but we don’t allow negative numbers (turn every negative number to 0)

2.No arrows coming out from cells with a 0.

Scoring System

• Match : +1
• Mismatch: -1
• Indel : -2

N1N2..

M1M2..

N1N2..

M1 -..

-2

N1 -..

M1M2..

+1 if M2=N2; -1 if M2=N2

Local Alignment

Trace:

We trace back from the highest scoring cells.

N1N2..

M1M2..

N1N2..

M1 -..

-2

N1 -..

M1M2..

If you like formulas…

i

i+1

j

Z = max (Si,j+w, Si+1,j+w, Si,j+1+w)

j+1

Z

When w is the score according to the scoring matrix

For example

match or mismatch

2 match

w =

-1 mismatch/indel

Z = max (Si,j+2/-1, Si+1,j-1, Si,j+1-1)

indel

-

T

T

-

-T

-T

+1

T-

-T

-T

T-

-2

-2

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

0

0

0

0

0

0

T1

0

1

0

0

1

0

0

A2

0

A3

0

T4

0

A5

0

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

0

0

0

0

0

0

T1

0

1

0

0

1

0

0

A2

0

0

2

0

0

2

1

A3

0

T4

0

A5

0

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

0

0

0

0

0

0

T1

0

1

0

0

1

0

0

A2

0

0

2

0

0

2

1

A3

0

0

1

1

0

1

3

T4

0

A5

0

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

0

0

0

0

0

0

T1

0

1

0

0

1

0

0

A2

0

0

2

0

0

2

1

A3

0

0

1

1

0

1

3

T4

0

1

0

0

2

0

1

A5

0

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

0

0

0

0

0

0

T1

0

1

0

0

1

0

0

A2

0

0

2

0

0

2

1

A3

0

0

1

1

0

1

3

T4

0

1

0

0

2

0

1

A5

0

0

2

0

0

3

1

TAA

TAA

TACTA

TAATA

+1 if M2=N2; -1 if M2=N2

And Now… Global Alignment

1.We keep negative numbers.

2.Arrows coming out from any cell.

3.We trace back from right-bottom to left-top of the table.

Scoring System

• Match : +1
• Mismatch: -1
• Indel : -2

N1N2..

M1M2..

N1N2..

M1 -..

-2

N1 -..

M1M2..

Match: +1

• Mismatch:-1
• Indel: -2

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

-2

-4

-6

-8

-10

-12

T1

-2

1

-1

-3

-5

-7

-9

A2

-4

-1

2

0

-2

-4

-6

A3

-6

-3

0

1

-1

-1

-3

T4

-8

-5

-2

-1

2

0

-2

A5

-10

-7

-4

-3

0

3

1

Match: +1

• Mismatch:-1
• Indel: -2

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

-2

-4

-6

-8

-10

-12

T1

-2

1

-1

-3

-5

-7

-9

A2

-4

-1

2

0

-2

-4

-6

A3

-6

-3

0

1

-1

-1

-3

T4

-8

-5

-2

-1

2

0

-2

A5

-10

-7

-4

-3

0

3

1

0

T

1

A

2

C

3

T

4

A

5

A

6

0

0

-1

-2

-3

-4

-5

-6

T1

-1

1

-1

-3

-2

-4

-6

A2

-2

-1

2

0

-2

0

-2

A3

-3

-3

0

1

-1

-1

1

T4

-4

-2

-2

-1

2

0

-1

A5

-5

-4

-1

-3

0

3

1

TACTAA

TAATA-

TACTAA

TAAT-A

Global

Local

TACTAA

TAAT-A

TAA

TAA

TACTAA

TAATA-

TACTA

TAATA