Evolutionary Genomics: Phylogenetics

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

Dr. Amira A. AL-Hosary

Molecular Evolution & Phylogenetics

Phylogenetic Tree Reconstruction

Maximum Likelihood Tree Estimation. Carrie Tribble IB Feb 2018

POPULATION GENETICS Winter 2005 Lecture 17 Molecular phylogenetics

Phylogenetics. BIOL 7711 Computational Bioscience

Bayesian Inference using Markov Chain Monte Carlo in Phylogenetic Studies

Markov chain Monte-Carlo to estimate speciation and extinction rates: making use of the forest hidden behind the (phylogenetic) tree

Using phylogenetics to estimate species divergence times... Basics and basic issues for Bayesian inference of divergence times (plus some digression)

Consensus Methods. * You are only responsible for the first two

Lecture 4. Models of DNA and protein change. Likelihood methods

9/30/11. Evolution theory. Phylogenetic Tree Reconstruction. Phylogenetic trees (binary trees) Phylogeny (phylogenetic tree)

Lab 9: Maximum Likelihood and Modeltest

Estimating Phylogenies (Evolutionary Trees) II. Biol4230 Thurs, March 2, 2017 Bill Pearson Jordan 6-057

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

Phylogenetics: Distance Methods. COMP Spring 2015 Luay Nakhleh, Rice University

Phylogenetics: Bayesian Phylogenetic Analysis. COMP Spring 2015 Luay Nakhleh, Rice University

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

A Bayesian Approach to Phylogenetics

Integrative Biology 200 "PRINCIPLES OF PHYLOGENETICS" Spring 2018 University of California, Berkeley

Constructing Evolutionary/Phylogenetic Trees

What is Phylogenetics

Phylogenetic inference

Inferring Molecular Phylogeny

(Stevens 1991) 1. morphological characters should be assumed to be quantitative unless demonstrated otherwise

"PRINCIPLES OF PHYLOGENETICS: ECOLOGY AND EVOLUTION" Integrative Biology 200B Spring 2009 University of California, Berkeley

8/23/2014. Phylogeny and the Tree of Life

EVOLUTIONARY DISTANCES

Algorithmic Methods Well-defined methodology Tree reconstruction those that are well-defined enough to be carried out by a computer. Felsenstein 2004,

Lecture 24. Phylogeny methods, part 4 (Models of DNA and protein change) p.1/22

Constructing Evolutionary/Phylogenetic Trees

Estimating Evolutionary Trees. Phylogenetic Methods

Lecture 27. Phylogeny methods, part 4 (Models of DNA and protein change) p.1/26

Bayesian Models for Phylogenetic Trees

Week 8: Testing trees, Bootstraps, jackknifes, gene frequencies

Lecture 6 Phylogenetic Inference

Bioinformatics 1. Sepp Hochreiter. Biology, Sequences, Phylogenetics Part 4. Bioinformatics 1: Biology, Sequences, Phylogenetics

Evolutionary Tree Analysis. Overview

Integrative Biology 200 "PRINCIPLES OF PHYLOGENETICS" Spring 2016 University of California, Berkeley. Parsimony & Likelihood [draft]

Concepts and Methods in Molecular Divergence Time Estimation

Inferring Speciation Times under an Episodic Molecular Clock

Lecture 27. Phylogeny methods, part 7 (Bootstraps, etc.) p.1/30

Phylogenetics: Building Phylogenetic Trees

7. Tests for selection

MOLECULAR SYSTEMATICS: A SYNTHESIS OF THE COMMON METHODS AND THE STATE OF KNOWLEDGE

C3020 Molecular Evolution. Exercises #3: Phylogenetics

Inferring phylogeny. Today s topics. Milestones of molecular evolution studies Contributions to molecular evolution

Phylogenetics: Building Phylogenetic Trees. COMP Fall 2010 Luay Nakhleh, Rice University

Maximum Likelihood Until recently the newest method. Popularized by Joseph Felsenstein, Seattle, Washington.

Week 5: Distance methods, DNA and protein models

C.DARWIN ( )

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

Bootstrap confidence levels for phylogenetic trees B. Efron, E. Halloran, and S. Holmes, 1996

Lecture Notes: Markov chains

A Phylogenetic Network Construction due to Constrained Recombination

How should we go about modeling this? Model parameters? Time Substitution rate Can we observe time or subst. rate? What can we observe?

Phylogenetic Trees. What They Are Why We Do It & How To Do It. Presented by Amy Harris Dr Brad Morantz

Reconstruire le passé biologique modèles, méthodes, performances, limites

Supplemental Information Likelihood-based inference in isolation-by-distance models using the spatial distribution of low-frequency alleles

How to read and make phylogenetic trees Zuzana Starostová

UoN, CAS, DBSC BIOL102 lecture notes by: Dr. Mustafa A. Mansi. The Phylogenetic Systematics (Phylogeny and Systematics)

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

