Presentation is loading. Please wait.

Presentation is loading. Please wait.

Connection Between Alignment and HMMs. A state model for alignment -AGGCTATCACCTGACCTCCAGGCCGA--TGCCC--- TAG-CTATCAC--GACCGC-GGTCGATTTGCCCGACC IMMJMMMMMMMJJMMMMMMJMMMMMMMIIMMMMMIII.

Similar presentations


Presentation on theme: "Connection Between Alignment and HMMs. A state model for alignment -AGGCTATCACCTGACCTCCAGGCCGA--TGCCC--- TAG-CTATCAC--GACCGC-GGTCGATTTGCCCGACC IMMJMMMMMMMJJMMMMMMJMMMMMMMIIMMMMMIII."— Presentation transcript:

1 Connection Between Alignment and HMMs

2 A state model for alignment -AGGCTATCACCTGACCTCCAGGCCGA--TGCCC--- TAG-CTATCAC--GACCGC-GGTCGATTTGCCCGACC IMMJMMMMMMMJJMMMMMMJMMMMMMMIIMMMMMIII M (+1,+1) I (+1, 0) J (0, +1) Alignments correspond 1-to-1 with sequences of states M, I, J

3 Let’s score the transitions -AGGCTATCACCTGACCTCCAGGCCGA--TGCCC--- TAG-CTATCAC--GACCGC-GGTCGATTTGCCCGACC IMMJMMMMMMMJJMMMMMMJMMMMMMMIIMMMMMIII M (+1,+1) I (+1, 0) J (0, +1) Alignments correspond 1-to-1 with sequences of states M, I, J s(x i, y j ) -d -e

4 How do we find optimal alignment according to this model? Dynamic Programming: M(i, j):Optimal alignment of x 1 …x i to y 1 …y j ending in M I(i, j): Optimal alignment of x 1 …x i to y 1 …y j ending in I J(i, j): Optimal alignment of x 1 …x i to y 1 …y j ending in J The score is additive, therefore we can apply DP recurrence formulas

5 Needleman Wunsch with affine gaps – state version Initialization: M(0,0) = 0; M(i,0) = M(0,j) = - , for i, j > 0 I(i,0) = d + i  e;J(0,j) = d + j  e Iteration: M(i – 1, j – 1) M(i, j) = s(x i, y j ) + max I(i – 1, j – 1) J(i – 1, j – 1) e + I(i – 1, j) I(i, j) = maxe + J(i, j – 1) d + M(i – 1, j – 1) e + I(i – 1, j) J(i, j) = maxe + J(i, j – 1) d + M(i – 1, j – 1) Termination: Optimal alignment given by max { M(m, n), I(m, n), J(m, n) }

6 Probabilistic interpretation of an alignment An alignment is a hypothesis that the two sequences are related by evolution Goal: Produce the most likely alignment Assert the likelihood that the sequences are indeed related

7 A Pair HMM for alignments M P(x i, y j ) I P(x i ) J P(y j ) 1 – 2  –  1 – 2  –        BEGIN END M J I    1 – 2  – 

8 A Pair HMM for not aligned sequences BEGIN I P(x i ) END BEGIN J P(y j ) END 1 -    P(x, y | R) =  (1 –  ) m P(x 1 )…P(x m )  (1 –  ) n P(y 1 )…P(y n ) =  2 (1 –  ) m+n  i P(x i )  j P(y j ) Model R

9 To compare ALIGNMENT vs. RANDOM hypothesis Every pair of letters contributes: (1 – 2  –  ) P(x i, y j ) when matched  P(x i ) P(y j ) when gapped (1 –  ) 2 P(x i ) P(y j ) in random model Focus on comparison of P(x i, y j ) vs. P(x i ) P(y j ) BEGIN I P(x i ) END BEGIN J P(y j ) END 1 -    M P(x i, y j ) I P(x i ) J P(y j ) 1 – 2  –  1 – 2  –      

