Evolutionary Models. Evolutionary Models

Similar documents
Alignment Algorithms. Alignment Algorithms

Reading for Lecture 13 Release v10

Lecture 3: Markov chains.

Lecture Notes: Markov chains

Genome 373: Hidden Markov Models II. Doug Fowler

HMM for modeling aligned multiple sequences: phylo-hmm & multivariate HMM

Computational Genomics and Molecular Biology, Fall

3/1/17. Content. TWINSCAN model. Example. TWINSCAN algorithm. HMM for modeling aligned multiple sequences: phylo-hmm & multivariate HMM

O 3 O 4 O 5. q 3. q 4. Transition

Lecture 4: Hidden Markov Models: An Introduction to Dynamic Decision Making. November 11, 2010

Today s Lecture: HMMs

EVOLUTIONARY DISTANCES

Conditional probabilities and graphical models

STA 414/2104: Machine Learning

Pair Hidden Markov Models

Getting Started with Communications Engineering

Comparative Gene Finding. BMI/CS 776 Spring 2015 Colin Dewey

CISC 889 Bioinformatics (Spring 2004) Hidden Markov Models (II)

An Introduction to Bioinformatics Algorithms Hidden Markov Models

Quantifying sequence similarity

STA 4273H: Statistical Machine Learning

Hidden Markov Models. x 1 x 2 x 3 x K

DIFFERENTIAL EQUATIONS

Basic math for biology

Base Range A 0.00 to 0.25 C 0.25 to 0.50 G 0.50 to 0.75 T 0.75 to 1.00

Dr. Amira A. AL-Hosary

π b = a π a P a,b = Q a,b δ + o(δ) = 1 + Q a,a δ + o(δ) = I 4 + Qδ + o(δ),

Markov Chains and Hidden Markov Models. = stochastic, generative models

CS1800: Mathematical Induction. Professor Kevin Gold

Lecture 10: Powers of Matrices, Difference Equations

Pairwise alignment using HMMs

Pairwise sequence alignment

EECS730: Introduction to Bioinformatics

Hidden Markov Models

Hidden Markov Models. x 1 x 2 x 3 x K

Example: The Dishonest Casino. Hidden Markov Models. Question # 1 Evaluation. The dishonest casino model. Question # 3 Learning. Question # 2 Decoding

Algebra & Trig Review

Multiple Sequence Alignment using Profile HMM

Contrasts for a within-species comparative method

BMI/CS 776 Lecture 4. Colin Dewey

Computational Genomics and Molecular Biology, Fall

Lesson 21 Not So Dramatic Quadratics

Hidden Markov Models

Based on slides by Richard Zemel

Bayesian Machine Learning - Lecture 7

Amira A. AL-Hosary PhD of infectious diseases Department of Animal Medicine (Infectious Diseases) Faculty of Veterinary Medicine Assiut

9 Forward-backward algorithm, sum-product on factor graphs

Math 138: Introduction to solving systems of equations with matrices. The Concept of Balance for Systems of Equations

Page 1. Evolutionary Trees. Why build evolutionary tree? Outline

A (short) introduction to phylogenetics

Math 5a Reading Assignments for Sections

Phylogenetic inference

order is number of previous outputs

6.047 / Computational Biology: Genomes, Networks, Evolution Fall 2008

Some of these slides have been borrowed from Dr. Paul Lewis, Dr. Joe Felsenstein. Thanks!

Math 308 Midterm Answers and Comments July 18, Part A. Short answer questions

Applications of Hidden Markov Models

Hidden Markov Models: All the Glorious Gory Details

Statistical Machine Learning Methods for Biomedical Informatics II. Hidden Markov Model for Biological Sequences

BMI/CS 576 Fall 2016 Final Exam

Massachusetts Institute of Technology Computational Evolutionary Biology, Fall, 2005 Notes for November 7: Molecular evolution

Lecture 4: Evolutionary Models and Substitution Matrices (PAM and BLOSUM)

Evolutionary Tree Analysis. Overview

Page 1. References. Hidden Markov models and multiple sequence alignment. Markov chains. Probability review. Example. Markovian sequence

Statistical Machine Learning Methods for Bioinformatics II. Hidden Markov Model for Biological Sequences

