What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions...

65
What is Phylogenetic Comparative Analysis? Jinlong Zhang [email protected] 7 NOV 2016 Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 1 / 65

Transcript of What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions...

Page 1: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

What is Phylogenetic Comparative Analysis?

Jinlong Zhang

[email protected]

7 NOV 2016

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 1 / 65

Page 2: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Outline

Contents

1 Questions to answer once the phylogeny is ready

2 Active Researchers in PCM

3 Basics of phylogenetic Trees

4 Phylogenetic Comparative Methods in R

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 2 / 65

Page 3: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Questions to answer once the phylogeny is ready

Contents

1 Questions to answer once the phylogeny is ready

2 Active Researchers in PCM

3 Basics of phylogenetic Trees

4 Phylogenetic Comparative Methods in R

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 3 / 65

Page 4: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Questions to answer once the phylogeny is ready

Questions to answer once the phylogeny is ready

1. The phylogenetic relationship between taxa

2. Speciation rate is affected by: how old the lineage is? SpeciesRichness under this clade, the latitude of the taxa, or special habiatthe taxa belong to?

3. How geological events affect the speciation and extinction rates?

4. Should conservation priority base on evolutionary distinctiveness?

5. Does phylogenetic closely related species tend to have similarcharacters or habitat preference?

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 4 / 65

Page 5: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Questions to answer once the phylogeny is ready

Questions to answer once the phylogeny is ready

6. Given the trait status for all the taxa in a phylogeny, how to inferthe status of the ancestors?

7. Given the current distribution range, how to infere the range of theancestors?

8. How the adaptation evovled?

9. Are species within a community randomly occurred or beingfiltered by the enviromental factors?

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 5 / 65

Page 6: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Active Researchers in PCM

Contents

1 Questions to answer once the phylogeny is ready

2 Active Researchers in PCM

3 Basics of phylogenetic Trees

4 Phylogenetic Comparative Methods in R

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 6 / 65

Page 7: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Active Researchers in PCM

Active Researchers in PCM

J. Felsenstein The Univeristy of Washington

M. Donoghue, Yale

A. Purvis, Imperial College

A. Rambaut, Edinburgh

D. Schluter UBC,

J. Weir Toronto

R. E. Ricklefs Missouri

L. Harmon, Idaho

J. J. Wiens, Arizona

J. Losos, Harvard

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 7 / 65

Page 8: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Active Researchers in PCM

Active Researchers in PCM

R. A. Pyron, George Washington U

W. Jetz, Yale

J.L. Gittleman, George

T. Garland UC Riverside, S. Blomberg

D. Ackerly, UC Berkeley

Cam Webb, Arnold Arboretum, Harvard

D. Maddison, Oregon

W. Maddison, UBC

N. Swenson, U Maryland,

N. Kraft, UCLA

Marc Cadotte, Toronto

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 8 / 65

Page 9: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Active Researchers in PCM

Active Researchers in PCM

R. Freckleton, Sheffield

M. Pagel, Reading

E. Paradis, U montpellier

D. Radobsky, Michigan

R. FitzJohn & Mark Westoby, Macquarie University

Rick Ree, Chicago

S. Smith, Michigan

Liam J. Revell, University of Massachusetts Boston

Brian O’Meara, Tennessee

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 9 / 65

Page 10: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Contents

1 Questions to answer once the phylogeny is ready

2 Active Researchers in PCM

3 Basics of phylogenetic Trees

4 Phylogenetic Comparative Methods in R

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 10 / 65

Page 11: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Working Flow for Building a Phylogeny

Processing of Nucleotide Sequenes

Alignment

Phylogenetic Inferences

Molecular Clocks / Dating

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 11 / 65

Page 12: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Tools for Building Phylogeny and Conducting theSubsequence Analysis

工欲善其事,必先利其器

OS: Windows, MacOS, Linux

Programming Language: R, Python (C, C++, FORTRAN, ...)

Software: R, Python, Mesquite

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 12 / 65

Page 13: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

R CRAN Task View:Phylogenetics I

https://cran.r-project.org/web/views/Phylogenetics.html

R Getting trees into R

Tree Manipulation

Tree Visualization

Ancestral state reconstruction

Diversification Analysis

Divergence Times

Tree Simulations

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 13 / 65

Page 14: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

R CRAN Task View:Phylogenetics II

Trait evolution

Trait Simulations

Community/Microbial Ecology

Phyloclimatic Modeling

Phylogeography/Biogeography

Species/Population Delimitation

Taxonomy

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 14 / 65

Page 15: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

What is phylogenetic tree?

Phylogenetic trees are dendrograms representing the relationship betweenthe taxa. The meaning of branch length depends on the the type of thetree, eg. substitution rate, time, etc.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 15 / 65