10 To compare ALIGNMENT vs. RANDOM hypothesis Idea: We will divide alignment score by the random score, and take logarithms Let P(x i, y j ) (1 – 2  –  ) s(x i, y j ) = log ––––––––––– + log ––––––––––– P(x i ) P(y j ) (1 –  ) 2  (1 – 2  –  ) P(x i ) d = – log –––––––––––––––––––– (1 –  ) (1 – 2  –  ) P(x i )  P(x i ) e = – log ––––––––––– (1 –  ) P(x i ) Every letter b in random model contributes (1 –  ) P(b)

11 The meaning of alignment scores Because , , are small, and ,  are very small, P(x i, y j ) (1 – 2  –  ) P(x i, y j ) s(x i, y j ) = log ––––––––– + log ––––––––––  log –––––––– + log(1 – 2  ) P(x i ) P(y j ) (1 –  ) 2 P(x i ) P(y j )  (1 –  –  ) 1 –  d = – log ––––––––––––––––––  – log  –––––– (1 –  ) (1 – 2  –  ) 1 – 2   e = – log –––––––  – log  (1 –  )

12 The meaning of alignment scores The Viterbi algorithm for Pair HMMs corresponds exactly to the Needleman-Wunsch algorithm with affine gaps However, now we need to score alignment with parameters that add up to probability distributions   1/mean arrival time of next gap   1/mean length of next gap  affine gaps decouple arrival time with length   1/mean length of conserved segments(set to ~0)   1/mean length of sequences of interest(set to ~0)

13 The meaning of alignment scores Match/mismatch scores: P(x i, y j ) s(a, b)  log ––––––––––– (let’s ignore log(1 – 2  ) for the moment – assume no gaps) P(x i ) P(y j ) Example: Say DNA regions between human and mouse have average conservation of 50% Then P(A,A) = P(C,C) = P(G,G) = P(T,T) = 1/8 (so they sum to ½) P(A,C) = P(A,G) =……= P(T,G) = 1/24 (24 mismatches, sum to ½) Say P(A) = P(C) = P(G) = P(T) = ¼ log [ (1/8) / (1/4 * 1/4) ] = log 2 = 1, for match Then, s(a, b) = log [ (1/24) / (1/4 * 1/4) ] = log 16/24 = -0.585 Note: 0.585 / 1.585 = 37.5 According to this model, a 37.5%-conserved sequence with no gaps would score on average 0.375 * 1 – 0.725 * 0.585 = 0 Why? 37.5% is between the 50% conservation model, and the random 25% conservation model !

14 Substitution matrices A more meaningful way to assign match/mismatch scores For protein sequences, different substitutions have dramatically different frequencies! BLOSUM matrices: 1.Start from BLOCKS database (curated, gap-free alignments) 2.Cluster sequences according to > X% identity 3.Calculate A ab : # of aligned a-b in distinct clusters, correcting by 1/mn, where m, n are the two cluster sizes 4.Estimate P(a) = (  b A ab )/(  c≤d A cd ); P(a, b) = A ab /(  c≤d A cd )

15 BLOSUM matrices BLOSUM 50 BLOSUM 62 (The two are scaled differently)

16 DNA Sequencing

17 Next few topics DNA Sequencing  Sequencing strategies Hierarchical Online (Walking) Whole Genome Shotgun  Sequencing Assembly Gene Recognition  The GENSCAN hidden Markov model  Comparative Gene Recognition – Twinscan, SLAM Large-scale and multiple sequence alignment Microarrays, Regulation, and Motif-finding Evolution and Phylogeny RNA Structure and Modeling

18 New topic: DNA sequencing How we obtain the sequence of nucleotides of a species …ACGTGACTGAGGACCGTG CGACTGAGACTGACTGGGT CTAGCTAGACTACGTTTTA TATATATATACGTCGTCGT ACTGATGACTAGATTACAG ACTGATTTAGATACCTGAC TGATTTTAAAAAAATATT…

19 Which representative of the species? Which human? Answer one: Answer two: it doesn’t matter Polymorphism rate: number of letter changes between two different members of a species Humans: ~1/1,000 Other organisms have much higher polymorphism rates

