Presentation is loading. Please wait.

Presentation is loading. Please wait.

Recap 3 different types of comparisons 1. Whole genome comparison 2. Gene search 3. Motif discovery (shared pattern discovery)

Similar presentations


Presentation on theme: "Recap 3 different types of comparisons 1. Whole genome comparison 2. Gene search 3. Motif discovery (shared pattern discovery)"— Presentation transcript:

1 Recap 3 different types of comparisons 1. Whole genome comparison 2. Gene search 3. Motif discovery (shared pattern discovery)

2 Agenda More about Shared Pattern Discovery Edit Distance – Recap – What you need to know for the next quiz Alignment – More details – More examples

3 Shared Pattern Discovery I have 10 rats that all have green eyes I have 10 rats that all have blue eyes What exactly do the 10 rats have in common that give them green eyes?

4 Shared Pattern Discovery Multiple Alignment can be used to measure the strength a genomic pattern found in a set of sequences – First, completely align the 10 green-eyed rats – Then, align green-eyed rats with blue-eyed rats – Finally, compare the statistical difference Initially, this is how genes were pin-pointed

5 Shared Pattern Discovery Multiple alignment of 10 green-eyed rats Alignment of blue-eyed rat and green-eyed rat 99.2% similar 99.4% similar 99.1% similar 94.5% similar 99.3% similar 95.2% similar 99.2% similar 94.7% similar

6 Recap: Exact string matching Its important to know why exact matching doesn’t work. – Target: CGTACGAC – Pattern: CGTACGTACGTACGTTCA Problem: Target can NOT be found in the pattern even though there is a near-match Sequences either match or don’t match There is no ‘in-between’

7 Recap: Edit Dist. for Local Search Question: How many edits are needed to exactly match the target with part of the pattern – Target: CGTACGAC – Pattern: CGTACGTACGTACGTTCA Answer: 1 deletion Example of local search Gene finding

8 Recap: Edit Dist. for Global Comp. Question: How many edits are needed to exactly match the ENTIRE target the WHOLE pattern – Target: CGTACGAC – Pattern: CGTACGTACGTACGTTCA Answer: 10 deletions Example of global comparison (whole genome comparison)

9 Quiz coming up! You need to be able to compute optimal edit distance. You need to fill-in the table.

10 Edit Distance – Dynamic Programming ACGTCGCAT A C G T G T G C 01234567891 2 3 4 5 6 7 8 0 12345678 1 21234567232123456323212345432321234543432123654543234765655323 Optimal edit distance for TG and TCG Optimal edit distance for TG and TCGA Optimal edit distance for TGA and TCG Final Answer Optimal edit distance for TGA and TCGA

11 Edit Distance int matrix[n+1][m+1]; for (x = 0; x <= n; x++) matrix[x][0] = x; for (y = 1; y <= m; y++) matrix [0][y] = y; for (x = 1; x <= n; x++) for (y = 1; y <= m; y++) if (seq1[x] == seq2[y]) matrix[x][y] = matrix[x-1][y-1]; else matrix[x][y] = max(matrix[x][y-1] + 1, matrix[x-1][y] + 1); return matrix[n][m]; 01234567891 2 3 4 5 6 7 8 012345678 121234567 232123456 323212345 432321234 543432123 654543234 765655323

12 Why Edit Distances Stinks for Genetic Data? DNA evolves in strange ways …TAGATCCCAGATCAGTATTCAAGTTATAC…. …GATCTCCCAGATAGAAGCAGTATTCAGTCA… … CCTATCAGCAGGATCAAGTATGTCATACTAC… The edit distance between rat and virus is smaller than rat and fruit bat. This is a gene in the rat genome This is the same gene in the fruit bat This is a totally unrelated region of the AIDS virus

13 Alignment We need a more robust way to measure similarity Alignment meets several requirements 1. It rewards matches 2. It penalizes mismatches 3. Different strategies for penalizing gaps 4. It helps visualize similarity.

14 Alignment Two examples Seq1GCTAGTATGCCGATACTGA Seq2GCTAGATGCAGATACTTGA Seq3GCTAGTATGCCGATACGA Seq4GATAGACGCAGATGCTTGT What’s more similar – Seq1 & Seq2, or – Seq3 & Seq4

15 Alignment Three steps in the dynamic programming algorithm for alignment 1. Initialization 2. Matrix fill (scoring) 3. Traceback (alignment)

16 Initialization

