DOI: 10.5061/dryad.sxksn03dp
title: Avian cranial evolution is influenced by shape interactions between hard and soft tissue traits

description: Changes in the structure and relative size of the brain are thought to be
 key transformations in the evolution of birds, reflecting innovations and
 diversity of neurosensory and cognitive capabilities. These changes do not
 occur in isolation, being accompanied by many other derived morphological
 characteristics. In the avian head alone, these include the evolution of a
 toothless beak, increase in relative eye size, and reduction and
 restructuring of jaw muscles. Several developmental trade-offs have been
 proposed to explain the interrelationships among these traits, but how
 these developmental patterns translate into evolutionary correlations
 among cranial traits is poorly understood. Here, we use two-block partial
 least squares analyses and Ornstein-Uhlenbeck models of adaptive trait
 evolution to explore the phenotypic evolution of hard and soft cranial
 tissues and test hypotheses of correlated trait evolution. In pairwise
 analyses, we found that all traits are significantly correlated, and found
 support for a form of adaptive trait evolution across the whole head in
 which traits interact reciprocally via the neurocranium. Together, these
 results highlight the integrated nature of the avian head and reveal that
 the evolution of diverse phenotypes is a result of complex multiple
 interactions among hard and soft tissue traits.
description: # Avian cranial evolution is influenced by shape interactions between hard
 and soft tissue traits
 [https://doi.org/10.5061/dryad.sxksn03dp](https://doi.org/10.5061/dryad.sxksn03dp) ## Description of the data and file structure This repository contains all data, scripts and supplementary figures from "**Avian cranial evolution is influenced by shape interactions between hard and soft tissue traits**." ## Code/software All code is written for R (v. 2024.12.1+563), with required packages labelled at the start of each script. Packages should be installed prior to running scripts. The scripts for replicating this study are in two parts (Morphometrics and mvSLOUCH) and are available via Zenodo. The morphometrics scripts generate the data input into the mvSLOUCH analysis and should be run first. The required input data for each set of scripts is included in Dryad in the relevant section. Instructions for constructing the phylogeny used in these analyses are included in the Phylogeny Construction section, also available via Zenodo. This section is included for reference, and it is not required to run through this script because the final phylogeny is included in both the Morphometrics and mvSLOUCH sections as the `tree.tre` object. ## Part 1: Morphometrics ### 1.1 Contents **Morphometrics data** **(available via Dryad)** ``` morphometrics_data.zip ┣ input_data ┃ ┣ classifier.csv ┃ ┣ endo_resampling_template.csv ┃ ┣ patchpoints.pts ┃ ┣ skull_resampling_template.csv ┃ ┣ slidedlms.endocast.rda ┃ ┣ slidedlms.skull.rda ┃ ┗ tree.tre ┣ output_data ┃ ┣ ES.rda ┃ ┣ PCA.3D.endo.rda ┃ ┣ PCA.3D.muscle.rda ┃ ┣ PCA.3D.neur.rda ┃ ┣ PCA.3D.rostrum.rda ┃ ┣ PCA.3D.skull.rda ┃ ┣ reflected_patched_endocasts.rda ┃ ┣ Y.gpa.endo.rda ┃ ┣ Y.gpa.muscle.rda ┃ ┣ Y.gpa.neur.rda ┃ ┣ Y.gpa.rostrum.rda ┃ ┗ Y.gpa.skull.rda ┣ ply_ASCII_endocast ┣ ply_ASCII_skull ┣ pts_endocast ┗ pts_skull ``` **Morphometrics scripts (available via Zenodo)** ``` morphometrics_scripts ┣ scripts ┗ ┣ 1.skull_resampling_sliding.R ┣ 2.endocast_resampling_sliding.R ┣ 3.skull_alignment.R ┣ 4.endocast_patching_alignment.R ┣ 5.ES_script.R ┣ 6.two_block_pls.R ┣ 7.data_export.R ┣ 8.plotting_code.R ┗ source_code ┗functions.R ``` ## 1.2 Description of files and variables ### 1.2.1 morphometrics_data ### Folder: input_data (available via Dryad) #### File: classifier.csv **Description:** Contains information for all 322 species included in the study. This includes clade, specimen number, and source, body mass in grams, and brain volume in mm^3^. #### File: patchpoints.pts **Description:** Template for endocast surface semilandmark patch, used in `2.endocast_resampling_sliding.R` script (see details below). The template is created on the surface mesh of *Anhinga anhinga,* which is contained within the `ply_ASCII_endocast.zip` file. #### File: tree.tre **Description:** Full time-scaled phylogeny in `.tre` format for 322 species included in study. Instructions for recreating the phylogeny are contained in `phylogeny_construction.zip`. #### File: skull_resampling_template.csv **Description:** Table containing template for standardised resampling of skull semilandmark curves, used in `1.skull_resampling_sliding.R` script. Information includes start point, end point, and the number of curves required for each curve. Only `lm1`,`lm2`, and `ptswanted` columns are necessary for the curve resampling script. ##### Variables * Curves: Curve identifier number * lm1: Start point of curve (landmark number) * lm2: End point of curve (landmark number) * ptswanted: Number of points needed for resampling * start: Landmark number of start of curve (after resampling, excluding lm1) * end: Landmark number of end of curve (after resampling, excluding lm2) #### File: endo_resampling_template.csv **Description:** Table containing template for standardised resampling of endocast semilandmark curves, used in `2.endocast_resampling_sliding.R` script. Information includes start point, end point, and the number of curves required for each curve. Only `lm1`,`lm2`, and `ptswanted` columns are necessary for the curve resampling script. ##### Variables * Curves: Curve identifier number * lm1: Start point of curve (landmark number) * lm2: End point of curve (landmark number) * ptswanted: Number of points needed for resampling * start: Landmark number of start of curve (after resampling, excluding lm1) * end: Landmark number of end of curve (after resampling, excluding lm2) #### File: slidedlms.endocast.rda **Description:** R data file containing endocast landmarks for all specimens after resampling and sliding procedure in `2.endocast_resampling_sliding.R`. This information is used in the `4.endocast_patching_alignment.R` script. #### File: slidedlms.skull.rda **Description:** R data file containing endocast landmarks for all specimens after resampling and sliding procedure in ` 1.skull_resampling_sliding.R`. This information is used in the `3.skull_alignment.R` script. ### Folder: pts_endocast **Description:** Individual endocast landmark files for all 322 species included in the study and used in `2.endocast_resampling_sliding.R`. Landmark files are in `pts` format and each contains 14 anatomical (Bookstein Type I and II) landmarks and 15 semilandmark curves. Each row represents a single landmark and contains three columns of X, Y, and Z spatial coordinates. Refer to the Supplementary File for details of each landmark. #### Folder: pts_skull **Description:** Individual skull landmarks for all 322 species included in the study and used in `1.skull_resampling_sliding.R`. Landmark files are in `pts` format and each contains 20 anatomical (Bookstein Type I and II) landmarks and 21 semilandmark curves. Each row represents a single landmark and contains three columns of X, Y, and Z spatial coordinates. Refer to the Supplementary File for details of each landmark. #### Folder: ply_ASCII_endocast **Description:** Contains three-dimensional (3D) endocast surface meshes for all 322 species included in the study, in ASCII `.ply` format and used in `2.endocast_resampling_sliding.R` script. Meshes are scaled in mm and can be opened and viewed in any 3D viewing software that supports `.ply` format. The source of all scans is listed in the `classifier.csv` document. #### Folder: ply_ASCII_skull **Description:** Contains three-dimensional (3D)  skull surface meshes for all 322 species included in the study, in ASCII `.ply` format and used in `1.skull_resampling_sliding.R` script. Meshes are scaled in mm and can be opened and viewed in any 3D viewing software that supports `.ply` format. The source of all scans is listed in the `classifier.csv` document. ### 1.2.2 output_data (available via Dryad) This folder contains output files generated in the morphometrics section. **File: ES.rda** **Description:** R data file containing adjusted orbit diameter values for all species. **File: PCA.3D.endo.rda** **Description:** R file containing PCA eigenvalues for patched endocast landmarks. **File: PCA.3D.muscle.rda** **Description:** R file containing PCA eigenvalues for locally-aligned jaw muscle landmarks. **File: PCA.3D.neur.rda** **Description:** R file containing PCA eigenvalues for locally-aligned neurocranium landmarks. **File: PCA.3D.rostrum.rda** **Description:** R file containing PCA eigenvalues for locally-aligned rostrum landmarks. **File: PCA.3D.skull.rda** **Description:** R file containing PCA eigenvalues for globally-aligned skull landmarks. **File: reflected_patched_endocasts.rda** **Description:** R file containing landmark data for all specimens after application of surface patch semilandmarks. **File: Y.gpa.endo.rda** **Description:** R file containing Procrustes-aligned endocast landmark coordinates for all specimens. **File: Y.gpa.muscle.rda** **Description:** R file containing Procrustes-aligned jaw muscle landmark coordinates for all specimens. **File: Y.gpa.neur.rda** **Description:** R file containing Procrustes-aligned neurocranium landmark coordinates for all specimens. **File: Y.gpa.rostrum.rda** **Description:** R file containing Procrustes-aligned rostrum landmark coordinates for all specimens. **File: Y.gpa.skull.rda** **Description:** R file containing Procrustes-aligned skull landmark coordinates for all specimens. #### **1.2 Instructions for running morphometric analyses.** #### 1.2.1 Data (available via Dryad) `morphometrics/input_data/` contains input data needed to run morphometric analyses, including species data for all specimens (`classifier.csv`), landmark patching template for endocast (`patchpoints.pts`), semilandmark curve resampling templates (`endo_resampling_template.csv` and `skull_resampling_template.csv`) and the full, timescaled phylogeny for the dataset (`tree.tre`). It also contains the output of the resampling and sliding portion of the script, i.e. the input landmark data for the morphometric analyses (`slidedlms.endocast.rda `and `slidedlms.skull.rda`). `morphometrics/output_data/` contains the output from the morphometric analyses, including Procrustes alignments `Y.gpa....rda `and principal component analyses `PCA.3D....rda` for each landmark subset (endocast, neurocranium, jaw muscle and rostrum). `morphometrics/ply_ASCII_endocast/` and `morphometrics/ply_ASCII_skull/` contain meshes for all endocasts and skulls used in the analysis, in ply ASCII format. `morphometrics/pts_endocast/` and `morphometrics/pts_skull/` contain landmark data for all specimens, for endocasts and skulls, respectively. #### 1.2.2 Scripts (available via Zenodo) #### Folder: morphometrics_scripts `morphometrics/scripts/` contains all scripts required to run morphometric analyses on the dataset, which should be run in order. All required packages are listed in the scripts and should be installed prior to running the scripts. The scripts `1.skull_resampling_sliding.R` and `2.endocast_resampling_sliding.R` import landmark data from `morphometrics/pts_skull/` and `morphometrics/pts_endocast/`, respectively, and resample the semilandmark curves to standard numbers of landmarks based on the relevant `...resampling_template.csv` file. The scripts include the process for estimating missing landmarks, sliding the resampled semilandmark curves to minimise bending energy, and exporting the resultant landmark files as a single R script for each landmark set (endocasts and skulls). `3.skull_alignment` imports the skull landmarks from step `1`, reflects the landmarks across the sagittal plane and performs a generalised Procrustes alignment, and a PCA on the subsequently aligned right-side landmarks for each subset of skull landmarks. `4.endocast_patching_alignment` does the same, but first places surface semilandmarks on each specimen using the `patchpoints` template before the sagittal reflection step. `5.ES_script.R` uses landmarks from the skull to calculate orbit diameter adjusted for neurocranium size. `6.two_block_pls.R` performs two-block partial least squares on all pairwise combinations of traits. `7.data_export.R` exports all results for `mvSLOUCH` analyses. `8.plotting_code.R` contains code for plotting data. The folder `source_code` contains all specialist functions required to perform morphometrics analyses. ### Part 2: mvSLOUCH process #### 2.1 Contents **mvSLOUCH data (available via Dryad)** ``` mvSLOUCH_data.zip ┣ indivResults ┃ ┣ bootstrap ┃ ┣ initialdiagUTASR ┃ ┣ model01 ┃ ┣ model02 ┃ ┣ model03 ┃ ┣ model04 ┃ ┣ model05 ┃ ┣ model06 ┃ ┣ model07 ┃ ┣ model08 ┃ ┣ model09 ┃ ┣ model10 ┃ ┣ model11 ┃ ┣ model12 ┃ ┗ modelBM ┣ RandomSeeds ┃ ┣ bootstrap ┃ ┣ initialdiagUTASR ┃ ┣ model01 ┃ ┣ model02 ┃ ┣ model03 ┃ ┣ model04 ┃ ┣ model05 ┃ ┣ model06 ┃ ┣ model07 ┃ ┣ model08 ┃ ┣ model09 ┃ ┣ model10 ┃ ┣ model11 ┃ ┣ model12 ┃ ┣ modelBM ┃ ┣ BestFoundModel.RData ┃ ┗ Optima_bestmodel.pdf ┣ raw_data ┃ ┣ classifier_mvSLOUCH.csv ┃ ┣ mvslouch_data.csv ┃ ┗ tree.tre ┣ Results ┗ ┣ bootstrap ┣ initialdiagUTASR ┣ model01 ┣ model02 ┣ model03 ┣ model04 ┣ model05 ┣ model06 ┣ model07 ┣ model08 ┣ model09 ┣ model10 ┣ model11 ┣ model12 ┣ modelBM ┣ BestFoundModel.RData ┣ Optima_bestmodel.pdf ┗ Optima_bestmodel_traits.pdf ``` **mvSLOUCH scripts (available via Zenodo)** ``` mvSLOUCH_scripts ┗ scripts ┣ 1_startingscript.R ┣ datasetup.R ┣ do_parametric_bootstrap.R ┣ model01.R ┣ model02.R ┣ model03.R ┣ model04.R ┣ model05.R ┣ model06.R ┣ model07.R ┣ model08.R ┣ model09.R ┣ model10.R ┣ model11.R ┣ model12.R ┣ modelBM.R ┣ network_plot.R ┣ regimes.R ┣ startingmodels.R ┣ tosource.R ┗ usercontrolledvariables.R ``` # 2.2 Description of files and variables ### Folder: mvSLOUCH_data (available via Dryad) #### Folder: indivResults **Description:** Contains output folders into which model outputs are saved. #### Folder: RandomSeeds **Description:** Contains random seeds generated for each model runthrough. #### Folder: raw_data **Desription:** Contains input data for mvSLOUCH analyses. #### File: classifier_mvSLOUCH.csv **Description:** Contains taxon information for each species included in study. #### File: mvslouch_data.csv **Description:** Contains PC scores and adjusted orbit diameter data for mvSLOUCH analysis. This information is generated in the morphometric analysis section. #### File: tree.tre **Description:** Timescaled phylogenetic tree for all 322 species included in study. #### Folder: scripts (available via Zenodo) **Description:** Contains all scripts necessary for running mvSLOUCH analysis (see section 2.2: Instructions for running mvSLOUCH analysis, below). These scripts are available via Zenodo. ## 2.3 Instructions for running mvSLOUCH analysis ##### Input folder (available via Dryad) `mvSLOUCH/raw_data/` contains input data files for `mvSLOUCH` analyses. `classifier.csv` contains taxon data. `mvslouch_data.csv` contains relevant PC scores for each trait and adjusted orbit diameter for each specimen. `tree.tre` is the timescaled phylogeny for all taxa, created with scripts contained in the `phylogeny.zip` folder. ##### Output folders (available via Dryad) The folders named `mvSLOUCH/indivResults/`, `mvSLOUCH/RandomSeeds/` and `mvSLOUCH/Results` contain output folders for all models for each analysis. Results will be saved into these folders. ### Folder: mvSLOUCH_scripts ##### Script folder (available via Zenodo) `mvSLOUCH_scripts/` contains all R scripts needed to perform `mvSLOUCH` analyses. All scripts in this folder are adapted from Bartoszek et al., 2024 ([https://doi.org/10.1111/2041-210X.14376](https://doi.org/10.1111/2041-210X.14376)). The supplementary data for this paper contains the original scripts and should be referred to for any queries (original code available at Zenodo: [https://doi.org/10.5281/zenodo.11286569](https://doi.org/10.5281/zenodo.11286569)). `1_starting_script.R` is the shell script containing all separate scripts, which should be run through in order. `usercontrolledvariables.R` defines pre-set starting variables for the analyses, including file pathways. `datasetup.R` contains code for reading in and standardising data contained in `mvslouch_data.csv` file prior to analysis. `tosource.R` contains functions specific to the `mvSLOUCH` analysis. `startingmodels.r` is the script to initiate the starting conditions for each model, and should be run to completion before attempting to run any individual model. Scripts `model01.R` to `model12.R` contain the model parameters for each hypothesis outlined in the manuscript, and should be run through in order in the shell script. Finally, `do_parametric_bootstrap.R` contains a script to sample outputs from all models and summarises the best supported model and its parameter. Trait optima plots (Fig. 2 in manuscript) can be made from the output of the parametric bootstrap with the `make_optima_plot.R` script. ### 3. Phylogeny construction ### Folder: phylogeny_construction (available via Zenodo) `phylogeny_construction`contains R code and instructions for constructing the phylogenetic tree used in the study, using the `tree.merger` function from the R package `RRphylo`. Refer to `Marek&Felice_treemerging_README.md` for detailed instructions. This information is included for reference, the final tree used in the analysis is contained in both `morphometrics/input_data/tree.tre` and `mvSLOUCH/raw_data/tree.tre` . ``` phylogeny_construction ┣ Marek&Felice_treemerger_part1.r ┣ Marek&Felice_treemerger_part2.r ┗ Marek&Felice_treemerging_README.md ```