Sequence Alignment I Lecture #2

Slides:



Advertisements
Similar presentations
Feichter_DPG-SYKL03_Bild-01. Feichter_DPG-SYKL03_Bild-02.
Advertisements

1 Vorlesung Informatik 2 Algorithmen und Datenstrukturen (Parallel Algorithms) Robin Pomplun.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
February 21, 2002 Simplex Method Continued
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Year 6 mental test 10 second questions
Solve Multi-step Equations
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Turing Machines.
Randomized Algorithms Randomized Algorithms CS648 1.
11 Data Structures Foundations of Computer Science ã Cengage Learning.
Data Structures Using C++
EU market situation for eggs and poultry Management Committee 20 October 2011.
Hash Tables.
Chapter 10: Virtual Memory
2 |SharePoint Saturday New York City
Thomas Jellema & Wouter Van Gool 1 Question. 2Answer.
VOORBLAD.
Name Convolutional codes Tomashevich Victor. Name- 2 - Introduction Convolutional codes map information to code bits sequentially by convolving a sequence.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
25 seconds left…...
Analyzing Genes and Genomes
. Lecture #8: - Parameter Estimation for HMM with Hidden States: the Baum Welch Training - Viterbi Training - Extensions of HMM Background Readings: Chapters.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Essential Cell Biology
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
User Defined Functions Lesson 1 CS1313 Fall User Defined Functions 1 Outline 1.User Defined Functions 1 Outline 2.Standard Library Not Enough #1.
Computational Genomics Lecture #3a
Solusi DP Menggunakan Software Pertemuan 24 : (Off Class) Mata kuliah:K0164-Pemrograman Matematika Tahun:2008.
. Sequence Alignment I Lecture #2 This class has been edited from Nir Friedman’s lecture which is available at Changes made by.
Sequence Alignment Tutorial #2
Sequence Alignment Tutorial #2
Sequence Alignment Algorithms in Computational Biology Spring 2006 Edited by Itai Sharon Most slides have been created and edited by Nir Friedman, Dan.
. Computational Genomics Lecture #3a (revised 24/3/09) This class has been edited from Nir Friedman’s lecture which is available at
Class 2: Basic Sequence Alignment
. Sequence Alignment I Lecture #2 This class has been edited from Nir Friedman’s lecture. Changes made by Dan Geiger, then Shlomo Moran. Background Readings:
. Sequence Alignment. Sequences Much of bioinformatics involves sequences u DNA sequences u RNA sequences u Protein sequences We can think of these sequences.
Pairwise Sequence Alignment BMI/CS 776 Mark Craven January 2002.
1 Sequence Alignment Input: two sequences over the same alphabet Output: an alignment of the two sequences Example: u GCGCATGGATTGAGCGA u TGCGCCATTGATGACCA.
. Sequence Alignment. Sequences Much of bioinformatics involves sequences u DNA sequences u RNA sequences u Protein sequences We can think of these sequences.
Pairwise sequence alignment Lecture 02. Overview  Sequence comparison lies at the heart of bioinformatics analysis.  It is the first step towards structural.
. Sequence Alignment Author:- Aya Osama Supervision:- Dr.Noha khalifa.
Introduction to Sequence Alignment. Why Align Sequences? Find homology within the same species Find clues to gene function Practical issues in experiments.
Sequence Alignment ..
Sequence Alignment Tutorial #2
Presentation transcript:

Sequence Alignment I Lecture #2 Background Readings: Gusfield, chapter 11. Durbin et. al., chapter 2. This class has been edited from Nir Friedman’s lecture which is available at www.cs.huji.ac.il/~nir. Changes made by Dan Geiger, then Shlomo Moran, and finally Benny Chor. .

Sequence Comparison Much of bioinformatics involves sequences DNA sequences RNA sequences Protein sequences We can think of these sequences as strings of letters DNA & RNA: alphabet ∑ of 4 letters (A,C,T/U,G) Protein: alphabet ∑ of 20 letters (A,R,N,D,C,Q,…)

Sequence Comparison (cont) Finding similarity between sequences is important for many biological questions For example: Find similar proteins Allows to predict function & structure Locate similar subsequences in DNA Allows to identify (e.g) regulatory elements Locate DNA sequences that might overlap Helps in sequence assembly g1 g2

Sequence Alignment Input: two sequences over the same alphabet Output: an alignment of the two sequences Example: GCGCATGGATTGAGCGA TGCGCCATTGATGACCA A possible alignment: -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A

Alignments -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A Three “components”: Perfect matches Mismatches Insertions & deletions (indel) Formal definition of alignment:

Choosing Alignments There are many (how many?) possible alignments For example, compare: -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A to ------GCGCATGGATTGAGCGA TGCGCC----ATTGATGACCA-- Which one is better?

Scoring Alignments Motivation: Similar (“homologous”) sequences evolved from a common ancestor In the course of evolution, the sequences changed from the ancestral sequence by random mutations: Replacements: one letter changed to another Deletion: deletion of a letter Insertion: insertion of a letter Scoring of sequence similarity should reflect how many and which operations took place

A Naive Scoring Rule Each position scored independently, using: Match: +1 Mismatch : -1 Indel -2 Score of an alignment is sum of position scores