17 Matrix Fill For each position, Mi,j is defined to be the maximum score at position i,j Mi,j = MAX[Mi-1, j-1 + Si,j (match/mismatch), Mi,j-1 + w (gap in sequence #1), Mi-1,j + w (gap in sequence #2) ]

18 Matrix Fill Mi,j = MAX[Mi-1, j-1 + Si,j (match/mismatch), Mi,j-1 + w (gap in sequence #1), Mi-1,j + w (gap in sequence #2) ] Si,j = 1 if symbols match, otherwise Si,j = 0 w = 0 (no gap penalty)

19 Matrix Fill The score at position 1,1 can be calculated. The first residue in both sequences is a G Thus, S 1,1 = 1 Thus, M 1,1 = MAX[M 0,0 + 1, M 1,0 + 0, M 0,1 + 0] = MAX[1, 0, 0] = 1.

20 Matrix Fill

21

22

23

24 Tracing Back (Seq #1) A | (Seq #2) A

25 Tracing Back (Seq #1) A | (Seq #2) A

26 Tracing back the alignment (Seq #1) TA | (Seq #2) A

27 Tracing Back (Seq #1) TTA | (Seq #2) A

28 Tracing Back (Seq #1) GAATTCAGTTA | | || | | (Seq #2) GGA_TC_G__A

29 Robust Scoring Mi,j = MAX[Mi-1, j-1 + Si,j (match/mismatch), Mi,j-1 + w1 (gap in sequence #1), Mi-1,j + w2 (gap in sequence #2) ] S i,j ACGT A1.10.00.30.5 w1-0.5C1.30.10.0 w2-0.7G1.00.0 T1.2

30 Alignment Scoring S i,j ACGT A1.10.00.30.5 w1-0.5C1.30.10.0 w2-0.7G1.00.0 T1.2 Seq1GTACTACGAC Seq2GAACGTAGAC score1.00.51.11.3-0.51.21.1-0.71.01.11.3 Alignment score = 8.4

31 Alignment Scoring S i,j ACGT A1.10.00.30.5 w1-0.5C1.30.10.0 w2-0.7G1.00.0 T1.2 Seq1GTACTACGAC Seq2GAACGTAGAC score1.00.51.11.3-0.51.21.1-0.71.01.11.3 Can you find a better alignment?

32 Alignment Scoring S i,j ACGT A1.10.00.30.5 w1-0.5C1.30.10.0 w2-0.7G1.00.0 T1.2 Seq1GTACTACGAC Seq2GAACGTAGAC score1.00.51.11.30.00.50.01.01.11.3 Alignment score = 7.8

33 Alignment Scoring Summary: We have a way of rewarding different types of matches and mismatches We have a separate way of penalizing gaps We could choose not to penalize gaps – if we knew that didn’t affect biological similarity We could even reward some types of mismatches – if we knew they were still biological similarity

34 Alignment scoring Process 1. Experts (chemists or biologist) look at sequence segments that are known to be biologically similar and compare them to sequence segments that are biologically disimilar. 2. Use direct observation and statistics to develop a scoring scheme 3. Given the scoring scheme, develop an algorithm to compute the maximum scoring alignment.

35 Alignment – Algorithmic Point of View Align the symbols of two strings. – Maximize the number of symbols that match. – Minimize the number of symbols that do NOT match Gaps can be inserted to improve alignments. A scoring system is used to measure the quality of an alignment. Gap penalty -8 5-3-4-5T -34-4 G 4-3C -5-4-35A TGCA Scoring matrix In practice: – Scoring matrices and gap penalties are based on biological knowledge and statistical analysis

36 Local Alignment and Global Alignment In Global Alignment the two strings must be entirely aligned (every aligned pair of symbols is scored). In Local Alignment segments from each string are aligned and the rest of the string can be ignored Global alignment is used to compare the similarity of entire organisms Local alignment is used to search for genes AGAGTACTCAGTATCTGAT ACATACTACAGTATCCA AGAGTACTCAGTATCTGAT ACATACTACAGTATCCA

37 Alignment Scoring Revisited Given a scoring system, the alignment score is the sum of the scores for each aligned pair of symbols plus the gap penalties Local Alignment AGAGTACTCAGTATCTGAT ACATACTACTGTATCCA ACGT A3-3-4-5 C-32-4 G 2-3 T-5-4-33 -6 3323 2-523332 Total Score = 15

38 Alignment - Computer Science Perspective Given two input strings and a scoring system, find the highest scoring local alignment among all possible alignments. Fact: The number of possible alignments grows exponentially with the length of the input strings Solving this problem efficiently was an open problem until Smith and Waterman (1980) designed an efficient dynamic programming algorithm The algorithm takes O(nm) time where n and m are the lengths of the two input strings

39 Interesting History The Smith Waterman algorithm for computing local alignment is considered one of the most important algorithms in computational biology. However, the algorithm is merely a generalization of the edit distance algorithm, which was already published and well- known in computer science. Converting the edit distance algorithm to solve the alignment problem is “trivial.” Smith and Waterman are consider almost legendary for this accomplishment. It is a perfect example of “being in the right place at the right time.”

40 Smith Waterman Algorithm T 0 C 0 43G 0 0038A 0 C0C0 G0G0 C0C0 A0A00 Dynamic programming table D[i][j]=MAX(0, M[i-1][j-1] + S(i,j), M[i-1][j] + w, M[i][j-1] + w );i j 8-3-4-5T -37-4 G 7-3C -5-4-38A TGCA S(i,j) -5 w -4-5

41 Smith Waterman Algorithm 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 A 0 G 0 C 0 T 0 C 0 A 0 ACGT A6-3-4-5 C-35-4 G 4-3 T-5-4-37 -5 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 A 0610000 G 0125000 C 00611050 T 001351712 C 005081214 A 06113718 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 A 06 G 0 C 0 T 0 C 0 A 0 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 61 G 0 C 0 T 0 C 0 A 0 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 610000 G 0 C 0 T 0 C 0 A 0 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 610000 G 01 C 0 T 0 C 0 A 0 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 610000 G 012 C 0 T 0 C 0 A 0 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 610000 G 0125 C 0 T 0 C 0 A 0

42 Smith Waterman Algorithm 0 A0A0 C0C0 G0G0 C0C0 T0T0 A0A0 A 0610000 G 0125000 C 00611050 T 001351712 C 005081214 A 06113718 A AC T T C C G G CA A


Download ppt "Recap 3 different types of comparisons 1. Whole genome comparison 2. Gene search 3. Motif discovery (shared pattern discovery)"

Similar presentations


Ads by Google