The genealogy of the coalescent at one locus in two populations with migration and mutation

I just posted another R Shiny application illustrating properties of the coalescent in two populations with mutation and migration. Unfortunately, to see this one, you’ll have to download the source from Github (app.R) and run it in your local version of R. It’s not difficult, but it’s less convenient than running it on shinyapps.io. The problem arises because I use ggtree() to plot and color the tree. ggtree() is a BioConductor package, and I’m running into an error installing it in the application package. If I can’t figure it out, I may install a version of R Studio Server here and host it locally.

Here’s how to run the application in your local version of R:

    • Follow the link to Github and download app.R (click on the button labeled “Raw” at the right side of the screen and use “File->Save” to save it somewhere convenient on your hard drive.
    • Make sure your version of R has the libraries mentioned at the top of app.R installed. They are: ggplot2, shiny, cowplot, plotly, coala, ggtree, and ape. (Actually, I think you can delete cowplot and plotly from the list of libraries that are loaded. They’re leftover from some earlier experiments. To install ggtree(), you’ll first have to make sure that you have BiocManager installed. Then you can simply BiocManager::install("ggtree").
    • Launch R and make sure your working directory contains the source for app.R.
    • Then runApp() and enjoy the ride!

Updated notes – the interaction of genetic drift with mutation, migration, and selection and a new R Shiny application

I’ve updated notes on the interaction of genetic drift with mutation, and to complement the notes, I’ve written a new simulation in R Shiny and Plotly to illustrate both the dynamics of allele frequency changes within populations and the distribution of allele frequencies among populations. I’ve also updated notes on the interaction of genetic drift and natural selection. I’m having some kind of a weird permission problem with my server. A copy of the PDF that I just linked to with the original name (selection-drift.pdf) and the same permissions (at least so far as I can tell) keeps giving me a permission error when I try to download it. I’ll leave temp.pdf on the server, but I hope to fix the permission problem, so it would be best not to link to that file until I get it fixed.

Estimating viability, principles of genetic drift, and an R Shiny application illustrating genetic drift

I’ve posted the last set of notes on selection, outlining the principles of estimating viability components of fitness from observations on genotypes before and after selection. I’ve also posted notes on basic principles of genetic drift, including the concept of effective population size. In addition, I’ve written an application in R Shiny that lets you explore the properties of genetic drift. You can pick the initial allele frequency, the number of different populations subject to drift (from one to ten), the (effective) population size of each population, and the number of generations for the simulation to run.

An R Shiny application to illustrate F-statistics

I posted notes on the Wahlund effect and F-statistics a while ago. I’ve now posted an R Shiny application to illustrate the difference between Nei’s GST and Weir and Cockerham’s FST. The application simulates a sample of 25 diploid genotypes from 10 different populations. The genotypes are a multinomial sample from genotype frequencies calculated from Hardy-Weinberg expectations within each population, given the population allele frequency. That’s statistical sampling. The allele frequencies in each population are sampled from a Beta distribution with a mean of p = 0.5 and a variance of FSTp(1-p). That’s evolutionary sampling (or genetic sampling). Just as the individuals we sampled within each population are a sample of all individuals we could have sampled, the populations we sampled are a sample of all populations we could have sampled.

If you keep the parametric FST the same and just keep hitting “Go”, you’ll see that the genotype counts change every time. That’s the evolutionary sampling. You’ll find a link to the application on the lecture detail page, or you can link directly to the application on shinyapps.io.

As a reminder, if you’re interested in the source code for this or other R Shiny applications I develop for this course, they’ll all be available on Github.

Adding R Shiny applications to illustrate concepts

I started learning R Shiny this afternoon. It will take me a while to become fluent with it, but when I do, I’ll be able to construct a variety of web applications to illustrate principles of population genetics. I just finished the first one. It illustrates how the EM algorithm works, following the example in the notes accompanying the lecture for 24 January. You’ll find a link to the web application there, but if you’d like to save yourself a click, here’s the direct link: https://keholsinger.shinyapps.io/EM-algorithm-for-allele-frequencies/ . I expect to add other web applications over the next month or two. You’ll find the code for them in a new Github repository (https://kholsinger.github.io/PopGen-Shiny/). I hope you find the applications useful. If you have suggestions or requests, please drop me a line. I can’t promise that I’ll follow through, but I promise to consider any requests I receive.

New notes published – inbreeding in populations and analysis of genetic structure

I’ve just posted the next sets of notes for the course, notes on inbreeding and self-fertilization and notes on analysis of genetic structure in populations. The notes on inbreeding illustrate the effects of inbreeding by focusing on the simplest and most extreme version of inbreeding, self-fertilization. They introduce several of the senses in which the term “inbreeding coefficient” is used and illustrate how they’re related to one another. The notes on genetic structure illustrate the Wahulund effect and provide an introduction to estimating Wright’s F-statistics.

First set of new notes published – genetic transmission in populations, estimating allele frequencies, and the Hardy-Weinberg principle

I mentioned more than a month ago that I’m starting preparations for Population Genetics early this year. It’s taken me this long to post the first updates to notes for the 2019 edition of the course. You’ll find them on the lecture detail pages for 22 January and 24 January. The lecture detail page for 24 January also includes links to a couple of R scripts and accompanying JAGS files that illustrate Bayesian inference both in a simple case where it’s barely needed (estimating the allele frequency at one locus with two alleles) and in a case that’s more useful (estimating allele frequencies in the ABO blood group).

The notes are also available from individual links on the Notes page. As I mention there, the consolidated PDF containing all of the notes is from the 2017 edition of the course. I’ll update that PDF once I’ve updated all of the individual items.

You’ll also see on that page that I’ve linked to Graham Coop’s notes for his course at UC Davis. I encourage you to take a look at his notes, too. You are likely to find that he explains many things better than I do.