Hidden Markov Models (HMMs) November 14, 2017

BINF6201/8201. Molecular phylogenetic methods

Phylogenetics: Parsimony and Likelihood. COMP Spring 2016 Luay Nakhleh, Rice University

CH 59 SQUARE ROOTS. Every positive number has two square roots. Ch 59 Square Roots. Introduction

Probabilistic Graphical Models Homework 2: Due February 24, 2014 at 4 pm

Finding Limits Graphically and Numerically

STEP Support Programme. Hints and Partial Solutions for Assignment 5

X X (2) X Pr(X = x θ) (3)

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

Midterm 2 V1. Introduction to Artificial Intelligence. CS 188 Spring 2015

11.3 Decoding Algorithm

MATH 118 FINAL EXAM STUDY GUIDE

Ordinary Differential Equations Prof. A. K. Nandakumaran Department of Mathematics Indian Institute of Science Bangalore

MATH 12 CLASS 4 NOTES, SEP

STATS 306B: Unsupervised Learning Spring Lecture 5 April 14

Getting Started with Communications Engineering. Rows first, columns second. Remember that. R then C. 1

Linear Algebra, Summer 2011, pt. 2

Efficient Sensitivity Analysis in Hidden Markov Models

Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 25. Minesweeper. Optimal play in Minesweeper

Lecture 4: Evolutionary models and substitution matrices (PAM and BLOSUM).

Graphical Models Seminar

Proof Techniques (Review of Math 271)

Using algebraic geometry for phylogenetic reconstruction

Sequence Analysis 17: lecture 5. Substitution matrices Multiple sequence alignment

HMMs and biological sequence analysis

THEORY. Based on sequence Length According to the length of sequence being compared it is of following two types

Hidden Markov Models. Three classic HMM problems

CS173 Lecture B, November 3, 2015

Part A. P (w 1 )P (w 2 w 1 )P (w 3 w 1 w 2 ) P (w M w 1 w 2 w M 1 ) P (w 1 )P (w 2 w 1 )P (w 3 w 2 ) P (w M w M 1 )

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Lecture 8 Learning Sequence Motif Models Using Expectation Maximization (EM) Colin Dewey February 14, 2008

CSCE 471/871 Lecture 3: Markov Chains and

Announcements. CS 188: Artificial Intelligence Fall Causality? Example: Traffic. Topology Limits Distributions. Example: Reverse Traffic

Sequence Alignment: Scoring Schemes. COMP 571 Luay Nakhleh, Rice University

The Inductive Proof Template

Transcription:

Edit Operators In standard pairwise alignment, what are the allowed edit operators that transform one sequence into the other? Describe how each of these edit operations are represented on a sequence alignment matrix.

Lessons Most of you got this right. Remember that global alignment considers the entire length of both sequences (unlike local alignment, say). So if the first letter of sequence X aligns to letter 21 of sequence Y, global alignment needs to first insert letters 1-20 of sequence Y before considering alignment of letter 1 of X to letter 21 of Y. Those insertions are considered by cells with X coordinate of 0. Another way of saying this is that global paths must start at (0,0). It may seem confusing that match and substitution are represented by the same move (diagonal). Just think of this move as emitting a letter for both sequences (which could agree or disagree).

Alignment Paths Using the three edit operator moves,,, write the list of all possible paths representing global alignments of X 2 to Y 1. (For simplicity, you can write the moves as -, /, and ). If any of these paths correspond to the same alignment (i.e the same letter(s) of X m, Y n are aligned to each other), group those paths together as one group.

Alignment Paths Lessons This question was designed to highlight details about exactly where global paths start. don t forget that global paths start at (0,0) because they must consider the possibility of inserting letters from one sequence before starting to align against the first letter of the other sequence! remember that different gap paths can be degenerate (i.e. represent the same alignment).

Viterbi Alignment Given the two sequences X = AGC... and Y = ACC... Find the optimal global alignment of X 2 to Y 1 by filling out the corresponding Viterbi alignment matrix. Assume the following scores: exact match: +5 substitution: -2 gap: -3

Viterbi Alignment Lessons Most of you got this right. a few of you just copied the substitution scores for the letters X t,y u. Remember that Viterbi considers all possible moves,,, and chooses the best one. Remember that, and, are different paths and different alignments.