Phylogenetic Analysis. Han Liang, Ph.D. Assistant Professor of Bioinformatics and Computational Biology UT MD Anderson Cancer Center

Letter to the Editor. Department of Biology, Arizona State University

Preliminaries. Download PAUP* from: Tuesday, July 19, 16

Biology 559R: Introduction to Phylogenetic Comparative Methods Topics for this week (Jan 27 & 29):

Molecular Evolution and Phylogenetic Tree Reconstruction

Phylogenetic methods in molecular systematics

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

Chapter 26: Phylogeny and the Tree of Life Phylogenies Show Evolutionary Relationships

Bayesian Phylogenetics

Substitution = Mutation followed. by Fixation. Common Ancestor ACGATC 1:A G 2:C A GAGATC 3:G A 6:C T 5:T C 4:A C GAAATT 1:G A

Phylogeny and systematics. Why are these disciplines important in evolutionary biology and how are they related to each other?

Mutation models I: basic nucleotide sequence mutation models

Finding the best tree by heuristic search

Phylogeny. November 7, 2017

"Nothing in biology makes sense except in the light of evolution Theodosius Dobzhansky

Bioinformatics tools for phylogeny and visualization. Yanbin Yin

Phylogenetic trees 07/10/13

Biology 211 (2) Week 1 KEY!

Bayesian phylogenetics. the one true tree? Bayesian phylogenetics

CS5263 Bioinformatics. Guest Lecture Part II Phylogenetics


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

Assessing an Unknown Evolutionary Process: Effect of Increasing Site- Specific Knowledge Through Taxon Addition

Chapter 7: Models of discrete character evolution

Lie Markov models. Jeremy Sumner. School of Physical Sciences University of Tasmania, Australia

A (short) introduction to phylogenetics

How should we organize the diversity of animal life?

Phylogenetic Assumptions

Molecular Evolution, course # Final Exam, May 3, 2006

Reading for Lecture 13 Release v10

Phylogenetic analyses. Kirsi Kostamo

AP Biology. Cladistics

"PRINCIPLES OF PHYLOGENETICS: ECOLOGY AND EVOLUTION" Integrative Biology 200 Spring 2018 University of California, Berkeley

Consensus methods. Strict consensus methods

Processes of Evolution

Systematics - Bio 615

Algorithms in Bioinformatics

Transcription:

Evolutionary Genomics: Phylogenetics Nicolas Salamin nicolas.salamin@unil.ch Department of Computational Biology, University of Lausanne Swiss Institute of Bioinformatics March 16th, 2017

Tree of Life and Evolution Phylogeny is the evolutionary history of living and extinct organisms. Darwin, 1857 Some key dates: 1964 Cavalli-Sforza and Edwards introduced parsimony and likelihood 1966 Hennig and the theory of cladistics 1977 Fitch used parsimony on DNA sequences 1978 Felsenstein worked out maximum likelihood method 1996 Rannala and Yang proposed Bayesian inference since 2000 Computational phylogenetics Haekel, 1866

New uses for phylogenetics Beside their use in systematics, trees are tools to study macroevolutionary processes detect evolution of genes and their function assess conservation issues drug design epidemiology evolution of languages

Macroevolution Serrano-Serrano et al. (2017) Proc. R. Soc. B

Genes evolution Christin et al. (2007) Cur. Biol.

Conservation issues Extinction risks between plant lineages Davies et al. (2011) PLoS Biol A=Cypereae, B=Disa, C=Indiogofera, D=Lachnaea, E=Muraltia, F=Podalyrieae, H=Restionaceae, I=Zygophyllum, J=Protea, K=Moraea

Drug design Cardoso et al. (2009) J. Clin. Virol.

Epidemiology H5N1 influenza epidemics Lemey et al. (2009) PLoS Comput. Biol.

Phylogenetic trees: definitions.

Phylogeny and phylogenetic tree The true and unobservable evolutionary history of a group of organisms is called a phylogeny. A phylogenetic tree is an estimate of the true unobservable evolutionary history derived from morphology, molecular data, etc. A cladogram or topology is the hierarchical structure of a phylogenetic tree, while a phylogram is a cladogram with explicit branch lengths and a chronogram has branch length as unit of time.

Hard and soft polytomies A clade on a phylogenetic tree is unresolved if there is a node with three or more direct descendants. from biology.fullerton.edu This creates polytomies, which are called soft if it s due to lack of data or a conflict between two plausible trees hard if they represent real two or more consecutive events of speciation

Orthologs, paralogs, xenologs Two homologous genes are ortholog if derived from a gene present in their common ancestor paralog if resulted from the duplication of the same ancestral gene xenolog if arose by lateral gene transfer from www.discoveryandinnovation.com When inferring species phylogenetic trees, it is essential to have orthologous DNA sequences!

Branches of a tree A branch can have a length that represents the evolutionary time elapsed between its endpoints. If the edge set of a tree have no lengths assigned, the shape of the tree is called topology. Suppose that d xy is the length of the path separating x and y. Suppose that all leaves x i of a tree T are equally distant from the root r, that is, there exist a constant c such that d xi r = c. Then T is called ultrametric

