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: 49 Corvus Simonsae

No: 31 Alatus Borealis

No: 28 equus albus

No: 26 aromat_jamimbo

No: 26 bordomordo

No: 25 Neilus parrot

No: 25 nice bird

No: 24 Parrot

No: 22 Zenan Chen

No: 21 Corvus corax

No: 21 Blah

No: 11 Petroica macrocephala

No: 9 Big bird

No: 6 Kaka

Session Info

sessioninfo::session_info()
## ─ Session info ──────────────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.3.2 (2023-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-03-18
##  pandoc   3.1.8 @ /usr/bin/ (via rmarkdown)
## 
## ─ Packages ──────────────────────────────────────────────────────────────────────────
##  ! package     * version date (UTC) lib source
##  P bslib         0.4.2   2022-12-16 [?] CRAN (R 4.3.0)
##  P cachem        1.0.6   2021-08-19 [?] CRAN (R 4.3.1)
##  P cli           3.6.0   2023-01-09 [?] CRAN (R 4.3.1)
##  P colorspace    2.1-0   2023-01-23 [?] CRAN (R 4.3.0)
##  P crosstalk     1.2.0   2021-11-04 [?] CRAN (R 4.3.0)
##  P data.table    1.14.8  2023-02-17 [?] CRAN (R 4.3.0)
##  P digest        0.6.31  2022-12-11 [?] CRAN (R 4.3.0)
##  P dplyr       * 1.1.0   2023-01-29 [?] CRAN (R 4.3.1)
##  P ellipsis      0.3.2   2021-04-29 [?] CRAN (R 4.3.0)
##  P evaluate      0.20    2023-01-17 [?] CRAN (R 4.3.1)
##  P fansi         1.0.4   2023-01-22 [?] CRAN (R 4.3.0)
##  P fastmap       1.1.0   2021-01-25 [?] CRAN (R 4.3.1)
##  P generics      0.1.3   2022-07-05 [?] CRAN (R 4.3.0)
##  P ggplot2     * 3.4.1   2023-02-10 [?] CRAN (R 4.3.1)
##  P glue          1.6.2   2022-02-24 [?] CRAN (R 4.3.0)
##  P gtable        0.3.1   2022-09-01 [?] CRAN (R 4.3.1)
##  P htmltools     0.5.4   2022-12-07 [?] CRAN (R 4.3.1)
##  P htmlwidgets   1.6.1   2023-01-07 [?] CRAN (R 4.3.1)
##  P httr          1.4.5   2023-02-24 [?] CRAN (R 4.3.1)
##  P jquerylib     0.1.4   2021-04-26 [?] CRAN (R 4.3.0)
##  P jsonlite      1.8.4   2022-12-06 [?] CRAN (R 4.3.0)
##  P knitr         1.42    2023-01-25 [?] CRAN (R 4.3.1)
##  P labeling      0.4.2   2020-10-20 [?] CRAN (R 4.3.0)
##  P lazyeval      0.2.2   2019-03-15 [?] CRAN (R 4.3.0)
##  P lifecycle     1.0.3   2022-10-07 [?] CRAN (R 4.3.0)
##  P magrittr      2.0.3   2022-03-30 [?] CRAN (R 4.3.0)
##  P munsell       0.5.0   2018-06-12 [?] CRAN (R 4.3.0)
##  P pillar        1.8.1   2022-08-19 [?] CRAN (R 4.3.1)
##  P pkgconfig     2.0.3   2019-09-22 [?] CRAN (R 4.3.0)
##  P plotly      * 4.10.1  2022-11-07 [?] CRAN (R 4.3.0)
##  P purrr         1.0.1   2023-01-10 [?] CRAN (R 4.3.0)
##  P R6            2.5.1   2021-08-19 [?] CRAN (R 4.3.0)
##    renv          0.14.0  2021-07-21 [1] CRAN (R 4.3.1)
##  P rlang         1.0.6   2022-09-24 [?] RSPM (R 4.3.1)
##  P rmarkdown     2.20    2023-01-19 [?] CRAN (R 4.3.1)
##  P sass          0.4.5   2023-01-24 [?] CRAN (R 4.3.1)
##  P scales        1.2.1   2022-08-20 [?] CRAN (R 4.3.0)
##  P sessioninfo   1.2.2   2021-12-06 [?] CRAN (R 4.3.1)
##  P tibble        3.1.8   2022-07-22 [?] CRAN (R 4.3.1)
##  P tidyr         1.3.0   2023-01-24 [?] CRAN (R 4.3.0)
##  P tidyselect    1.2.0   2022-10-10 [?] CRAN (R 4.3.0)
##  P utf8          1.2.3   2023-01-31 [?] CRAN (R 4.3.0)
##  P vctrs         0.5.2   2023-01-23 [?] CRAN (R 4.3.1)
##  P viridisLite   0.4.1   2022-08-22 [?] CRAN (R 4.3.1)
##  P withr         2.5.0   2022-03-03 [?] CRAN (R 4.3.0)
##  P xfun          0.36    2022-12-21 [?] CRAN (R 4.3.1)
##  P yaml          2.3.7   2023-01-23 [?] CRAN (R 4.3.0)
## 
##  [1] /home/neil/work/git/hub/RSE-Sheffield/collaborative_github_exercise/renv/library/R-4.3/x86_64-pc-linux-gnu
##  [2] /tmp/RtmpT9PRXR/renv-system-library
## 
##  P ── Loaded and on-disk path mismatch.
## 
## ─────────────────────────────────────────────────────────────────────────────────────

This projects uses renv for dependency management.