Page 16: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Milestones in Phylogenetic Reconstruction

In 1859, Darwin drew the first phylogenetic tree

E. Haeckel started to use trees to represent the relationships betweenthe species at the end of 19th century.

In 1964, Cavalli-Sforza and Edwards proposed the possibility to usethe Maximum Parsimony and Maximum Likelihood in phylogeneticinferences conceptually.

Hennig proposed the Theory of cladistics

In 1977, Fitch first applied parsimony methods in tree infrerences

In 1978, Felsenstein for the first time, realized the maximumlikelihood in phylogenetic inferences

In 1996, Rannala and Yang introduced the Bayes inferences in treereconstruction.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 16 / 65

Page 17: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Phylogenetic Trees

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 17 / 65

Page 18: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Newick Format

adopted by James Archie, William H. E. Day, Joseph Felsenstein, WayneMaddison, Christopher Meacham, F. James Rohlf, and David Swofford, attwo meetings in 1986, the second of which was at Newick’s restaurant inDover, New Hampshire, US. PHYLIP, RAxML use Newick format.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 18 / 65

Page 19: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Nexus File

NEXUS Format is an upgrade to the Newick format,by adding a numberof code blocks . NEXUS is used by BEAST,PAUP*, MrBayes,Mesquite,r8s etc。

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 19 / 65

Page 20: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Other formats

