COB Sequencealignment
COB Sequencealignment
alignment
Overview
• Alignment
• Global alignment
• Local alignment
• Affine gap penalties
• Divide and conquer
• Linear space alignment
Basic question
NPNQKIITIGSICMVTGIVSLMLQIGNMISIWVSHSIHTGNQH
QAEPISNTNFLTEKAVASVRLAGNSSLCPINGWAVYSKDNSIR
SCSHLECRTFFLTQGALLNDKHSNGTVKDRSPHRTLMSCPVGV
ASACHDGTSWLTIGISGPDNGAVAVLKYNGIITDTIKSWRNNI
FTVMTDGPSNGQASHKIFKMELLKVVKSVELDAPNYHYEECSC
HGSNRPWVSFNQNLEYQIGYICSGVFGDNPRPNDGTGSCGPVS
NGVWIGRTKSTNSRSGFEMIWDPNGWTETDSSFSVKQDIVAIT ...
NPNQKIITIGSICMVTGIVSLMLQIGNMISIWVSHSIHTGNQH
QAEPISNTNFLTEKAVASVRLAGNSSLCPINGWAVYSKDNSIR
SCSHLECRTFFLTQGALLNDKHSNGTVKDRSPHRTLMSCPVGV
ASACHOHMYGODTHEYKILLEDKENNYNNGIITDTIKSWRNNI
FTVMTDGPSNGQASHKIFKMELLKVVKSVELDAPNYHYEECSC
HGSNLPWVSHDGKSWLTIGISGPDNGAVAVLKNDGTGSCGPVS
NGVWITIGSICMVTGIVSLMLQIGNMISTDSSFSVKQDIVAIT ...
source = (0,0)
sink = (|x|, |y|)
Alignment graph
one-to-one correspondence
between alignment and path
from source to sink
⇥
• horizontal write yj
Alignment graph
one-to-one correspondence
between alignment and path
from source to sink
⇥
• horizontal write yj
Alignment graph
one-to-one correspondence
between alignment and path
from source to sink
⇥
• horizontal write yj
Alignment graph
one-to-one correspondence
between alignment and path
from source to sink
⇥
• horizontal write yj
Alignment graph
one-to-one correspondence
between alignment and path
from source to sink
• S[0, 0] = 0 GTA
---
• S[i, 0] = i ⇥
has score 3 ⇥ 3 =-9
• S[0, i] = i ⇥
Dynamic programming to the rescue
• A = a1 . . . an , B = b1 , . . . , bm
match = +8
mismatch = -5
gap = -3
Dynamic programming to the rescue
smith waterman
Local alignment
global local
Local alignment
Local alignment
String similarity
Divide-and-conquer.
! Break up problem into several parts.
! Solve each part recursively.
! Combine solutions to sub-problems into overall solution.
Consequence.
! Brute force: n2.
! Divide-and-conquer: n log n. Divide et impera.
Veni, vidi, vici.
- Julius Caesar
2
Mergesort
Mergesort.
!Divide array into two halves.
!Recursively sort each half.
!Merge two halves to make sorted whole.
A L G O R I T H M S
A L G O R I T H M S divide O(1)
A G L O R H I M S T sort 2T(n/2)
A G H I L M O R S T merge O(n)
5
Merging
A G L O R H I M S T
A G H I
Mergesort recurrence.
' 0 if n = 1
)
T(n) " ( T ( #n /2$ ) + T ( %n /2& ) + n otherwise
{
) 14243 14243
merging
* solve left half solve right half
!
Solution. T(n) = O(n log2 n).
assumes n is a power of 2
" 0 if n = 1
$
T(n) = # n
2T(n /2) + { otherwise
$% 14243
sorting both halves merging
T(2n) = 2T(n) + 2n
= 2n log2 n + 2n
= 2n(log2 (2n) "1) + 2n
= 2n log2 (2n)
10
!
Overview
• Alignment
• Global alignment
• Local alignment
• Affine gap penalties
• Divide and conquer
• Linear space alignment
Basic idea: recycle space