+ All Categories
Home > Documents > Introduction to Hidden Markov Models and Profiles in...

Introduction to Hidden Markov Models and Profiles in...

Date post: 06-Jun-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
30
1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah State University – Spring 2010 STAT 5570: Statistical Bioinformatics Notes 6.3
Transcript
Page 1: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

1

Introduction to Hidden Markov

Models and Profiles in Sequence

Alignment

Utah State University – Spring 2010

STAT 5570: Statistical BioinformaticsNotes 6.3

Page 2: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

2

References

� Chapters 3-6 of Biological Sequence Analysis (Durbin et al., 2001)

� Chapter 9 of A First Course in Probability (Ross, 1997)

� Eddy, S. R. (1998). Profile hidden Markov models. Bioinformatics, 14:755-763

Page 3: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

3

The “occasionally dishonest casino”

� A casino usually uses a fair die, but sometimes (5% of the time) switches to a loaded die. Once using the loaded die, they usually keep using it (90% of the time).

� How do you know which die you’re playing?- not sure, but have to look at many plays to see pattern- the “state” here is “hidden”

� One possible representation of this “model”:1: 1/6 1: 1/10 2: 1/6 2: 1/10 3: 1/6 3: 1/10 4: 1/6 4: 1/10 5: 1/6 5: 1/10 6: 1/6 6: 1/2

0.95 0.900.05

0.10Possible partial sequence of rolls:

Roll ...62625335636616366646623...Die ...FFFFFFFFLLLLLLLLLFFFFFF...

L = “loaded” state

Page 4: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

4

Follow-up to a sequence alignment

� Consider pairwise (or multiple) alignment� What does alignment mean?

possibly represents: common ancestry� Possible questions

� Does alignment describe some: “family”?� How can we describe its internal structure?

� Can sometimes characterize these “family”structures as a Markov Chain

Page 5: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

5

“Family” Example: CpG islands

� In DNA: C & G are always matched up in helical structure

� CpG (C followed by G) in sequence is rare, but is more frequent in promoters of start regions of a gene

� General idea: CpG � at start of gene� Possible question about our alignment:

Does CpG frequency suggest we are in apromoter region?

Page 6: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

6

Markov Chain Examples� Occasionally dishonest casino: Probability you are

using a fair die on one play depends on whether you were using a fair die on the previous play.

� Rain indicator: Chance of rain tomorrow depends on whether it rains today

� Gambler’s Ruin: A gambler starts out with a fortune and plays a game repeatedly (with same prob. of winning or losing $1 each time) until her fortune reaches either 0 or M. Her sequence of fortunes is a Markov chain.

� CpG Island: Probability you are in a CpG island at one point in alignment depends on whether you were in a CpG island at the previous point.

Page 7: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

7

Markov Chains – a little more formally

� Sequence of random variables:X0, X1, …

� Set of possible values: {0,1,…,M}� Think of Xt as state of process at time t� This sequence is a Markov Chain if:

P{Xt+1=j | Xt=i,Xt-1=it-1, …, X1=i1, X0=i0} = P{Xt+1=j | Xt=i} = Pij

� So state at time t+1 depends only on: state at time t

Page 8: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

8

Hidden Markov Model (HMM) - vocabulary

� State: in which “family” the process is(CpG vs. not, fair vs. loaded die, etc.)

- the “path”: π ; the ith state in path: πi

� Symbol: observed “outcome” x (sequence, die, etc.) from unknown state

� Transition probabilities:akh = P{πi=h | πi-1=k}

� Emission probabilities:ek(b) = P{xi=b | πi=k }

� Joint probability of observed sequence x & state sequence π : ∏ +

=i

i iiiaxeaxP

