Pair ¡HMMs ¡and ¡Profile ¡HMMs
¡
COMPSCI ¡260 ¡– ¡Spring ¡2016 ¡
Pair HMMs and Profile HMMs COMPSCI 260 Spring 2016 HMM - - PowerPoint PPT Presentation
Pair HMMs and Profile HMMs COMPSCI 260 Spring 2016 HMM An Example 5% M 1 =({ q 0 , q 1 , q 2 },{ Y , R }, P t , P e ) 15% Y =0% R =0% P t = { ( q 0 , q 1 ,1), ( q 1 , q 1 ,0.8), 80% R = 100% Y =
¡
COMPSCI ¡260 ¡– ¡Spring ¡2016 ¡
q 0
100% 80% 15% 30% 70% 5% R=0% Y = 100%
q1
Y=0% R = 100%
q2 M1=({q0,q1,q2},{Y,R},Pt,Pe) Pt={(q0,q1,1), (q1,q1,0.8), (q1,q2,0.15), (q1,q0,0.05), (q2,q2,0.7), (q2,q1,0.3)} Pe={(q1,Y,1), (q1,R,0), (q2,Y,0), (q2,R,1)}
INPUT ¡ The ¡HMM ¡model ¡M: ¡Q={q0, q1, ... , qm}; Pt (qj | qi); Pe (sj | qi) ¡ A ¡sequence ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡and ¡a ¡path ¡ ¡ OUTPUT ¡ What ¡is ¡the ¡probability ¡of ¡generaAng ¡sequence ¡S ¡from ¡path ¡ϕ according ¡to ¡the ¡model ¡M? ¡P(S|ϕ,M)
q 0
100% 80% 15% 30% 70% 5%
A=25% C=25% G=25% T=25% A=10% C=40% G=10% T=40%
CGATATTCGATTCTACGCGCGTATACTAGCTTATCTGATC 011111112222222111111222211111112222111110
q1 q2
P(S |φ) = P
e(xi | yi+1) i=0 L−1
emission prob.
OUTPUT ¡ What ¡is ¡the ¡joint ¡probability ¡of ¡sequence ¡S ¡and ¡path ¡ϕ ¡according ¡ to ¡the ¡model ¡M? ¡P(S,ϕ|M)
P(S |φ) = P
e(xi | yi+1) i=0 L−1
emission prob.
t(yi+1 | yi) i=0 L
transition prob.
P(S,φ) = P(S φ)P(φ)
CGATATTCGATTCTACGCGCGTATACTAGCTTATCTGATC 011111112222222111111222211111112222111110 INPUT ¡ The ¡HMM ¡model ¡M: ¡Q={q0, q1, ... , qm}; Pt (qj | qi); Pe (sj | qi) ¡ A ¡sequence ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡and ¡a ¡path ¡ ¡
INPUT ¡ The ¡HMM ¡model ¡M: ¡Q={q0, q1, ... , qm}; Pt (qj | qi); Pe (sj | qi) ¡ A ¡sequence ¡S: ¡ OUTPUT ¡ What ¡is ¡the ¡most ¡probable ¡path ¡for ¡generaAng ¡sequence ¡S ¡ according ¡to ¡the ¡model ¡M ? -‑ ¡ ¡ ¡“Decoding” ¡
q 0
100% 80% 15% 30% 70% 5%
A=25% C=25% G=25% T=25% A=10% C=40% G=10% T=40%
CGATATTCGATTCTACGCGCGTATACTAGCTTATCTGATC
q1 q2
φmax = argmax
φ
P(φ S, M)
φmax = argmax
φ
P(φ S) = argmax
φ
P(φ,S) P(S) = argmax
φ
P(φ,S) = argmax
φ
P(S φ)P(φ)
t(yi+1 | yi) i=0 L
P(S |φ) = P
e(xi | yi+1) i=0 L−1
φmax = argmax
φ
P
t(q0 yL)
P
e(xi yi+1)P t(yi+1 yi) i=0 L−1
emission prob. transition prob.
– The ¡“best” ¡parse: ¡ϕmax = argmaxϕ P(ϕ|S) – The ¡joint ¡probability: ¡P(ϕmax, S)
parAcular ¡character? ¡
P(S)
emiRng ¡S, ¡regardless ¡of ¡the ¡path? ¡
P(yk = qi S) = P(S,yk = qi) P(S)
algorithms, ¡and ¡“posterior” ¡decoding ¡
P(yk = qi S) = P(S,yk = qi) P(S) = F(i,k)B(i,k) P(S)
“Posterior” decoding:
CGATATTCGATTCTACGCGCGTATACTAGCTTATCTGATC 011111112222222111111222211111112222111110
to state 1 2 from state 0 0 (0%) 1 (100%)
1 1 (4%) 21 (84%) 3 (12%) 2 0 (0%) 3 (20%) 12 (80%) symbol A C G T in state
6 (24%) 7 (28%) 5 (20%) 7 (28%) 2 3 (20%) 3 (20%) 2 (13%) 7 (47%)
− =
1 | | , , , Q h h i j i j i
− Σ =
1 | | , , , h h i k i k i
transitions emissions
OUTPUT: ¡ ¡The ¡parameters ¡of ¡the ¡HMM: Pt (qj | qi); Pe (sj | qi) INPUT: ¡ ¡A ¡set ¡of ¡sequences ¡S ¡generated ¡by ¡the ¡HMM; ¡Q={q0, q1, ... , qm} ¡ Two ¡Solu5ons: ¡
find ¡the ¡most ¡probable ¡path ¡for ¡each ¡training ¡sequence, ¡and ¡then ¡label ¡ the ¡sequence ¡with ¡that ¡path. ¡ ¡Use ¡labeled ¡sequence ¡training ¡on ¡the ¡ resulAng ¡set ¡of ¡sequences ¡and ¡paths. ¡Iterate ¡unAl ¡Viterbi ¡paths ¡do ¡not ¡
posterior ¡decoding ¡to ¡compute ¡the ¡‘forward’ ¡and ¡‘backward’ ¡
probable ¡one) ¡to ¡esAmate ¡expected ¡counts ¡ ¡Ai, j and ¡Ei,k; ¡then ¡use ¡the ¡ same ¡formulas ¡as ¡for ¡labeled ¡sequence ¡training ¡on ¡these ¡expected ¡
A ¡Pair ¡HMM ¡is ¡an ¡HMM ¡which ¡has ¡two ¡output ¡channels ¡rather ¡than ¡
More ¡general ¡Pair ¡HMMs ¡can ¡have ¡many ¡more ¡states, ¡but ¡those ¡states ¡can ¡ all ¡be ¡classified ¡as ¡inser7on ¡states, ¡dele7on ¡states, ¡or ¡match/mismatch ¡
q0 q0 I
The ¡most ¡probable ¡state ¡path ¡ through ¡the ¡Pair ¡HMM ¡ determines ¡the ¡op5mal ¡
M D
CACTCCCAT--------------GGCCCGG--AGCC------CGAGCCGCGCGCCCACAA canFam2 0 60 + . AGCCCTCGCAGAGCCCTGGGAGAGACAGCCTACAGGACTGGACTTGGGGCAGGGAAACAT bosTau2 60 60 + .
TTCAGAGAAAAGATAGGAGATA bosTau2 120 22 + . CGCGGAG---GGGCGGGCGCCA canFam2 120 22 + .
Pair ¡HMMs ¡can ¡be ¡used ¡for ¡simultaneous ¡alignment ¡and ¡annotaAon ¡
q0 q0 I I M D M D
CACTCCCAT--------------GGCCCGG--AGCC------CGAGCCGCGCGCCCACAA canFam2 0 60 + . AGCCCTCGCAGAGCCCTGGGAGAGACAGCCTACAGGACTGGACTTGGGGCAGGGAAACAT bosTau2 60 60 + .
TTCAGAGAAAAGATAGGAGATA bosTau2 120 22 + . CGCGGAG---GGGCGGGCGCCA canFam2 120 22 + .
Generalization: Profile HMMs
G A T C T C A T T T
State ¡transiAon ¡diagram ¡
q0 q0
Graphical ¡model ¡
PWMs ¡are ¡a ¡special ¡case ¡of ¡an ¡HMM: ¡
What are the transition probabilities?
P(L) ¡= ¡2/3 ¡ P(R) ¡= ¡1/3 ¡ ¡
deleAons) ¡
Begin ¡ M1 ¡ M2 ¡ M6 ¡ End ¡ M3 ¡ M4 ¡ M5 ¡ P(R) ¡= ¡2/3 ¡ P(L) ¡= ¡1/3 ¡ P(A) ¡= ¡1/3 ¡ P(V) ¡= ¡1/3 ¡ P(R) ¡= ¡1/3 ¡ ¡ P(Y) ¡= ¡1 ¡ P(V) ¡= ¡2/3 ¡ P(A) ¡= ¡1/3 ¡ P(I) ¡= ¡1 ¡
R I Y V R
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … I1 I2 I0 IL
probabiliAes ¡for ¡entering ¡it ¡the ¡first ¡Ame ¡vs. ¡staying ¡in ¡the ¡insert ¡state ¡
elements ¡emiked ¡from ¡an ¡insert ¡state ¡Ik) ¡? ¡
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … M3 ¡ D1 ¡ D2 ¡ D3 ¡ DL ¡
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … M3 ¡
deleAons ¡as: ¡
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … I1 I2 I0 IL D1 ¡ D2 ¡ DL ¡ … …
as ¡L ¡match/mismatch ¡states ¡ ¡
we ¡sAll ¡need ¡to ¡decide ¡how ¡many ¡states ¡our ¡HMM ¡has ¡(L), ¡what ¡are ¡ the ¡transi7on ¡probabili7es, ¡what ¡are ¡the ¡emission ¡probabili7es. ¡
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … I1 I2 I0 IL D1 ¡ D2 ¡ DL ¡ … …
– The ¡delete ¡states ¡emit ¡no ¡characters ¡ ¡ – Emission ¡probabili7es ¡exist ¡only ¡for ¡insert ¡and ¡match/mismatch ¡ states ¡ – Transi7on ¡probabili7es ¡between ¡states ¡determine ¡how ¡likely ¡it ¡ is ¡to ¡insert ¡or ¡delete ¡an ¡element ¡
V G A
A G E Y V
V D E V V E A
V A G H V K G
V Y S
Y E T S F N A
I P K H I A G A D N G A G Y
1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ Begin ¡ M1 ¡ M2 ¡ M8 ¡ End ¡ … I1 I2 I0 I8
D1 ¡ D2 ¡ D8 ¡
… … M3 ¡ M4 ¡ I3 I4
D3 ¡ D4 ¡
Column height is relative entropy (or information content) at that position: Information content (bits) Letter heights are proportional to frequency Insertion probability
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … I1 I2 I0 IL D1 ¡ D2 ¡ DL ¡ … …
train ¡the ¡model? ¡
VGA--HAGEY V----NVDEV VEA--DVAGH VKG------D VYS--TYETS FNA--NIPKH IAGADNGAGY
many ¡match ¡states ¡do ¡we ¡have ¡in ¡the ¡profile)? ¡
that ¡have ¡amino ¡acids ¡in ¡at ¡least ¡half ¡of ¡the ¡ sequences ¡
for ¡each ¡column ¡except ¡for ¡the ¡fourth ¡and ¡fioh ¡columns ¡ ¡
input ¡sequences ¡
VGA--HAGEY V----NVDEV VEA--DVAGH VKG------D VYS--TYETS FNA--NIPKH IAGADNGAGY
many ¡match ¡states ¡do ¡we ¡have ¡in ¡the ¡profile)? ¡
that ¡have ¡amino ¡acids ¡in ¡at ¡least ¡half ¡of ¡the ¡ sequences ¡
ei,k = Ei,k Ei,h
h=0 |α|−1
− =
=
1 | | , , , Q h h i j i j i
A A a
Begin ¡ M1 ¡ M2 ¡ ML ¡ End ¡ … I1 I2 I0 IL D1 ¡ D2 ¡ DL ¡
VGAHAGEY VNVDEV VEADVAGH VKGD VYSTYETS FNANIPKH IAGNGAGY
fixed ¡before ¡learning ¡
aligned ¡sequences ¡
Using ¡Profile ¡HMMs ¡to ¡idenAfy ¡and ¡align ¡new ¡family ¡members ¡
GENBANK ¡or ¡some ¡other ¡database ¡to ¡find ¡new ¡family ¡members ¡ ¡
new ¡sequence ¡S, ¡it ¡is ¡possible ¡to ¡determine ¡the ¡most ¡probable ¡ sequence ¡of ¡states ¡for ¡generaAng ¡S ¡… ¡ ¡… ¡using ¡Viterbi ¡decoding ¡
(whether ¡it ¡is ¡from ¡some ¡match ¡column ¡j, ¡or ¡an ¡inserAon) ¡…. ¡ ¡… ¡using ¡posterior ¡decoding ¡
that ¡have ¡large ¡probability ¡of ¡being ¡generated ¡by ¡the ¡given ¡profile ¡ ¡
¡
protein ¡family, ¡we ¡can ¡build ¡a ¡Profile ¡HMM ¡for ¡the ¡family ¡
alignment ¡between ¡members ¡of ¡the ¡family ¡
sequences ¡like ¡S ¡
¡
and ¡the ¡process ¡is ¡repeated… ¡ ¡
Iterated ¡BLAST ¡
HMMER is a software suite for protein sequence similarity searches using probabilistic methods. …. Methods are available for searching either a single protein sequence, multiple protein sequence alignment or profile HMM against a target sequence database, and for searching a protein sequence against Pfam…
More ¡informaAon…. ¡
http://hmmer.org