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, setNames(color, species.name))
}

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: 44 Lanius_tomas

No: 37 a_cattica

No: 33 a_lilygaster

No: 28 anas_marquezinus

No: 27 anas_krystallinus

No: 26 irenes_solanus

No: 25 jacam_archeriti

No: 25 indina_jonatus

No: 25 annae_gilbertus

No: 24 Jnats

No: 23 lornasaurus

No: 21 connos_peaches

No: 21 alinas_smithus

No: 15 rob_macdonus

No: 8 laus_laurus

No: 7 Ki_crabapithecus

No: 5 ela_danielinus

Session Info

sessioninfo::session_info()
## ─ Session info ───────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.3.3 (2024-02-29)
##  os       macOS Sonoma 14.1.2
##  system   aarch64, darwin20
##  ui       X11
##  language (EN)
##  collate  en_US.UTF-8
##  ctype    en_US.UTF-8
##  tz       Europe/Athens
##  date     2024-04-19
##  pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
## 
## ─ Packages ───────────────────────────────────────────────────────────────────
##  package     * version date (UTC) lib source
##  askpass       1.2.0   2023-09-03 [1] CRAN (R 4.3.0)
##  brio          1.1.4   2023-12-10 [1] CRAN (R 4.3.1)
##  bslib         0.7.0   2024-03-29 [1] CRAN (R 4.3.1)
##  cachem        1.0.8   2023-05-01 [1] CRAN (R 4.3.0)
##  cli           3.6.2   2023-12-11 [1] CRAN (R 4.3.1)
##  colorspace    2.1-0   2023-01-23 [1] CRAN (R 4.3.0)
##  credentials   2.0.1   2023-09-06 [1] CRAN (R 4.3.0)
##  crosstalk     1.2.1   2023-11-23 [1] CRAN (R 4.3.1)
##  data.table    1.15.4  2024-03-30 [1] CRAN (R 4.3.1)
##  devtools    * 2.4.5   2022-10-11 [1] CRAN (R 4.3.0)
##  digest        0.6.35  2024-03-11 [1] CRAN (R 4.3.1)
##  dplyr       * 1.1.4   2023-11-17 [1] CRAN (R 4.3.1)
##  ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.3.0)
##  evaluate      0.23    2023-11-01 [1] CRAN (R 4.3.1)
##  fansi         1.0.6   2023-12-08 [1] CRAN (R 4.3.1)
##  fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
##  fs            1.6.3   2023-07-20 [1] CRAN (R 4.3.0)
##  generics      0.1.3   2022-07-05 [1] CRAN (R 4.3.0)
##  ggplot2     * 3.5.0   2024-02-23 [1] CRAN (R 4.3.1)
##  glue          1.7.0   2024-01-09 [1] CRAN (R 4.3.1)
##  gtable        0.3.4   2023-08-21 [1] CRAN (R 4.3.0)
##  htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.3.1)
##  htmlwidgets   1.6.4   2023-12-06 [1] CRAN (R 4.3.1)
##  httpuv        1.6.14  2024-01-26 [1] CRAN (R 4.3.1)
##  httr          1.4.7   2023-08-15 [1] CRAN (R 4.3.0)
##  jquerylib     0.1.4   2021-04-26 [1] CRAN (R 4.3.0)
##  jsonlite      1.8.8   2023-12-04 [1] CRAN (R 4.3.1)
##  knitr         1.45    2023-10-30 [1] CRAN (R 4.3.1)
##  labeling      0.4.3   2023-08-29 [1] CRAN (R 4.3.0)
##  later         1.3.2   2023-12-06 [1] CRAN (R 4.3.1)
##  lazyeval      0.2.2   2019-03-15 [1] CRAN (R 4.3.0)
##  lifecycle     1.0.4   2023-11-07 [1] CRAN (R 4.3.1)
##  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.3.0)
##  memoise       2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
##  mime          0.12    2021-09-28 [1] CRAN (R 4.3.0)
##  miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
##  munsell       0.5.1   2024-04-01 [1] CRAN (R 4.3.1)
##  openssl       2.1.1   2023-09-25 [1] CRAN (R 4.3.1)
##  pak         * 0.7.2   2024-03-17 [1] CRAN (R 4.3.1)
##  pillar        1.9.0   2023-03-22 [1] CRAN (R 4.3.0)
##  pkgbuild      1.4.4   2024-03-17 [1] CRAN (R 4.3.1)
##  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.3.0)
##  pkgload       1.3.4   2024-01-16 [1] CRAN (R 4.3.1)
##  plotly      * 4.10.4  2024-01-13 [1] CRAN (R 4.3.1)
##  profvis       0.3.8   2023-05-02 [1] CRAN (R 4.3.0)
##  promises      1.3.0   2024-04-05 [1] CRAN (R 4.3.1)
##  purrr         1.0.2   2023-08-10 [1] CRAN (R 4.3.0)
##  R6            2.5.1   2021-08-19 [1] CRAN (R 4.3.0)
##  Rcpp          1.0.12  2024-01-09 [1] CRAN (R 4.3.1)
##  remotes       2.4.2.1 2023-07-18 [1] CRAN (R 4.3.0)
##  reprex      * 2.0.2   2022-08-17 [1] CRAN (R 4.3.0)
##  rlang         1.1.3   2024-01-10 [1] CRAN (R 4.3.1)
##  rmarkdown     2.26    2024-03-05 [1] CRAN (R 4.3.1)
##  rstudioapi    0.15.0  2023-07-07 [1] CRAN (R 4.3.0)
##  sass          0.4.9   2024-03-15 [1] CRAN (R 4.3.1)
##  scales        1.3.0   2023-11-28 [1] CRAN (R 4.3.1)
##  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
##  shiny         1.8.0   2023-11-17 [1] CRAN (R 4.3.1)
##  stringi       1.8.3   2023-12-11 [1] CRAN (R 4.3.1)
##  stringr       1.5.1   2023-11-14 [1] CRAN (R 4.3.1)
##  sys           3.4.2   2023-05-23 [1] CRAN (R 4.3.0)
##  testthat    * 3.2.1.1 2024-04-14 [1] CRAN (R 4.3.1)
##  tibble        3.2.1   2023-03-20 [1] CRAN (R 4.3.0)
##  tidyr         1.3.1   2024-01-24 [1] CRAN (R 4.3.1)
##  tidyselect    1.2.1   2024-03-11 [1] CRAN (R 4.3.1)
##  urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.3.0)
##  usethis     * 2.2.3   2024-02-19 [1] CRAN (R 4.3.1)
##  utf8          1.2.4   2023-10-22 [1] CRAN (R 4.3.1)
##  vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.3.1)
##  viridisLite   0.4.2   2023-05-02 [1] CRAN (R 4.3.0)
##  withr         3.0.0   2024-01-16 [1] CRAN (R 4.3.1)
##  xfun          0.43    2024-03-25 [1] CRAN (R 4.3.1)
##  xtable        1.8-4   2019-04-21 [1] CRAN (R 4.3.0)
##  yaml          2.3.8   2023-12-11 [1] CRAN (R 4.3.1)
## 
##  [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
## 
## ──────────────────────────────────────────────────────────────────────────────