The root of a tree In evolutionary studies, phylogenetic trees are drawn as branching trees deriving from a single ancestral species. This species is know as the root of the tree. A rooted tree is a tree to which a special internal node r is added with degrees = 2. Labeled histories: rooted trees with interior nodes ordered according to their age.

Consensus tree A tree that summarized the common features of a set of trees is called a consensus tree. strict consensus: shows only the groups that are shared among all trees. semi-strict consensus: shows only the resolved groups that are shared among all trees. n% majority-rule consensus: shows the groups that are shared by n% of the trees.

How do we measure evolution?

Type of models Depending on the question, several type of models of molecular evolution: 1. infinite allele model each mutation creates a new allele and allele types are all equally different from each other 2. infinite site model each mutation happens at a site that has not previously experienced mutation since common ancestor of sample 3. finite site model allow the possibility that each sequence site has experienced multiple mutations

Infinite allele model A B C D E Ancestral allele of type 0 A has the ancestral type 0 (C,D,E) have allele type 1 B has allele type 3 allele type 2 not observed Diversity typically measured as θ = 4Nµ where N = population size (diploid) µ = rate of mutation of new alleles Typically used with microsats, SSRs, AFLP.

Infinite site model A B C D E Assuming an ancestral state at the root A has the same state as the root (C,D,E) are identical and differ from A and Root by 1 site B differs from A and Root by two sites B differs from C, D and E by 3 sites Expected number of sites between 2 random sequences is θ = 4Nµ Root Average number of sites at which a sequence pair differs denoted as ˆπ. Tajima s D is known as an estimate of θ. Typically used with SNPs and sequence data representing haplotypes.

Finite site model AGTA AGTA AGTC AGTC AGTC 2: A to G 2: G to A Given an ancestral sequence at the root A has the same sequence as the root (C,D,E) are identical and differ from A and Root by 1 mutation B is identical from A and Root despite two mutations Each sequence site evolves on the same gene tree as each other but mutations are assumed to occur independently. AGTA 4: A to C Most often used for nucleotide substitution process (mutation plus fixation) rather than mutation process alone. Basic model to analyse sequence data.

Finite site model and evolutionary trees.

Let s assume that you have 5 sequences: Sequence data: a small example one two three four five ACC ACG TCT TCA CTC How would you classify these sequences based on share ancestry??????

Let s assume that you have 5 sequences: Sequence data: a small example one two three four five ACC ACG TCT TCA CTC How would you classify these sequences based on share ancestry? one two four three five

Let s assume that you have 5 sequences: A small example, extended one two three four five ACCACCATGGTACCAGTGCG ACGAAATACGTACCAACGAG TCTAACTACGGTACTACGCA TCAACCATCGGATACACGAA CTCACTACCTTACTTACGCT How would you classify these sequences based on share ancestry??????

Evolutionary trees Finding the evolutionary trees is essential to answer most of the biological questions of interest. There are four major methods for this. Distance Methods Evolutionary distances are computed for all OTUs and these are used to construct trees. Maximum Parsimony Trees are chosen to minimize the number of changes required to explain the data. Maximum Likelihood Tree which gives the highest likelihood under the given model of sequence evolution. Bayesian Methods Tree with the highest probability to give rise to the sequence data observed. List of most tree reconstruction packages available at http://evolution.genetics.washington.edu/phylip/software.html

Differences between methods The end result of the four methods is an evolutionary tree, but they differ in the steps to reach it. Distance methods are clustering methods and find quickly a tree. You use bootstrapping to assess the reliability of the tree found in a second set of analyses Maximum parsimony and likelihood are optimality criteria. You need algorithm to sample the trees and select the best one based on these criteria. You use bootstrapping to assess the reliability of the tree found in a second set of analyses. Bayesian methods use likelihood criteria to sample trees and assess their reliability all in once.

Modeling evolution through time and lineages?

Likelihood and models Maximum likelihood relies on explicit probabilistic models of evolution. But, the process of evolution is so complex and multifaceted that basic models involve assumption built upon assumption. This reliance is often seen as a weakness of the likelihood framework, but the need to make explicit assumptions is a strength enables both inferences about evolutionary history and assessments of the accuracy of the assumptions made this leads to a better understanding of evolution The purpose of models is not to fit the data, but to sharpen the questions (S. Karlin)

Description of Maximum Likelihood Given an hypothesis H and some data D, the likelihood of H is L(H) = Prob(D H) = Prob(D 1 H)Prob(D 2 H) Prob(D n H) if the D can be split in n independent parts. Note that L(H) is not the probability of the hypothesis, but the probability of the data, given the hypothesis. Maximum likelihood properties (Fisher, 1922) consistency converge to correct value of the parameter efficiency has the smallest possible variance around true parameter value

Measuring evolution The problem that we are dealing with here is how to calculate the probability of evolution in sequences (whether DNA, AA at the inter- or intra-specific level).