Alignment Scoring Say you are given the likelihood p(x t,y u aligned) derived from true alignments of sequences that are known to be evolutionarily related to each other. Based on the hypothesis testing principles we have learned, propose a scoring function for assessing whether X t,y u should be aligned to each other or not. How does your scoring function indicate they should be aligned vs. should not be aligned?

Alignment Scoring Lessons Most of you got this right or very close. A few of you didn t think of this in probability terms, though the question emphasized that very clearly. Just remember that hypothesis testing should generally use either an odds ratio or a p-value. Two of you proposed a p-value test, which is valid but would ignore the information p(x t,y u aligned) that the question asked you to take into account. Some of you proposed the odds ratio test but were unsure what to use for the unrelated model. As in many previous problems we ve worked, independence is the standard model that two variables are unrelated. It would have been fine to just propose the odds ratio (instead of its log), but in that case note that you have to multiply (rather than add) the individual score components. Many of you considered your answer wrong because you didn t use log, but actually the question did not require that!

Intron Alignment Assume that you know exactly the positions that are aligned at the end of exons A, A and at the beginning of exons B, B. What would be the easiest way to obtain the optimal intron alignment subject to the proposed constraint? State the proposed constraint in precise terms of the allowed paths on the alignment matrix.

Intron Alignment Lessons Few of you explicitly made the connection to global alignment that this problem required. You can think of global alignment as requiring the best alignment conditioned on a particular endpoint constraint -- which is exactly what this problem was explicitly asking for. Just extracting the intron sequences for alignment is not enough; e.g. local alignment will not enforce this constraint.

Intron Alignment Lessons Note that constraining the endpoints of the alignment path does not imply there can be no gaps at the the beginning or end of the alignment! (Recall that global alignment reserves a zero row and a zero column for scoring precisely these gaps). Global alignment simply forces such gaps to be included in the score (whereas local alignment allows them to occur without penalty). Some of you made the converse error of interpreting the exon information as meaning that only diagonal moves should be allowed at the beginning / end of the introns. But this gets the constraint wrong: you were told that last part of the exons aligned, not that the first part of the introns aligned.

Profile HMM Computation If we run a Viterbi (or Forward-Backward calculation) on this profile HMM, what will the actual calculation look like? draw the basic data structure that stores the state of the Viterbi algorithm during the calculation; indicate precisely how the different aspects of the problem (i.e. the observation sequence, the HMM states) are represented on this data structure.

Profile HMM Computation Lessons some of you said I didn t understand what the question was asking. But the question was unambiguous. I suspect what caused you trouble was that it s open-ended, i.e. it requires you to explain in your own words how this alignment problem would be expressed as a Viterbi matrix. Even if you memorized the definition of a Viterbi matrix, and (separately) the definition of a profile HMM, you wouldn t necessarily be able to answer this. It required you to think about how to apply the one to the other. some of you thought of the HMM as having just three states M, D, I. But the question concerned a profile HMM, which has these three states for every position in the profile. Furthermore, even if you use a three-state HMM, your Viterbi matrix still is O(3nm) because it must consider every possible letter of X n vs. every possible letter of Y m.

Profile HMM Moves Whether we re doing Viterbi or forward-backward, we follow our standard process. I.e. consider all possible moves to (from) a given cell, and write the max (or sum) of those moves in this cell. Draw the moves incoming to each of the possible states in terms of how they are represented on the matrix.

Profile HMM Move Lessons This question highlighted the correspondence between a transition to a state and a specific move on the matrix. I.e. the move depends on the state you re transitioning to, not the state you re transitioning from. That was all it asked for. some of you regurgitated the definition of the state graph, but the question asked you to think about how those states map to moves on the matrix. Again, this requires you to think (a bit) about how to apply the states onto the matrix. some of you found it hard to think about this problem as a single matrix. You re right -- it s much easier to think about as a separate matrix for each of the three states. some of you asked that I draw an example...

Probability Summation with Silent States Note that in previous HMM matrices we never had vertical moves (i.e. silent states that emit nothing) before. Does this affect how we would calculate the probability of the observation sequence via the forward-backward algorithm? if not, why not? if so, how?