New Hampshire eXtended format (NHX)(http://home.cc.umanitoba.ca/ psgendb/doc/atv/NHX.pdf)Jplace(http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0031009)

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 20 / 65

Page 21: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

How to Obtain Nucleotide Sequences

How to obtain Nucleotide sequences from GenBank

1. DNA barcoding Sequences AB1 file > Fasta File

2. Genebank Fasta File

3. Next Generation Sequencing (Genome)

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 21 / 65

Page 22: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

FASTA Files

FASTA files are plain text files designed for storaging nucleotide sequences.

1. Name for Each sequence start with >

2. Nucleotide sequence are in the next row

3. A semicolon is appended between sequences

3. - is for missing sites, aligned sequences also allowed.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 22 / 65

Page 23: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Alignment

Compare the sequences, and find out the informative site.

Nucleotide Sequences before alignmentJinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 23 / 65

Page 24: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Alignment

Compare the sequences, and find out the informative site.

Nucleotide Sequences after alignment

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 24 / 65

Page 25: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Substitution Models

ATCG

Prob[kevents] =µtke−µt

k!

transition matrix。

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 25 / 65

Page 26: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Transition Matrix

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 26 / 65

Page 27: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Jukes-Cantor (JC69) Model 1969

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 27 / 65

Page 28: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

GTR: General Time Reversible Model

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 28 / 65

Page 29: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

The relationship between Nucleotide substitution models

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 29 / 65

Page 30: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Gamma Distribution and the variation of substitution rates

Different sites tend to have different rate of substitution, Gammadistribution has been introduced to account for this variation.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 30 / 65

Page 31: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Selection of the Substitution Models

Software: Modeltest, Jmodeltest, mainly based on Akaike InformationCriterion or Likelihood Ration Test

If the nucleotide is very short, the information site could be verylimited, in these cases, the most complex models (eg. GTR) wouldover estimated the parameters. Therefore the models must beselected.

However, for the sequences with enough variation, GTR + Gammaare alway suggested.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 31 / 65

Page 32: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Distance Based Methods

Compute the genetic distance between each pair of sequences, eg,RAW, Transition , Tranversion,or based on other substitutionmodels。

Clustering, usually using UPGMA (Unweighted Pair-Group Methodwith Arithmetic means)

or Neighbour Joining

or Minumum Evolution

Distance based methods are of old fashion and rarely used nowadays.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 32 / 65

Page 33: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Parsimony

The Phylosophy behind Parsimony:Number of change during the evolutionary history should be as minumumas possible. The advantages of Parsimony Methods

Easy to understand

Fast

Generally, the topology of the phylogeny is stable and accurate.

Parsimony trees are widely used as starting trees for the MaximumLikelihood based methods

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 33 / 65

Page 34: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Maximum Likelihood 1

The general idea of Maximum Likelihood:

Assume a phylogenetic tree T is available,

and the transition matrix Q is avialble,

What is the likelihood for the existing aligment pattern?

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 34 / 65

Page 35: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Why finding out the right phylogenetic tree is supercomputationally intensive?

Ntaxa: N possible trees3: 15: 1510: 202702515: 790585358062516: 21345804667687517: 619028335362937418: 19189878396251062419: 633265987076285030420: 2.216430954767e+2030: 8.687364e+3650: 2.838063e+74

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 35 / 65

Page 36: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Heuristic Search

Since there are too many possible trees, obtaining the phylogeny withMaximum Likelihood could not be possible.

Heuristic search start to search the phylogeny with a higherlikelihood, and only keep the phylogeny with higher likelihood whenadding the taxa randomly to an existing tree.

Pruning and grafting, eg TBR (tree bisection reconnection)

staring from multiple random trees will also help to find the globaloptimal tree.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 36 / 65

Page 37: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Software for building phylogenies using MaximumLikelihood

PHYLIP, developed by J. Felsenstein, the first software that adoptsthe Maximum Likelihood in inferencing the phylogenies.

PAUP*, by David Swoford, and is extremly well known for theParsimony Methods, but also ML. It provides a number of tests too.

PHYML, by Guidon, suitable for large number of sequences, allowingthe selection of different substitution models.

RAxML, by Stamatakis, for very large dataset of nucleotidesequences, providing rapid bootstrap. Very Popular

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 37 / 65

Page 38: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

The Supporting Value from Bootstrap

Introduced by J. Felsenstein.Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 38 / 65

Page 39: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Differences between ML and Bayesian Methods for treeconstruction

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 39 / 65

Page 40: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Bayesian Trees

BEAST and MrBayes are the two most important software forreconstructing phylogenetic trees.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 40 / 65

Page 41: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Branch length in a phylogenetic tree

The meaning of branch length depends on how the tree was built:

Distance based method: genetic distance

Maximum parsimony: Number of sites changed

Maximum likelihood and Bayesian:likelihood of mutation betweentwo sequences

Long branch length could be resulted from: high mutation rates, timesince divergence, but the branch lengh could not reflect time.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 41 / 65

Page 42: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Dating of phylogenies

Left:before dating / Right:after datingJinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 42 / 65

Page 43: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Basics of phylogenetic Trees

Software for molecular dating

r8s: Non parametric rate smoothing (NPRS); Penalized Likelihood(PL).

PATHd8: suitable for large phylogenies, but might not be thataccurate.

BEAST:for phylogenetic reconstruction as well as dating based onBayesian Inferences.

APE package in R:Penalized Likelihood and more (relatively simple).

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 43 / 65

Page 44: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Contents

1 Questions to answer once the phylogeny is ready

2 Active Researchers in PCM

3 Basics of phylogenetic Trees

4 Phylogenetic Comparative Methods in R

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 44 / 65

Page 45: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

APE: Analysis of Phylogenetics and Evolution

APE was developed by Dr. E. Paradis specifically for conductingphylogenetic comparative analysis in R

http://ape-package.ird.fr/ape authors.html

APE defined the class phylo, and it is the basis for most of the otherR packages.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 45 / 65

Page 46: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Main funtionalities of APE

reading and manipulating phylogenetic trees and DNA sequences,

computing DNA distances,

estimating trees with distance-based methods,

a range of methods for comparative analyses and analysis ofdiversification.

Functionalities are also provided for programming new phylogeneticmethods.

Paradis, E. (2012) Analysis of Phylogenetics and Evolution with R (SecondEdition). New York: Springer.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 46 / 65

Page 47: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Getting trees into R: read.tree()

Function read.tree() reads newick trees into R, and save the trees in phyloobjects. phylo objects are actually lists that containing four vectors,namely:

edge: Topological relationship between different branches;

Nnode: number of internal nodes;

tip.label: names for the taxa on the terminal;

edge.length: Branch length

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 47 / 65

Page 48: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

How to save a phylogenetic tree from APE

### An extract from Sibley and Ahlquist (1990)tiff(filename = "tree.tiff", width = 2400, height = 2400,

units = "px", pointsize = 12, res = 600, compression

="lzw")