What do we try to model From the alignment, it is easy to come up with a distance between species ˆp = n d /n, which is the proportion of different nucleotides. However, if p is small, ˆp is a good approximation of the number of substitutions per site. if p is large, ˆp will underestimate p because of multiple substitutions. distance methods could be used to do that, but they are approximations. We thus need a better way to model how substitutions/mutations are appearing during evolution. Markov processes can help us a lot in this.

Derivation of the process The simplest model assumes the following: 1 3α 1 3α α A C α α α G T α 1 3α 1 3α Each nucleotide has an equal chance of changing and when it changes, it changes to one of the three other nucleotide with equal probability (α). The parameter α is the probability of a substitution (i.e. mutation + fixation). This will create a Markov chain explaining the evolution of the sequence.

Probabilities of the Markov chain Imagine that ϕ is the stationary distribution of the Markov chain. The probability of observing A at site i after one time step is ϕ t+1 A = (1 3α)ϕ t A + αϕ t C + αϕ t G + αϕ t T = (1 3α)ϕ t A + α [ 1 ϕ t ] A The model is symmetric and it applies equally well to C, G or T, thus ϕ t+1 y = (1 4α)ϕ t y + α

Differential equation We can substract ϕ t y from both sides ϕ t+1 y ϕ t y = α ( 1 4ϕ t ) y and apply a continuous time approximation to get a differential equation dϕ t y dt = α ( 1 4ϕ t ) y with solution ϕ t y = 1 ( 4 + ϕ 0 y 1 ) e 4αt 4

Probabilities of [no] change We can estimate the probability of observing a nucleotide A at site i after an arbitrarily long time t. We have however two cases 1 the ancestral nucleotide was also A (ϕ 0 x=y = 1): p A A (t) = 1 4 + 3 4 e 4αt 2 the ancestral nucleotide was, say, a C (ϕ 0 x y = 0): p C A (t) = 1 4 1 4 e 4αt but 3 ways descendant with A could differ from the ancestor p [CGT ] A (t) = 3 4 3 4 e 4αt

The process in R pxx <- function (r=1/3,t=0.1) { return (0.25+0.75 * exp ( -4*r*t )); } pyx <- function (r=1/3,t=0.1) { return (0.75-0.75 * exp ( -4*r*t )); } time <- seq (0,1.0,0.01) plot ( time, pyx (r=1/3,t=time ), type="l", xlab=" Time ", ylab=" Differences per site ", ylim=c (0,0.75)) abline (a=0,b=1, lty =2) lines ( time, pyx (r=1/2,t=time ), type="l", col=" red ") lines ( time, pyx (r=1/5,t=time ), type="l", col=" blue ") How do you explain the plot? What is the effect of r and t?

Generalizing the model of evolution The initial condition P(0) of the probability matrix P gives the probability of change for a time of 0. It is obviously lim P(t) = I t 0 For continuous Markov chains, it exists an infinitesimal or instantaneous rate matrix that fully describes the process of the chain P(t) P(0) lim = Q t 0 t For a tiny time h, the transition probabilities are approximated by (as shown before) P(h) I + Qh

Instantaneous matrix For DNA, Q is with r xy = µ x y π y and r AC r AG r AT Q = r CA r CG r CT r GA r GC r GT r TA r TC r TG from theory of finite Markov process, q ii = 4 j=0,j i q ij, thus 4 q ij = 0. j=0

Differential equation We want the probability P(t) of substitutions over a time t. Let s estimate first P(t + h), with h being an tiny time interval. The definition of Markov chains tells us that P(t + h) = P(t)P(h). Replacing P(h) by its approximation gives P(t + h) = P(t)(I + Qh) = P(t) + P(t)Qh Rearranging, we get P(t + h) P(t) h = P(t)Q Taking the limit as h 0 gives P = PQ, with intial condition P(0) = I, which leads to P(t) = e Qt

Rate of substitutions As Q and t occur only in the form of a product in P(t) = e Qt, it is conventional to scale Q so that the average rate is 1. We do this by normalizing Q by the total amount of change involved in the Markov chain: 4 4 π i q ij i=0 j=0,j i The branch length is therefore measured in expected substitutions per site. A long branch can therefore either by due to long evolutionary time a rapid rate of substitution a combination of both

Matrix representation in R JC <- function () { freq <- matrix (0, nrow =4, ncol =4); diag ( freq ) <- c (.25,.25,.25,.25); R <- matrix (c(0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0), nrow =4); Q <- (R %*% freq ) - diag ( apply (R %*% freq, 1, sum )) scaleq <- sum ( apply ( freq %*% R %*% freq, 1, sum )) return (Q * scaleq ); } library ( Matrix ) calcp <- function (R, t=0.1) { return ( sum ( expm (R * t)[1, -1]));} time <- seq (0, 1, 0.01) plot ( time, pyx (a=1, t=time ), type="l") lines ( time, sapply ( time / 0.1875, calcp, JC ()), col=" red ", lty =2) Is it the same as before? Where is the 0.1875 coming from? Try with more complex models (see below).

