Evolutionary lottery of skull and beak morphology


Beak and skull shapes in birds of prey (“raptors”) are strongly coupled and largely controlled by size.

gif provided by the awesome Jen Bright @MorphobeakGeek!

In this exercise we will use a github repo to collaboratively collate and simulate evolutionary trajectories for each participants’ species body size using a simple brownian motion evolutionary model. This assumes evolutionary steps to progress comletely at random. You could say:

it’s a bit of lottery!


Each participant has created and contributed a file specifying the parameters required to simulate and plot their species evolutionary trajectory. We’ve collect all participants’ files in the master repo. Next we need to simulate species trajectories plot them up.

Participants will then get to see the skull and beak shape corresponding to their species relative body size!


setup

First we load the required packages and create some objects to compile data on trait evolution for each species.

require(dplyr)
require(ggplot2)
require(plotly)
set.seed(1)

t <- 0:100  # generate time vector
dt <- NULL # generate object to compile time-series data
cols <- NULL # generate object to compile trendline colours

Simulate trait evolution, iterate over all species files in params/ folder

We’ll use the parameters supplied in your scripts to generate brownian trait evolution trendline for each species.

spp.files <- dir("params/")[dir("params/") != "params_tmpl.R"]

for(spp in spp.files){
  # source parameters for each species
  source(file.path("params", spp))
  
  # generate trait evolution time-series and compile plotting data
  dt <-  rbind(dt, data.frame(t, 
                              trait = c(0, rnorm(n = length(t) - 1, sd = sqrt(sig2)) %>% cumsum()),
                              species = species.name))
  cols <- c(cols, color)
}

Plot trait evolution timeseries

Use the data generated to plot all species.

p <- ggplot(data = dt, aes(x = t, y = trait, group = species, colour = species)) + 
  geom_line() + 
  scale_colour_manual(values = cols) 
  
  ggplotly(p)



Skulls! find the skull associated with your species:


Skulls are organised from largest to smallest. The largest skulls are vulture-like, (e.g. no. 50, the Andean condor Vultur gryphus) and the smallest are falconet-like, (e.g. no. 1 Collared falconet Microhierax caerulescens)

No: 47 mejia

No: 31 Sola’s pigeon

No: 30 Neil’s Parrot

No: 28 Euler Bird

No: 26 Sourojit Goswami

No: 25 Goblininus

No: 25 robin

No: 24 nc bird

No: 21 Nitkamon’s bird

No: 20 Freya’s bird

No: 19 Red_Robin

No: 17 Cannellini vermicellivorus

No: 7 *** Zhang’s Rabbit ***

No: 2 Kat’s bird

Session Info

sessioninfo::session_info()
## ─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.4.2 (2024-10-31)
##  os       Arch Linux
##  system   x86_64, linux-gnu
##  ui       X11
##  language (EN)
##  collate  en_GB.utf8
##  ctype    en_GB.utf8
##  tz       Europe/London
##  date     2024-11-18
##  pandoc   3.1.11.1 @ /usr/bin/ (via rmarkdown)
## 
## ─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
##  package     * version date (UTC) lib source
##  bslib         0.8.0   2024-07-29 [2] CRAN (R 4.4.1)
##  cachem        1.1.0   2024-05-16 [2] CRAN (R 4.4.0)
##  cli           3.6.3   2024-06-21 [2] CRAN (R 4.4.1)
##  colorspace    2.1-1   2024-07-26 [2] CRAN (R 4.4.1)
##  crosstalk     1.2.1   2023-11-23 [2] CRAN (R 4.4.0)
##  data.table    1.16.2  2024-10-10 [2] CRAN (R 4.4.1)
##  digest        0.6.37  2024-08-19 [2] CRAN (R 4.4.1)
##  dplyr       * 1.1.4   2023-11-17 [1] CRAN (R 4.4.0)
##  evaluate      1.0.1   2024-10-10 [2] CRAN (R 4.4.1)
##  fansi         1.0.6   2023-12-08 [2] CRAN (R 4.4.0)
##  fastmap       1.2.0   2024-05-15 [2] CRAN (R 4.4.0)
##  generics      0.1.3   2022-07-05 [2] CRAN (R 4.4.0)
##  ggplot2     * 3.5.1   2024-04-23 [1] CRAN (R 4.4.0)
##  glue          1.8.0   2024-09-30 [2] CRAN (R 4.4.1)
##  gtable        0.3.6   2024-10-25 [2] CRAN (R 4.4.1)
##  htmltools     0.5.8.1 2024-04-04 [2] CRAN (R 4.4.0)
##  htmlwidgets   1.6.4   2023-12-06 [2] CRAN (R 4.4.0)
##  httr          1.4.7   2023-08-15 [2] CRAN (R 4.4.0)
##  jquerylib     0.1.4   2021-04-26 [2] CRAN (R 4.4.0)
##  jsonlite      1.8.9   2024-09-20 [2] CRAN (R 4.4.1)
##  knitr         1.47    2024-05-29 [1] CRAN (R 4.4.0)
##  labeling      0.4.3   2023-08-29 [2] CRAN (R 4.4.0)
##  lazyeval      0.2.2   2019-03-15 [2] CRAN (R 4.4.0)
##  lifecycle     1.0.4   2023-11-07 [2] CRAN (R 4.4.0)
##  magrittr      2.0.3   2022-03-30 [2] CRAN (R 4.4.0)
##  munsell       0.5.1   2024-04-01 [2] CRAN (R 4.4.0)
##  pillar        1.9.0   2023-03-22 [2] CRAN (R 4.4.0)
##  pkgconfig     2.0.3   2019-09-22 [2] CRAN (R 4.4.0)
##  plotly      * 4.10.4  2024-01-13 [2] CRAN (R 4.4.0)
##  purrr         1.0.2   2023-08-10 [2] CRAN (R 4.4.0)
##  R6            2.5.1   2021-08-19 [2] CRAN (R 4.4.0)
##  rlang         1.1.4   2024-06-04 [2] CRAN (R 4.4.0)
##  rmarkdown     2.29    2024-11-04 [2] CRAN (R 4.4.2)
##  sass          0.4.9   2024-03-15 [2] CRAN (R 4.4.0)
##  scales        1.3.0   2023-11-28 [2] CRAN (R 4.4.0)
##  sessioninfo   1.2.2   2021-12-06 [2] CRAN (R 4.4.0)
##  tibble        3.2.1   2023-03-20 [2] CRAN (R 4.4.0)
##  tidyr         1.3.1   2024-01-24 [1] CRAN (R 4.4.0)
##  tidyselect    1.2.1   2024-03-11 [2] CRAN (R 4.4.0)
##  utf8          1.2.4   2023-10-22 [2] CRAN (R 4.4.0)
##  vctrs         0.6.5   2023-12-01 [2] CRAN (R 4.4.0)
##  viridisLite   0.4.2   2023-05-02 [2] CRAN (R 4.4.0)
##  withr         3.0.2   2024-10-28 [2] CRAN (R 4.4.1)
##  xfun          0.49    2024-10-31 [2] CRAN (R 4.4.1)
##  yaml          2.3.9   2024-07-05 [1] CRAN (R 4.4.1)
## 
##  [1] /home/neil/R/x86_64-pc-linux-gnu-library/4.4
##  [2] /usr/lib/R/library
## 
## ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

This projects uses renv for dependency management.