11)(),( 0 πππππ

Page 9: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

9

Estimating the HMM path

Several approaches to find the “most probable state path” π*=argmax P(x,π)� Viterbi

� Forward algorithm� Backward algorithm – focuses more on:

posterior state probabilities (position-specific prob. that observation came from state k given observed sequence)

focus on identifying the most probable state path

Page 10: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

10

Estimation when paths unknown: Baum-Welch

� An iterative procedure estimates the transition and emission probabilities

� A special case of the EM algorithm(a general approach to deal with maximum likelihood with missing/incomplete/latent data)

- think of missing covariate: state

� Can also consider an approximation based on iterations of the Viterbi algorithm

Page 11: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

11

Pairwise Alignments as HMMs

X(+1,+0)

Y(+0,+1)

M(+1,+1)

s(xi,yj)

s(xi,yj)

-d

-d

s(xi,yj)-e

-e

Recall notation: x & y are sequences to be aligned, with gap opening penalty of d and gap extension penalty of e

Let (+w,+v) here represent change in sequence position, with M=match, and X,Y=insertion (gap) in x or y

Xqxi

Yqyj

MPxiyj

1- ε

1- ε

δ

δ

1-2δ ε

ε

States: insertion (X or Y), match (M)δ=probability of moving to a specific

insertion stateε=prob. of staying in an insertion state

Page 12: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

12

What can be done with pairwise HMM

� Build HMM for a random (non-matched) model

� Evaluate likelihood of matched model by considering log-odds of matched vs. random models

� Search for other alignments: sub-optimal� Consider posterior probability of alignment:

{ }yxyxP ji ,|“is aligned with”

Page 13: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

13

Using HMMs to describe a “family”

� Suppose we have an alignment of multiple sequences – we can model their “relationship” as a family of sequences – call this the family’s: “profile”

� PSSM – position-specific score matrix- estimate this to: describe this particular profile (e.g., should ‘A’ count for more at a particular position in the alignment?)

� Allow for insertions and deletions, where “cost” could also be position-specific

� Use this profile to describe the alignment and look for other similar sequences

Page 14: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

14

Transition structure of a profile HMM

Begin Mj End

Ij

Dj

specific position of profile

: match state : insertion state : deletion state

Page 15: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

15

How do we get this “family”?

� Multiple Sequence Alignment- many possible strategies to find and score

possible alignments

� One common way: ClustalW� a “progressive alignment” approach� construct pairwise distances based on evolutionary

distance� essentially follow an agglomerative clustering approach,

progressively aligning nodes in order of decreasing similarity

� additional heuristics make final alignment more accurate

Page 16: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

16

Possible

Strategies

image from HMMER (on bioweb.pasteur.fr server)

Page 17: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

17

One possible analysis approach

� Obtain multiple alignment using ClustalW� http://www.ebi.ac.uk/Tools/clustalw2� creates alignment files in various formats

- some specialized for tree-viewing, for example- can get FASTA format of alignment to pass to HMMER

� Obtain HMM model using HMMER� http://bioweb2.pasteur.fr/alignment/intro-en.html� creates a “consensus” sequence to summarize the profile

(hmmbuild)� can use this profile to search database for similar

sequences (hmmsearch)

Page 18: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

18

Example

� (Source: JalView example at ClustalW; same as HW5 data)

� Five proteins from different species (FASTA format)� Mouse (2)� Human� Chicken� Rat

>FOSB_MOUSE Protein fosBMFQAFPGDYDSGSRCSSSPSAESQYLSSVDSFGSPPTAAASQECAGLGEMPGSFVPTVTAITTSQDLQWLVQPTLISSMAQSQGQPLASQPPAVDPYDMPGTSYSTPGLSAYSTGGASGSGGPSTSTTTSGPVSARPARARPRRPREETLTPEEEEKRRVRRERNKLAAAKCRNRRRELTDRLQAETDQLEEEKAELESEIAELQKEKERLEFVLVAHKPGCKIPYEEGPGPGPLAEVRDLPGSTSAKEDGFGWLLPPPPPPPLPFQSSRDAPPNLTASLFTHSEVQVLGDPFPVVSPSYTSSFVLTCPEVSAFAGAQRTSGSEQPSDPLNSPSLLAL>FOSB_HUMAN Protein fosBMFQAFPGDYDSGSRCSSSPSAESQYLSSVDSFGSPPTAAASQECAGLGEMPGSFVPTVTAITTSQDLQWLVQPTLISSMAQSQGQPLASQPPVVDPYDMPGTSYSTPGMSGYSSGGASGSGGPSTSGTTSGPGPARPARARPRRPREETLTPEEEEKRRVRRERNKLAAAKCRNRRRELTDRLQAETDQLEEEKAELESEIAELQKEKERLEFVLVAHKPGCKIPYEEGPGPGPLAEVRDLPGSAPAKEDGFSWLLPPPPPPPLPFQTSQDAPPNLTASLFTHSEVQVLGDPFPVVNPSYTSSFVLTCPEVSAFAGAQRTSGSDQPSDPLNSPSLLAL>FOS_CHICK Proto-oncogene proteinc-fosMMYQGFAGEYEAPSSRCSSASPAGDSLTYYPSPADSFSSMGSPVNSQDFCTDLAVSSANFVPTVTAISTSPDLQWLVQPTLISSVAPSQNRGHPYGVPAPAPPAAYSRPAVLKAPGGRGQSIGRRGKVEQLSPEEEEKRRIRRERNKMAAAKCRNRRRELTDTLQAETDQLEEEKSALQAEIANLLKEKEKLEFILAAHRPACKMPEELRFSEELAAATALDLGAPSPAAAEEAFALPLMTEAPPAVPPKEPSGSGLELKAEPFDELLFSAGPREASRSVPDMDLPGASSFYASDWEPLGAGSGGELEPLCTPVVTCTPCPSTYTSTFVFTYPEADAFPSCAAAHRKGSSSNEPSSDSLSSPTLLAL>FOS_RAT Proto-oncogene protein c-fosMMFSGFNADYEASSSRCSSASPAGDSLSYYHSPADSFSSMGSPVNTQDFCADLSVSSANFIPTVTAISTSPDLQWLVQPTLVSSVAPSQTRAPHPYGLPTPSTGAYARAGVVKTMSGGRAQSIGRRGKVEQLSPEEEEKRRIRRERNKMAAAKCRNRRRELTDTLQAETDQLEDEKSALQTEIANLLKEKEKLEFILAAHRPACKIPNDLGFPEEMSVTSLDLTGGLPEATTPESEEAFTLPLLNDPEPKPSLEPVKNISNMELKAEPFDDFLFPASSRPSGSETARSVPDVDLSGSFYAADWEPLHSSSLGMGPMVTELEPLCTPVVTCTPSCTTYTSSFVFTYPEADSFPSCAAAHRKGSSSNEPSSDSLSSPTLLAL>FOS_MOUSE Proto-oncogene protein c-fosMMFSGFNADYEASSSRCSSASPAGDSLSYYHSPADSFSSMGSPVNTQDFCADLSVSSANFIPTVTAISTSPDLQWLVQPTLVSSVAPSQTRAPHPYGLPTQSAGAYARAGMVKTVSGGRAQSIGRRGKVEQLSPEEEEKRRIRRERNKMAAAKCRNRRRELTDTLQAETDQLEDEKSALQTEIANLLKEKEKLEFILAAHRPACKIPDDLGFPEEMSVASLDLTGGLPEASTPESEEAFTLPLLNDPEPKPSLEPVKSISNVELKAEPFDDFLFPASSRPSGSETSRSVPDVDLSGSFYAADWEPLHSNSLGMGPMVTELEPLCTPVVTCTPGCTTYTSSFVFTYPEADSFPSCAAAHRKGSSSNEPSSDSLSSPTLLAL

Page 19: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

19

ClustalW – quick example

set alignment options here

paste multiple sequences here(in FASTA format, e.g.)

click Run to start alignment

Page 20: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

20

Page 21: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

21

ClustalW – format output in Jalview (Java applet)

>FOS_RAT/1-380MMFSGFNADYEASSSRCSSASPAGDSLSYYHSPADSFSSMGSPVNTQDFCADLSVSSANFIPTVTAISTSPDLQWLVQPTLVSSVAPSQ-------TRAPHPYGLPTPS-TGAYARAGVVKTMSGGRAQSIG--------------------RRGKVEQLSPEEEEKRRIRRERNKMAAAKCRNRRRELTDTLQAETDQLEDEKSALQTEIANLLKEKEKLEFILAAHRPACKIPNDLGFPEEMSVTS-LDLTGGLPEATTPESEEAFTLPLLNDPEPK-PSLEPVKNISNMELKAEPFDDFLFPASSRPSGSETARSVPDVDLSG--SFYAADWEPLHSSSLGMGPMVTELEPLCTPVVTCTPSCTTYTSSFVFTYPEADSFPSCAAAHRKGSSSNEPSSDSLSSPTLLAL>FOS_MOUSE/1-380MMFSGFNADYEASSSRCSSASPAGDSLSYYHSPADSFSSMGSPVNTQDFCADLSVSSANFIPTVTAISTSPDLQWLVQPTLVSSVAPSQ-------TRAPHPYGLPTQS-AGAYARAGMVKTVSGGRAQSIG------------...

from “File” � “Output to Textbox” � “FASTA” format (others available)

Here, color is by BLOSUM62 score

Page 22: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

22

paste FASTA format here(from ClustalW, for example)

http://bioweb2.pasteur.fr/alignment/intro-en.html

Page 23: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

23

hmmbuild results

Page 24: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

24

hmmbuild results (reformatted by hand)

...

192.830.993.443.503.264.272.3519

182.830.993.443.503.264.272.3518

173.132.933.894.124.200.812.6617

163.343.160.883.093.574.913.0816

152.830.993.443.503.264.272.3515

...

...TSRQ...DCAHMM

Page 25: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

25

HMMER – search for “family” members

Page 26: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

26

HMMER – search for “family” members

Page 27: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

27

Page 28: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

28

hmmsearch results

Page 29: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

29

12345678901234567890123456789012alignfile_data 1 mmfqafagdyeasssrcssaspaadslsyyls

mmf++f++dyeasssrcssaspa+dslsyy+sgp|BC029814|BC029814_1 1 MMFSGFNADYEASSSRCSSASPAGDSLSYYHS

(more to profile than just SRCSS)

Page 30: Introduction to Hidden Markov Models and Profiles in ...math.usu.edu/~jrstevens/stat5570/6.3.HMM.pdf · 1 Introduction to Hidden Markov Models and Profiles in Sequence Alignment Utah

30

Summary

� Hidden Markov Models� use to describe sequence alignments� main idea: how does each portion of alignment

represent the “family profile”

� Idea of profile: general “family” characteristics

� Online resources� ClustalW – perform multiple alignments� HMMER – build (& use) HMM model from multiple

alignment


Recommended