Example -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A Score: (+1x13) + (-1x2) + (-2x4) = 3 ------GCGCATGGATTGAGCGA TGCGCC----ATTGATGACCA-- Score: (+1x5) + (-1x6) + (-2x11) = -23 according to this scoring, first alignment is better

More General Scores The choice of +1,-1, and -2 scores is quite arbitrary Depending on the context, some changes are more plausible than others Exchange of an amino-acid by one with similar properties (size, charge, etc.) vs. Exchange of an amino-acid by one with very different properties Probabilistic interpretation: (e.g.) How likely is one alignment versus another ?

Additive Scoring Rules We define a scoring function by specifying (x,y) is the score of replacing x by y (x,-) is the score of deleting x (-,x) is the score of inserting x The score of an alignment is defined as the sum of position scores

The Optimal Score The optimal (maximal) score between two sequences is the maximal score of all alignments of these sequences, namely, Computing the maximal score or actually finding an alignment that yields the maximal score are closely related tasks with similar algorithms. We now address these problems.

Computing Optimal Score How can we compute the optimal score ? If |s| = n and |t| = m, the number A(m,n) of possible alignments is large! Exercise: Show that So it is not a good idea to go over all alignments The additive form of the score allows us to apply dynamic programming to compute optimal score efficiently. הנוסחה כנראה לא מדוייקת

Recursive Argument Suppose we have two sequences: s[1..n+1] and t[1..m+1] The best alignment must be one of three cases: 1. Last match is (s[n+1],t[m +1] ) 2. Last match is (s[n +1],-) 3. Last match is (-, t[m +1] )

Recursive Argument Suppose we have two sequences: s[1..n+1] and t[1..m+1] The best alignment must be one of three cases: 1. Last match is (s[n+1],t[m +1] ) 2. Last match is (s[n +1],-) 3. Last match is (-, t[m +1] )

Recursive Argument Suppose we have two sequences: s[1..n+1] and t[1..m+1] The best alignment must be one of three cases: 1. Last match is (s[n+1],t[m +1] ) 2. Last match is (s[n +1],-) 3. Last match is (-, t[m +1] )

Useful Notation (ab)use of notation: V[i,j] = value of optimal alignment between i prefix of s and j prefix of t.

Recursive Argument (ab)use of notation: V[i,j] = value of optimal alignment between i prefix of s and j prefix of t. Using our recursive argument, we get the following recurrence for V: V[i,j] V[i+1,j] V[i,j+1] V[i+1,j+1]

Recursive Argument Of course, we also need to handle the base cases in the recursion (boundary of matrix): S T AA - - versus We fill the “interior of matrix” using our recurrence rule

Dynamic Programming Algorithm S T We continue to fill the matrix using the recurrence rule

Dynamic Programming Algorithm S T V[0,0] V[0,1] V[1,0] V[1,1] +1 -2 -A A- -2 (A- versus -A) versus

Dynamic Programming Algorithm S T (hey, what is the scoring function s(x,y) ? )

Dynamic Programming Algorithm S T Conclusion: V(AAAC,AGC) = -1

Reconstructing the Best Alignment To reconstruct the best alignment, we record which case(s) in the recursive rule maximized the score S T

Reconstructing the Best Alignment We now trace back a path that corresponds to the best alignment AAAC AG-C S T

Reconstructing the Best Alignment More than one alignment could have the best score (sometimes, even exponentially many) S T AAAC A-GC AAAC -AGC AG-C

Time Complexity Space: O(mn) Time: O(mn) Filling the matrix O(mn) Backtrace O(m+n) S T

Space Complexity In real-life applications, n and m can be very large The space requirements of O(mn) can be too demanding If m = n = 1000, we need 1MB space If m = n = 10000, we need 100MB space We can afford to perform extra computation to save space Looping over million operations takes less than seconds on modern workstations Can we trade space with time?

Why Do We Need So Much Space? To compute just the value V[n,m]=V(s[1..n],t[1..m]), we need only O(min(n,m)) space: A 1 G 2 C 3 4 Compute V(i,j), column by column, storing only two columns in memory (or line by line if lines are shorter). -2 -4 -6 -8 -2 1 -1 -3 -5 -4 -1 -2 -6 -3 -2 -1 Note however that This “trick” fails if we want to reconstruct the optimal alignment. Trace back information requires keeping all back pointers, O(mn) memory.

Local Alignment The alignment version we studies so far is called global alignment: We align the whole sequence s to the whole sequence t. Global alignment is appropriate when s,t are highly similar (examples?), but makes little sense if they are highly dissimilar. For example, when s (“the query”) is very short, but t (“the database”) is very long.

Local Alignment When s and t are not necessarily similar, we may want to consider a different question: Find similar subsequences of s and t Formally, given s[1..n] and t[1..m] find i,j,k, and l such that V(s[i..j],t[k..l]) is maximal This version is called local alignment.

Local Alignment As before, we use dynamic programming We now want to setV[i,j] to record the maximum value over all alignments of a suffix of s[1..i] and a suffix of t[1..j] In other words, we look for a suffix of a prefix. How should we change the recurrence rule? Same as before but with an option to start afresh The result is called the Smith-Waterman algorithm, after its inventors (1981).

Local Alignment New option: We can start a new match instead of extending a previous alignment Alignment of empty suffixes

Local Alignment Example S T s = TAATA t = TACTAA

Local Alignment Example S T s = TAATA t = TACTAA

Local Alignment Example S T s = TAATA t = TACTAA