cat("(((Strix_aluco:4.2,Asio_otus:4.2):3.1,",

"Athene_noctua:7.3):6.3,Tyto_alba:13.5);", file = "ex.tre",

sep = "

n")

tree.owls < − read.tree("ex.tre")

plot(tree.owls)

dev.off()

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 48 / 65

Page 49: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

The most important functions in APE I

ace() reconstruct the ancestral status

ladderize() Ladderizing the internal nodes of phylogenies.

bd.ext() Estimating the parameters of speciation based on birth-deathprocess

chronopl() Molecular clock calibrating based on penalized likelihood

consensus() Compute the consensus tree based on many trees

drop.tip() Delete taxa from the tree

gammaStat() Pybus-Harvey’s Gamma

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 49 / 65

Page 50: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

The most important functions in APE II

ltt.plot() Lineages Through Time Plot

mrca() Find the most recent common ancestor

multi2di() processing polytomies

di2multi() processing polytomies

read.nexus() read Nexus file

root() setting the outgroup

rtree() generating random tree for simulation

write.tree() save phylo object to a text file

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 50 / 65

Page 51: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

ggtree for visualizing phylogenies

The R package ggtree was developed by PhD candidate Yu Guangchuang(The University of Hong Kong) for visualizing phylogenies. It is a goodextension to the classes of the ggplot2 package. Manipulating andvisualizing trees within ggtree is easy and flexible. By changing a fewparameters, ggtree can draw very complex figures.ggtree reads various kinds of formats, including the outputs from r8s,RAxML.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 51 / 65

Page 52: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Example from ggtree

trees <- lapply(c(10, 20, 40), rtree)

class(trees) <- "multiPhylo"

ggtree(trees) + facet_wrap(~.id, scale="free") +

geom_tiplab()

See: https://github.com/GuangchuangYu/ggtree

https://bioconductor.org/packages/release/bioc/html/ggtree.html

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 52 / 65

Page 53: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Lineages Through Time Plot

ltt plot

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 53 / 65

Page 54: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Laser:Estimating the Speciation and Extinction Rates

Laser was developed by Dan Rabosky, Likelihood Analysis ofSpeciation/Extinction Rates from PhylogeniesThree Models:

1. fitSPVAR() fits a model with an exponentially declining speciationrate through time and constant extinction.

2. fitEXVAR() fits a model with exponentially increasing extinctionand constant speciation.

3. fitBOTHVAR() fits a model where both speciation and extinctionrates can vary through time.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 54 / 65

Page 55: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Laser: Likelihood Analysis of Speciation/Extinction Ratesfrom Phylogenies

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 55 / 65

Page 56: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Analysing the change in diversication rate duringspeciation process, MEDUSA

Modeling Evolutionary Diversification Using Stepwise AIC

geiger::medusaJinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 56 / 65

Page 57: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Ancestral Status Estimation

ape::ace

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 57 / 65

Page 58: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Phylogenetic Diversity using Picante

Faith’s PD Phylogenetic Diversity (Faith 1992) is the sum of branchlength that connect all the taxa occurred in a region together.picante::pd()

Phylogenetic Signal(Blomberg’s K): The more closer the speciesphylogenetically related, the more similar thetraits。picante::phylosignal()

Evolutionary Distinctiveness (ED): The unique evolutionaryinformation each species carries. picante::evol.distinct()

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 58 / 65

Page 59: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Phylogenetic beta Diversity

Phylogenetic beta diversity is how two different plots are phylogeneticallyrelated.comdist()& comdistnn() :MPD and MNTD (Webb 2000)phylosor() :Phylosor (Bryant et al. 2008)unifrac(): :Unifrac(Lozupone et al. 2006)rao() :Rao 1982, Jost 2007, Webb et al. 2008pcd() :PCD (Ives and Helmus 2010)

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 59 / 65

Page 60: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Null Models in Community Phylogenetics

Null model is an approach that could help to test the assembly of thecommunities under different randomization senarios, and help to assess therelative importance of environmental filtering, and the stochastic process.In community phylogenetics, four models are used for randomize thecommunity phylogenetic structure

Null 0 Phylogeny shuffle: This null model shuffles species labelsacross the entire phylogeny.

Null 1 Species in each sample become random draws from samplepool

Null 2 Species in each sample become random draws from phylogenypool

Null 3 Independent swap, the species pairs are kept, but swap acrosscommunities

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 60 / 65

Page 61: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Processing plant names using plantlist

taxize, taxonstand, plantlist

status(): Looking for the taxonomic status of species

data(acc dat): The accepted plant names from the Plant List

data(syn dat): Synonyms database from The Plant List

taxa.table(): Making a Taxa Table based on the result of functionTPL for Phylomatic

TPL(): Looking up Family, Family Number and Order in ModernClassification Systems.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 61 / 65

Page 62: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Using the plantlist R package

plantlist::TPL

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 62 / 65

Page 63: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Summary

In this lesson, we focused on:

1. Questions could be answered once the phylogenetic tree isavailable.

2. The active researchers in Phylogenetic Comparative Methods.

3. Phylogenetic tree inferences and the molecular clocks.

4. Phylogenetic Comparative Methods

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 63 / 65

Page 64: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Take Home Message

1. The procedures and the principles underlying phylogenticinferences are very complicated.

2. Many questions related with evolution and ecology could beanswered with the help of Phylogenetic Comparative Analysis.

3. Skills in R is essential for conducting Phylogenetic ComaparativeAnalysis, and APE package lies in the center.

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 64 / 65

Page 65: What is Phylogenetic Comparative Analysis? › uploads › 7 › 5 › 3 › 6 › ... · Questions to answer once the phylogeny is ready Contents 1 Questions to answer once the phylogeny

Phylogenetic Comparative Methods in R

Thanks for your attention.!Question?

Jinlong Zhang ([email protected]) What is Phylogenetic Comparative Analysis? 7 NOV 2016 65 / 65