Lessons some of you made the nice suggestion of treating the emission probability of the D state as always 1. That s fine; same as the emission likelihood of an empty observation sequence. by contrast, another suggestion of setting p(x t θ t = D)=0 is wrong. That would eliminate all paths that include D states (by assigning them zero probability). many of you didn t consider the problem of path overlap within a column, i.e. that since a path can pass through multiple cells in the same column, the probabilities in these cells are no longer disjoint. one of you raised the question: if a silent state emits no observation, how can we infer it from the observations? We can only infer it from the context of surrounding alignment states.

Total Likelihood Computation Propose what you think would be the simplest way to compute p( X) over this matrix structure.

Lessons many of you proposed a correct probability summation method, e.g. summing the probability exiting the last column to the END state, or summing over M and I states. Any valid sum would be considered a correct answer to this question. The most common error was not thinking about how to get a disjoint set of probabilities that are valid to sum. Just summing a column is no good, as we had just discussed in the previous problem. Easy answer: use START or END, because all the paths converge there, so no need to sum multiple cells. Another valid answer: use a set of states that are guaranteed disjoint (no overlap) and complete (include all possible paths). For example, a global alignment path must emit any given letter X t from exactly one M u state or I u state. Some of you asked to see an example...

Remembering vs. Thinking Once again, some comments are asking why I m asking you questions I have not already shown you the answers for. If I first show you the answer, then re-ask the same question (with a few numbers changed), I am just testing your ability to remember the answer, not your ability to use the concepts (i.e. think) for yourself. Real life is not going to just ask you the same questions I put in your homework or lecture notes. It s going to challenge you with somewhat different questions, and you re going to need to think to figure out how to use the concepts you know to solve the new question. I m happy to show you how to solve each question (in as much detail as you need to understand it) after you try doing it yourself. But bear in mind that I (and real life) will continue to ask you new questions. So memorization and plug-and-chug will not be enough.

Forward Computation Draw the move(s) that must be taken into account for computing the forward probability f t,mu (i.e. for aligning letter X t to profile letter M u ). Write the corresponding recursion equation for f t,mu.

Forward Computation Lessons most of you mistakenly thought of the move direction as depending on the origin state. As we emphasized before, it depends only on the destination state. Since the destination was a match state in this question, all incoming moves are diagonal. You can think of this as the M state consuming one letter of X and one letter of the profile. So it has to advance both t and u indices. You can think of t,u as indicating that X t, Y u have already been emitted on the path up to (and including) cell (t,u). Note that the forward probability s emission term comes from the destination state (in this case, M), so that term must be included even if the origin state is D. All of these confusions seem like the same thing to me. Just remember that the emission move is driven by the destination state. Easy case to remember: START M 1, D 1 or I 0.

Backward Computation Draw the move(s) that must be taken into account for computing the backward probability b t,mu (i.e. for aligning letter X t to profile letter M u ). Write the corresponding recursion equation for b t,mu.

Backward Computation Lessons It s tempting to think of the backward probability as the exact mirror image of the forward probability. But we have to be careful about the details. For example, the backward probability sums over the possible destination states, so each of those are different moves (e.g. vertical for the D state, horizontal for the I state, etc.) Let s draw the calculation on an example...

Darwin Draws the First Phylogeny, 1838

A Whole-Genome Based Tree (S.H. Kim & co-workers, 2009)

How to model gene evolution? atggggctcagcgacggggagtggcagcaggtgctgaacgtctgggggaa atggggctcagtgatggggagtggcagatggtgctgaacatctgggggaa atggctgatcatgatctggttctgaagtgctggggagccgtggaggccga atggctaactatgacatggttctgcagtgctgggggccagtggaggctga 1

Evolution as a Markov Chain? Presumably, evolution from a given ancestor A depends only on sequence of A, not on its ancestors. But discrete time assumption no longer tenable. 2

What is a Tree? A tree is a connected graph consisting of nodes (sequences) and edges (that each connect a pair of nodes) with no cycles (path of edges that returns to its starting point). There exists a single unique path between any pair of nodes. Ancestral sequences Modern sequences Not a tree, due to cycle