20 Why humans are so similar A small population that interbred reduced the genetic variation Out of Africa ~ 100,000 years ago Out of Africa

21 Migration of human variation http://info.med.yale.edu/genetics/kkidd/point.html

22 Migration of human variation http://info.med.yale.edu/genetics/kkidd/point.html

23 Migration of human variation http://info.med.yale.edu/genetics/kkidd/point.html

24 DNA Sequencing Goal: Find the complete sequence of A, C, G, T’s in DNA Challenge: There is no machine that takes long DNA as an input, and gives the complete sequence as output Can only sequence ~500 letters at a time

25 DNA sequencing – vectors + = DNA Shake DNA fragments Vector Circular genome (bacterium, plasmid) Known location (restriction site)

26 Different types of vectors VECTORSize of insert Plasmid 2,000-10,000 Can control the size Cosmid40,000 BAC (Bacterial Artificial Chromosome) 70,000-300,000 YAC (Yeast Artificial Chromosome) > 300,000 Not used much recently

27 DNA sequencing – gel electrophoresis 1.Start at primer(restriction site) 2.Grow DNA chain 3.Include dideoxynucleoside (modified a, c, g, t) 4.Stops reaction at all possible points 5.Separate products with length, using gel electrophoresis

28 Electrophoresis diagrams

29 Challenging to read answer

30

31

32 Reading an electropherogram 1.Filtering 2.Smoothening 3.Correction for length compressions 4.A method for calling the letters – PHRED PHRED – PHil’s Read EDitor (by Phil Green) Based on dynamic programming Several better methods exist, but labs are reluctant to change

33 Output of PHRAP: a read A read: 500-700 nucleotides A C G A A T C A G …A 16 18 21 23 25 15 28 30 32 …21 Quality scores: -10  log 10 Prob(Error) Reads can be obtained from leftmost, rightmost ends of the insert Double-barreled sequencing: Both leftmost & rightmost ends are sequenced

34 Method to sequence segments longer than 500 cut many times at random (Shotgun) genomic segment Get one or two reads from each segment ~500 bp

35 Reconstructing the Sequence (Fragment Assembly) Cover region with ~7-fold redundancy (7X) Overlap reads and extend to reconstruct the original genomic region reads

36 Definition of Coverage Length of genomic segment:L Number of reads: n Length of each read:l Definition: Coverage C = n l / L How much coverage is enough? Lander-Waterman model: Assuming uniform distribution of reads, C=10 results in 1 gapped region /1,000,000 nucleotides C

37 Challenges with Fragment Assembly Sequencing errors ~1-2% of bases are wrong Repeats Computation: ~ O( N 2 ) where N = # reads false overlap due to repeat

38 Repeats Bacterial genomes:5% Mammals:50% Repeat types: Low-Complexity DNA (e.g. ATATATATACATA…) Microsatellite repeats (a 1 …a k ) N where k ~ 3-6 (e.g. CAGCAGTAGCAGCACCAG) Transposons  SINE (Short Interspersed Nuclear Elements) e.g., ALU: ~300-long, 10 6 copies  LINE (Long Interspersed Nuclear Elements) ~500-5,000-long, 200,000 copies  LTR retroposons (Long Terminal Repeats (~700 bp) at each end) cousins of HIV Gene Families genes duplicate & then diverge (paralogs) Recent duplications ~100,000-long, very similar copies

39 Strategies for whole-genome sequencing 1.Hierarchical – Clone-by-clone yeast, worm, human i.Break genome into many long fragments ii.Map each long fragment onto the genome iii.Sequence each fragment with shotgun 2.Online version of (1) – Walkingrice genome i.Break genome into many long fragments ii.Start sequencing each fragment with shotgun iii.Construct map as you go 3.Whole Genome Shotgunfly, human, mouse, rat, fugu One large shotgun pass on the whole genome

40 Hierarchical Sequencing

