Landscape near Mt. Olympus, Greece
Orlando Schwery
Orlando Schwery - Introduction to RevBayes Orlando Schwery - Introduction to RevBayes | Orlando Schwery

Introduction to RevBayes

BCB 503, Fall 2021 University of Idaho

During my stay in the Harmon & Tank labs at the University of Idaho, I taught a workshop/course on using RevBayes. It was particularly focused on easing way into the first steps in Rev for grad students (from UI and the nearby Univerisity of Washington) who mainly had R experience.

A lot of it was simply based on the excellent tutorials on the RevBayes website, which you should consult for more in-depth tutorials. I have modified and added to the examples there according to the needs of my workshop participants.

Below the slides and code files used during the workshop. If you have questions or feedback feel free to contact me.

Workshop Programme

Each section contains my slides as a PDF, an HTML-vignette that leads through the coding we’ve covered during the session, and any code files we may have used (which may or may not include the solutions to activities). Some analyses re-use code-files from earlier sessions, in which case I didn’t re-link them, relying on people to find them on here once they look at the session content.

1. Introduction

Covers Rev-setup, an introduction to the concept of graphical modeling, and the basics of coding in the Rev-Language.

Intro-Slides, Intro Code-Vignette

testcode1.Rev, testcode2.Rev

2. Traits

Covers models of trait evolution (based on a simple BM model) and how to set up and run MCMCs in RevBayes.

This is used as an occasion to rehash the point of the different node types, and thus the importance of correctly assigning the variables. We also take a closer look at the logic behind the models creating distributions which we draw from, and what it means when we clamp data to those.

Trait-Slides, Trait Code-Vignette

traits.nex, trees.nex

3. Biogeography

Covers models for ancestral area reconstruction (based on a simple DEC model).

This includes more on data manipulation, setting up rate matrices, more MCMC monitors, and how to summarise results. We also cover a few coding practices, and how to make a DAG of our model.

As a recap from the Trait session, we want to analyse our data from last time with a more complex model, and thus face the task of upgrading our BM model to a simple OU model.

BioGeo-Slides, BioGeo Code-Vignette, OU Code-Vignette

silversword.n4.range.nex, silversword.tre

4. Diversification

Covers birth-death models and SSE-type models.

This includes setting up standard BiSSE to test for the influence of a binary trait on speciation and extinction.

We also use the occasion to up our coding practices by calling code files from a runfile instead of having everyting in one script. This then allows us to recombine different code parts and easily switch our analysis from using the BiSSE model to using MuSSE.

***Update!***

I added a variation of MuSSE, where we consider the 4 combinations of states of two binary traits (multitrait MuSSE) instead of 4 states of one trait (multistate MuSSE). The main difference is how to set up the transition rates to disallow both binary traits to change at the same time. I end with some notes on how the same way of setting up the code can be used for ordered traits, or to test specific interactions of the diversification rates (i.e. the effect of both traits being additive when combined).

Div-Slides, Div Code-Vignette

primates_activity_period.nex, primates_mating_system.nex, primates_tree.nex

runfile.Rev, bisse.Rev, musse.Rev, musse_binary.Rev

5. Diversification-Add-On

Here we used the fact that class didn’t meet to recapitulate some aspects of the diversification models we looked at before. Particularly, we use the model DAGs to help us better understand how simple BD models extend to more complex SSE models.

We first move step-by-step from Yule and BD to BiSSE. Then we cover the logic of how BiSSE (binary trait) can be expanded to MuSSE (multi-state trait), and how those in turn expand to CID-2 (two character independent rate classes) and HiSSE (both trait-dependent and trait-independent rate classes).

Div-Add-On-Slides

cid2.Rev, hisse3.Rev

6. Tree Building & Dating

Covers building a phylogeny from a DNA alignment, as well as jointly building and time calibrating it.

We go in sequence through simple tree building, and joint dating with either only a relaxed clock, and node calibration.

Intro-Slides, Intro Code-Vignette

primates_and_galeopterus_cytb.nex, bears_cytb.nex

runfile_dating_global.Rev, subst_GTRGamma.Rev, tree_BD.Rev, clock_globalMolec.Rev

runfile_dating_relaxed.Rev, clock_relaxedMolec.Rev

runfile_dating_node.Rev, tree_BD_node.Rev,

7. Joint Analysis

Covers the particular strength of RevBayes to be able to combine several of the covered models for joint analyses.

We look at two examples of joint inferences: building and dating a tree under the BiSSE model, and stratigraphic dating with the DEC model. We code up the former, highlighting how different model components are like blocks that can be exchanged for one another.

Joint-Slides,

runfile_dating_bearSSE.Rev, bisse_joint2.Rev