Character Differences! Branch Lengths and Order Characters Chimp..AGCTAAAGGGTCAGGGGAAGGGCA.. Gorilla..AGCATAGGGGTCAGGGGAAAGGCT.. Human..AGCAAAAGGGTCAGGGGAAGGGGA.. Macaque..AGCTCATCGGTAAGGAGAAAGGAT.. Orangutan..AGCCCATCGGTCAGGAGAAAGGAT.. Squirrel..AGCGGACCGGTAAGGAGAAAGGAC.. Phylogenetic Tree Ch Length of a branch is proportional to number of differences Tree shows order of divergences H Gor O M S Branch length represents the extent of change - expected number of substitutions per nucleotide site. The longer the branch the more change

Phylogeny: Standard Assumptions Sequences diverge by bifurcation events (no trifurcations etc.). (Model forms a tree). Sequences are essentially independent once they diverge from their common ancestor. The probability of observing nucleotide k at site j in the future depends only on the current nucleotide at site j. (Markov Chain assumption). Different sites (characters) within a sequence evolve independently.

Character Differences! Sequence Distances Characters Chimp..AGCTAAAGGGTCAGGGGAAGGGCA.. Gorilla..AGCATAGGGGTCAGGGGAAAGGCT.. Human..AGCAAAAGGGTCAGGGGAAGGGGA.. Macaque..AGCTCATCGGTAAGGAGAAAGGAT.. Orangutan..AGCCCATCGGTCAGGAGAAAGGAT.. Squirrel..AGCGGACCGGTAAGGAGAAAGGAC.. Distances Chimp Gor Hum Mac Orang Sq Chimp 5 2 8 8 9 Gor 5 7 6 8 Hum 9 8 9 Mac 2 4 Orang 5

Sequence Distances! Branch Lengths and Order 2 Chimp Human..AGCTAAAGGGTCAGGGGAAGGGCA....AGCAAAAGGGTCAGGGGAAGGGGA.. 3 5 5 Gorilla..AGCATAGGGGTCAGGGGAAAGGCT.. Squirrel..AGCGGACCGGTAAGGAGAAAGGAC.. 2 Macaque..AGCTCATCGGTAAGGAGAAAGGAT.. Orangutan..AGCCCATCGGTCAGGAGAAAGGAT..

Continuous Time Markov Chains For a homogeneous process; define state probability vector π(t) and transition matrix at time t as T(t): π(t)=π(t = 0)T(t) T(t + t)= T(t)T( t) Define instantaneous rate matrix Λ: T( t) I Λ = lim t 0 t 3

Matrix Exponential We can then calculate T(t) as where for a square matrix M e M = I + M + M2 2! T(t)=e Λt Mi +... + i! +... = M i i=0 i! Elegant, but not easy to calculate generally... 4

Simple Mutation Model Assumptions Neutral: mutation only; no selection Reversible: π i λ ij = π j λ ji Independence: λ ij = π j µ 5

F81 Model (Felsenstein) Assuming λ ij = π j µ For j = i: τ ij (t)=(1 e µt )π j τ ii (t)=e µt +(1 e µt )π i Jukes-Cantor: assume π i = 1 4 6

Ancestral State Likelihood Say you are given a rooted tree of a set of modern sequences X,Y,Z,... Now consider a given nucleotide site s in the aligned sequences where they differ (i.e. different nucleotides are observed). You are asked to infer the ancestral states (i.e. nucleotide) at this site in the different MRCA (ancestors) of these sequences, under the Jukes-Cantor model. state what hidden variables you would use, and their relation to the tree. state the basic form of the likelihood model you would use by specifying what you would use as the basic transition probability for an edge, and the basic form of how the transition probabilities are combined.

Ancestral State Likelihood Answer Given a set of (hidden) ancestral nucleotides α,β,γ,... at different internal nodes in the tree, we compute the joint probability of all the variables p α,β,γ,...,x s,y s,z s,... the transition probabilities for any edge p β α,t τ ii t π e λ t 1 π if α β τ ij t 1 e λ t π otherwise are since the tree is a Markov process, the joint probability is just the product of all the conditional probabilities for the edges. (under Jukes-Cantor, the prior for the root α is just p α π 1/4).