Jukes-Cantor, 1969 with π A = π C = π G = π T = 0.25. 1 1 1 π A Q = 1 1 1 1 1 1 π C π G 1 1 1 π T Transition probabilities are P(t) = e Qt p ij (t) = { 1/4 + 3 exp( 4µt)/4, if i = j, 3/4 3 exp( 4µt)/4, if i j,

Kimura 2-parameters, 1981 1 κ 1 π A Q = 1 1 κ κ 1 1 π C π G 1 κ 1 π T Here, κ = α/β, where α is the transition rate β is the transversion rate. and π A = π C = π G = π T = 0.25. It simplifies to Jukes-Cantor, 1969 if α = β.

Matrix representation in R K2P <- function (k) { freq <- matrix (0, nrow =4, ncol =4); diag ( freq ) <- c (.25,.25,.25,.25); R <- matrix (c (0,1,k,1,1,0,1,k,k,1,0,1,1,k,1,0), nrow =4); Q <- (R %*% freq ) - diag ( apply (R %*% freq, 1, sum )) scaleq <- sum ( apply ( freq %*% R %*% freq, 1, sum )) return (Q * scaleq ); } library ( Matrix ) calcp <- function (R, t=0.1) { return ( sum ( expm (R * t)[1, -1]));} time <- seq (0, 1, 0.01) plot ( time, sapply ( time, calcp, JC ()), type="l") lines (time, sapply (time, calcp, K2P (2), col =" red ", lty =2) What is the difference between JC69 and K2P?

Felsenstein, 1981 π C π G π T Q = π A π G π T π A π C π T π A π C π G where π i is the equilibrium frequency of nucleotide i. It simplifies to Jukes-Cantor, 1969 if π A = π C = π G = π T.

Matrix representation in R F81 <- function (f) { freq <- matrix (0, nrow =4, ncol =4); diag ( freq ) <- f; R <- matrix (c(0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0), nrow =4); Q <- (R %*% freq ) - diag ( apply (R %*% freq, 1, sum )) scaleq <- sum ( apply ( freq %*% R %*% freq, 1, sum )) return (Q * scaleq ); } library ( Matrix ) calcp <- function (R, t=0.1) { return ( sum ( expm (R * t)[1, -1]));} time <- seq (0, 1, 0.01) plot ( time, sapply ( time, calcp, JC ()), type="l") lines (time, sapply (time, calcp, K2P (2), col =" blue ", lty =2) lines ( time, sapply ( time, calcp, F81 (c (0.23,0.27,0.28,0.22)), col=" red ", lty =2) What is the difference between JC69 and F81?

Hasegawa-Kishino-Yano, 1985 π C κπ G π T Q = π A π G κπ T κπ A π C π T π A κπ C π G Here, π i is the equilibrium frequency of nucleotide i and κ = α/β, where α is the transition rate β is the transversion rate. It simplifies to Kimura, 1980 if π A = π C = π G = π T. Felsenstein, 1981 if κ = 1.

Tamura-Nei, 1993 π C κ 2 π G π T Q = π A π G κ 1 π T κ 2 π A π C π T π A κ 1 π C π G Here, π i is the equilibrium frequency of nucleotide i, κ 1 = α Y /β and κ 2 = α R /β where α R is purine transition rate (A+G). α Y is pyrimidine transition rate (C+T). β is the transversion rate. It simplifies to Hasegawa, Kishino, Yano, 1985 if α R /α Y = π R /π Y. Felsenstein, 1984 if α R = α Y.

General-time reversible απ C βπ G γπ T Q = απ A δπ G ɛπ T βπ A δπ C ηπ T γπ A ɛπ C ηπ G where α η are rates of changes from one nucleotide to another π i are frequencies of nucleotides It simplifies to all other models if parameters are correctly constrained

How to model rate variation among sites? Variation of substitution rates The idea is to use a probability distribution to model changes in rates of substitution among sites, e.g. Gamma distribution mean of distribution is αβ, and variance αβ 2 set the mean rate of substitution to 1, so assume β = 1/α α parameter allows to change characteristics of distribution Felsenstein, 2004

Number of site classes Yang, 1994

How to calculate the likelihood of a tree?

Prerequisite Suppose we have a data set D of DNA sequences with m sites. We are given a topology T with branch lengths and a model of evolution, Q that allow us to compute P ij (t). Assumptions made to compute likelihood L(T, Q) = Prob(D T, Q) evolution in different sites is independent evolution in different lineages is independent the rate of evolution is the same between site and along lineages

Independence of sites Felsenstein, 2004 The assumption of independence of sites along a sequence allow us to decompose the likelihood in a product of likelihood for each site L(T, Q) = Prob(D T, Q) = The likelihood for this tree for site i is Prob(D i T, Q) = ACGT x ACGT y m Prob(D i T, Q) i=1 ACGT z ACGT Prob(A, C, C, C, G, x, y, z, w T, Q) w

Independence of lineages Felsenstein, 2004 With the independence of lineages assumptions, we can decompose the right hand side of the equation a bit further. Prob(A, C, C, C, G, x, y, z, w T, Q) = Prob(x)P xy (t 6 )P ya (t 1 )P yc (t 2 ) P xz (t 8 )P zc (t 3 ) P zw (t 7 )P wc (t 4 )P wg (t 3 ) ACGT x ACGT y ACGT z ACGT w

Pruning algorithm Goal: render the likelihood computation practicable using dynamic programming Idea: move summation signs as far right as possible and enclose them in parentheses where possible Prob(A, C, C, C, G, x, y, z, w T ) = ACGT x Prob(x) (ACGT (ACGT z (ACGT w y P xz (t 8 )P zc (t 3 ) P xy (t 6 )P ya (t 1 )P yc (t 2 ) ) P zw (t 7 )P wc (t 4 )P wg (t 5 ) )) The parentheses pattern and terms for tips has an exact correspondence to the structure of the tree.

Numerical integration Up to now we assumed that both branch lengths and model parameters were fixed at a given value. Of course, we don t know these values so to get these values, start from a random guess make small changes and compare the improvement in likelihood do so until the likelihood do not change any more every time the topology is changed, reestimate these parameters Drawback: very very very computationally intensive, but there are solutions to that.

Consistency and overparameterisation Maximum likelihood can be proved to be consistent (see Felsenstein, 2004 pp. 271) true if we use the correct model of evolution but what happen if model in not correct? No guarantee can be given less problematic if what we want to infer is just the topology Beware of overparameterisation problems adding more and more parameters to the model will result in a better fit to the data but this will lead to inconsistency a few parameters are more important than others, in particular the gamma distribution

How to choose the best tree?

Number of rooted trees?

More trees than electrons in Universe Branching process n-th taxa can be added to 2n 3 places 3 5 7 (2n 3) (2n 3)! 2 n 1 (n 1)! with 50 taxa, approaching Eddington s number of electons in the visible universe

Exhaustive search To find the best tree, enumerate all the possible trees from the tree space: But you can quickly see that it is impossible for trees larger than 10 taxa... We need to take shortcuts

Swapping algorithms: shortcuts Algorithms to speed up even more the search through the tree space take an initial tree T i make small rearrangements (i.e. swap branches) to reach neighboring trees if you find a better, keep it and start again strategy will find local optimum in the tree space They are called greedy algorithm because they sieze the first improvement they see

Greedy algorithms The problem with greedy algorithms: you can miss the global optimum! but we don t have any other choice...

Nearest-Neighbour Interchange

Subtree Pruning and Regrafting

Tree Bisection and Reconnection

Swapping is not all Number of neighbor searched NNI 2(n 3) SPR 4(n 3)(n 2), although some may be the same neighour TBR (2n 1 3)(2n 2 3) possible ways to reconnect the two trees Previous methods just make rearrangements to a particular tree by swapping branches, which is not enough to fully cover the tree space. Additional techniques have to be used stepwise taxon addition: start several heuristic searches by starting from a different initial tree each time allow suboptimal trees to be swapped on in order to cross valleys in the tree space

Other heuristic searches You can invent all kinds of heuristic algorithm, and many have been proposed tree-fusing: exchange subtrees from two equally optimal trees genetic algorithms: let populations of trees evolve by setting fitness functions and mutation, migration, etc... tree windowing: do extensive rearrangement but on a local region of the tree search by reweighting: change the landscape of the tree space by reweighting characters simulated annealing: iteratively change the tree scoring function to lower the difference between optimal and suboptimal trees

How to know if the tree is correct?

Bootstrap on phylogenetic tree Allow us to infer the variability of parameters in models that are too complex for easy calculation of their variance. This is the case of topologies! Procedure sample whole columns of data with replacement recreate n pseudomatrices with the same number of species and sites than original one build n phylogenetic trees from these n pseudoreplicates weigh each tree in replicate i by the number of trees obtained

Summarizing results The end result of a bootstrap is a cloud of trees. What is the best way to summarize this given that trees have discrete topologies and continuous branch lengths? We could make a histogram of the length of a particular branches it will give a lower limit on the branch length then check if 0 is in the 95% interval, we would assert the existence of the branch A simpler solution is to count how many times a particular branch appears in the list of trees estimated by bootstrap. A majority-rule consensus tree containing clades appearing in more than 50% of them can then be built

Simple example

Multiple tests We don t (or rarely) know in advance which group interest us. If we look for the most supported group on the tree and report its p-value, we have a multiple-tests problem if no significant evidence for existence of any groups on a tree 5% of branches are expected to be above 0.95 so one out of every 20 branches of a tree would be significant furthermore, branches are not independent... The p-value cannot be interpreted as statistical test.

Biases in bootstrap Estimated p-value is conservative: Hillis and Bull (1993) One source of conservatism with bootstrap, we make statement about branch lengths µ then we reduce that to statements about tree topology, i.e. µ > 0 or µ < 0 generalisation of Hillis and Bull (1993) results is not clear

How to test models in phylogenetics?

Uncertainty assessment Likelihood does not only allow to make point estimate of the topology and branch length, it also gives information about the uncertainty of our estimate. It is possible to use the likelihood curve to test hypothesis and to make interval estimates. Asymptotically (i.e. when the number of data point tend towards ), the ML estimate ˆθ is normally distributed around its true value θ 0.

Likelihood ratio test At the maximum ˆθ S(ˆθ) = lnl(ˆθ) θ = 0 I(ˆθ) = 2 lnl(ˆθ) θ 2 < 0 Then the log likelihood of the true parameter value can be linked with the maximum value estimated by a Taylor series: lnl(θ 0 ) = lnl(ˆθ) + S(ˆθ)(θ 0 ˆθ) 1 2 I(ˆθ)(θ 0 ˆθ) 2 Subtracting lnl(ˆθ) from both sides, setting I(ˆθ) = 1/σ 2 and rearranging leads to 2 [ lnl(θ 0 ) lnl(ˆθ) ] (θ 0 ˆθ) 2 σ 2 = χ 2 1 For p parameters, twice the difference in likelihood is χ 2 p distributed.

Nested models Assumptions of the likelihood ratio test null hypothesis should be in the interior space that contains the alternative hypotheses if q parameters have been constrained, they must be able to vary in both sense if L 0 restricts one parameter to the end of its range, distribution of twice log likelihood ratio has half its mass at 0 and the other half in the usual χ 2 distribution halve the tail probability obtained with usual χ 2 Valid only asymptotically should be close enough to the true values true with very large amounts of data

Akaike Information Criterion More general model will always have higher likelihood than restricted models. So, choosing model with highest likelihood will lead to one that is unnecessarily complex. We should therefore compromise goodness of fit with complexity of model. AIC for hypothesis i with p i parameters: AIC i = 2lnL i + 2p i Hypothesis with the lowest AIC is preferred.

Adding more complexity All the different models seen so far are special cases of the GTR+Γ +I model setting Γ and I to 0 leads to GTR setting transversion rates to β and transition rates to α leads to F84 setting β = α leads to K2P setting all nucleotide frequencies to 1 4 lead to JC69

Examples Possible comparisons GTR+Γ vs GTR 2 [lnl GTR+Γ lnl GTR ] difference in df = 1 GTR+Γ vs F84+Γ 2 [lnl GTR+Γ lnl F84+Γ ] difference in df = 4 F84+Γ vs JC69 2 [lnl F84+Γ lnl J69 ] difference in df = 5 But not JC69+Γ vs GTR because they are not nested!

Are two topologies different? LRT or AIC not possible on topologies because they are discrete entities, and not quantitative parameters. We therefore have to rely on paired-sites tests expected lnl is average lnl per site as number of sites grows without limit if sites are independent and two trees have equal expected lnl, then differences in lnl at each site is drawn independently with expectation zero statistical test of mean of these differences is zero valid for likelihood and parsimony

Example 232-sites mtdna for 7 mammals Felsenstein, 2004

Different form of tests possible Possible tests z assumes the differences at each site are normally distributed and estimate the variance of differences of the scores KH use bootstrap sampling to infer distribution of sum of differences of scores and see whether 0 lay in the tails of distribution Results z sum of lnl = 3.18, σ 2 = 0.04, so variance of sum of differences is 11.31; z statistic is 3.18/3.36 = 0.94 with p-value of 0.34 KH 10,000 bootstrap samples of sites; 8,326 favored tree II, which yields a one-tailed probability of 0.16, and a 0.33 two-tailed probability

Multiple tests, again If we want to test more than two trees compare each tree to best tree accept all trees that cannot be rejected by KH test multiple tests setting, but no reduction of nominal rejection level possible need to correct for all different ways the data can vary, ways that support different trees When two trees are compared, but one of them is the actual best tree, we should do a one-tailed test.

SH test Resampling technique that approximately corrects for testing multiple trees 1 make R bootstrap of the N sites 2 for each tree, normalize resampled lnl so they have same expectation 3 for jth bootstrap, calculate S ij for ith tree how far normalized value is below maximum across all trees for that replicate 4 for each tree i, the tail probability is proportion of bootstrap replicates in which S ij is less than the actual difference between ML and lnl of that tree Resampling build a least-favorable case in which the trees show some patterns of covariation of site as in actual data but do not differ in overall lnl. One limitation: assume that all proposed trees are possibly equal in likelihood

Parametric bootstrap Use computer simulations to create pseudorandom data sets Advantages and disadvantages can sample from the desired distribution, even with small data sets flexible hypothesis testing framework close reliance on the correctness of the model of evolution

Measuring, searching and assessing trees all in one!

Bayesian methods The likelihood calculation is used as well by Bayesian methods. However, another component is added to the method: the prior distributions. Before observing any data, each parameter will be assigned a prior distribution topologies branch lengths each parameter of the model of evolution The prior distributions are then combined with the likelihood of the data to give the posterior distribution. This is a highly attractive quantity because it computes what we most need: the probabilities of different hypotheses in the light of the data.

Bayes theorem To combine all this together, we use the Bayes theorem Prob(T D) = Prob(T D) Prob(D) where Prob(T D) = Prob(T )Prob(D T ) so that Prob(T D) = Prob(T )Prob(D T ) Prob(D)

Normalizing constant The denominator Prob(D) is the sum of the numerator Prob(T )Prob(D T ) over all possible hypotheses T. This quantity is needed to normalize the probabilities of all T so that they add up to 1. This leads to Prob(T D) = Prob(T )Prob(D T ) Prob(T )Prob(D T ) T In words: posterior probability = prior probability likelihood normalizing constant

Estimate normalizing constant Posterior distribution expression has a denominator, i.e. Prob(T )Prob(D T ), that is often impossible to compute. T Fortunately, samples from the posterior distribution can be drawn using a Markov chain that does not need to know the denominator draw a random sample from posterior distribution of trees becomes possible to make probability statements about true tree e.g. if 96% of the samples from posterior distribution have (human,chimp) as monophyletic group, probability of this group is 96%

Makov chain Monte Carlo Idea: to wander randomly through tree space by sampling trees until we settle down into an equilibrium distribution of trees that has the desired distribution, i.e. posterior distribution. Markov chain: the new proposed tree will depend only on the previous one to reach equilibrium distribution, the Markov chain must be aperiodic no cycles should be present in the Markov chain irreducible every trees must be accessible from any other tree probability of proposing T j when we are at T i is the same as probability of proposing T i when we are at T j the Markov chain has no end

MCMC in practice Metropolis algorithm start with a random tree T i select a new tree T j by modifying T i in some way compute R = Prob(T j D) Prob(T i D) The beauty of MCMC: the normalizing constant being the same, it simplifies R = Prob(T j)prob(d T j ) Prob(T i )Prob(D T i ) if R 1, accept T j if R < 1, draw a random number n between [0, 1] and accept T j if R > n, otherwise keep T i

Schematic view P. Lewis, 2006

Putting it all together Start with random tree and arbitrary initial values for branch lengths and model parameters Each generations, chose at random to propose either: a new tree new branch length new model parameter values Either accept or reject the move Every k generations, save tree topology, branch lengths and model parameters (i.e. sample the chain) After n generations, summarize the sample using histograms, means, credibility intervals, etc.

How to propose a new tree We could invent any type of proposal distribution to wander through the tree space e.g. NNI by selecting a node at random should be able to reach all trees from any starting tree at least after sufficient running, but impossible to know how much running is enough Should be careful because if trees proposed are too different these trees will be rejected too often if trees proposed are too similar tree space won t be sampled well enough

MCMCMC Metropolis-coupled Markov-chain Monte Carlo or MC 3 involves running several MCMC chains simultaneously the cold chain is the one that counts, i.e. trees are sampled from that one the rest are called heated chains and are there to help the convergence chain is heated by raising densities to a power less than 1.0

MCMCMC P. Lewis, 2006

MCMC trace plot P. Lewis, 2006

Slow mixing P. Lewis, 2006

Convergence in MCMC Greatest practical problem: how long to run a chain to obtain a good approximation of the posterior probabilities The most important is to check that independent runs lead to the same posterior distribution.

Type of prior distributions Prior distributions for topologies have been proposed stochastic process of random speciation and extinction uniform distribution of all possible rooted trees Prior distributions on branch lengths exponential distribution uniform distribution Prior on model parameters Dirichlet distribution on nucleotide frequency uniform or exponential distribution on shape of γ distribution uniform distribution on proportion of invariant sites

Problems with priors As shown before, we have to be careful with prior because they can exclude possible estimated values. Other problematic aspects: universality of priors use of uninformative flat priors issues of scale unbounded quantities

Jukes-Cantor model Sequence disimilarity and branch length under this model: D = 3 4 (1 e 4 3 t ) different scale unbounded priors

Effect of priors Yang and Rannala, 2006

What can we do with Bayesian Beside their use in building phylogenetic trees, Bayesian methods are useful to deal with complex biological problems testing hypotheses about rates of host switching and cospeciation in host/parasite systems dating phylogenetic trees using autocorrelated prior distribution on rates of evolution infer rate of change of states of a character and the bias in the rate of gain of the character infer accuracy of inference of ancestral states infer position of the root of the tree testing rates of speciation and assess key innovations associated with changes in rates

Today s practicals We will look at the maximum likelihood and Bayesian inference today using the following software: phyml MrBayes R (package: ape, phangorn) R, FigTree or SeaView (to visualize the trees) Tracer or R (to visualize MrBayes output) The questions and data can be found here. A description of the format used in phylogenetics is available here.