41 Hierarchical Sequencing Strategy 1.Obtain a large collection of BAC clones 2.Map them onto the genome (Physical Mapping) 3.Select a minimum tiling path 4.Sequence each clone in the path with shotgun 5.Assemble 6.Put everything together a BAC clone map genome

42 Methods of physical mapping Goal: Map the clones relative to one another Use the map to select a minimal tiling set of clones to sequence Methods: Hybridization Digestion

43 1. Hybridization Short words, the probes, attach to complementary words 1.Construct many probes p 1, p 2, …, p n 2.Treat each clone C i with all probes 3.Record all attachments (C i, p j ) 4.Same words attaching to clones X, Y  overlap p1p1 pnpn

44 Hybridization – Computational Challenge Matrix: m probes  n clones (i, j):1, if p i hybridizes to C j 0, otherwise Definition: Consecutive ones matrix 1s are consecutive in each row & col Computational problem: Reorder the probes so that matrix is in consecutive-ones form Can be solved in O(m 3 ) time (m > n) p 1 p 2 …………………….p m C 1 C 2 ……………….C n 1 0 1…………………...0 1 1 0 …………………..0 0 0 1 …………………..1 p i1 p i2 …………………….p im C j1 C j2 ……………….C jn 1 1 1 0 0 0……………..0 0 1 1 1 1 1……………..0 0 0 1 1 1 0……………..0 0 0 0 0 0 0………1 1 1 0 0 0 0 0 0 0………0 1 1 1

45 Hybridization – Computational Challenge If we put the matrix in consecutive-ones form, then we can deduce the order of the clones & which pairs of clones overlap p i1 p i2 …………………….p im C j1 C j2 ……………….C jn 1 1 1 0 0 0……………..0 0 1 1 1 1 1……………..0 0 0 1 1 1 0……………..0 0 0 0 0 0 0………1 1 1 0 0 0 0 0 0 0………0 1 1 1 C j1 C j2 ……………….C jn p i1 p i2 ………………………………….p im

46 Hybridization – Computational Challenge Additional challenge: A probe (short word) can hybridize in many places in the genome Computational Problem: Find the order of probes that implies the minimal probe repetition Equivalent: find the shortest string of probes such that each clone appears as a substring APX-hard Solutions: Greedy, Probabilistic, Lots of manual curation p 1 p 2 …………………….p m C 1 C 2 ……………….C n 1 0 1…………………...0 1 1 0 …………………..0 0 0 1 …………………..1

47 2.Digestion Restriction enzymes cut DNA where specific words appear 1.Cut each clone separately with an enzyme 2.Run fragments on a gel and measure length 3.Clones C a, C b have fragments of length { l i, l j, l k }  overlap Double digestion: Cut with enzyme A, enzyme B, then enzymes A + B

48 Online Clone-by-clone The Walking Method

49 The Walking Method 1.Build a very redundant library of BACs with sequenced clone-ends (cheap to build) 2.Sequence some seed clones 3.Walk from seeds using clone-ends to pick library clones that extend left & right

50 Walking: An Example

51 Advantages & Disadvantages of Hierarchical Sequencing Hierarchical Sequencing  ADV. Easy assembly  DIS. Build library & physical map; redundant sequencing Whole Genome Shotgun (WGS)  ADV. No mapping, no redundant sequencing  DIS. Difficult to assemble and resolve repeats The Walking method – motivation Sequence the genome clone-by-clone without a physical map The only costs involved are:  Library of end-sequenced clones (CHEAP)  Sequencing

52 Walking off a Single Seed ADV:Low redundant sequencing DIS:Too many sequential steps

53 Walking off Several Seeds in Parallel Few sequential steps Additional redundant sequencing In general, can sequence a genome in ~5 walking steps, with <20% redundant sequencing EfficientInefficient


Download ppt "Connection Between Alignment and HMMs. A state model for alignment -AGGCTATCACCTGACCTCCAGGCCGA--TGCCC--- TAG-CTATCAC--GACCGC-GGTCGATTTGCCCGACC IMMJMMMMMMMJJMMMMMMJMMMMMMMIIMMMMMIII."

Similar presentations


Ads by Google