DOI: 10.5061/dryad.crjdfn3dm
title: Weak integration allows novel fin shapes and spurs locomotor diversity in reef fishes

description: In complex functional systems composed of many traits, selection for
 specialized function can induce trait evolution by acting directly on
 individual components within the system, or indirectly through networks of
 trait integration. However, strong integration can also hinder
 diversification into regions of trait space that are not aligned with axes
 of covariation among traits. As a result, non-independence among traits
 may limit capacity for functional expansion. We explore this dynamic in
 the evolution of fin shapes in 106 species from 38 families of coral reef
 fishes, a polyphyletic assemblage that shows exceptional diversity in
 locomotor function. Despite strong shared developmental pathways and
 expectations of a strong match between form and function, we find that
 species that share swimming mode show substantial disparity in fin shape,
 and preferred swimming mode is a poor predictor of fin shape. The
 evolution of fin shape is weakly integrated across the four functionally
 dominant fins in swimming (the pectoral, caudal, dorsal, and anal fins)
 and is weakened as derived swimming modes evolve. The weak integration
 among fins in the ancestral locomotor condition provides a primary axis of
 diversification while allowing for substantial off-axis diversification
 via independent trait responses to selection. However, the evolution of
 novel locomotor modes coincides with a loss of integrated axes of
 covariation among fins. Our study highlights the need for additional work
 on the functional consequences of fin shape in fishes and impact of
 evolutionary integration on functions other than locomotion.
description: # Weak integration allows novel fin shapes and spurs locomotor diversity
 in reef fishes
 [https://doi.org/10.5061/dryad.crjdfn3dm](https://doi.org/10.5061/dryad.crjdfn3dm) ## Description of the data and file structure This dataset contains geometric morphometric fin shape data, naming convention files associated with the shape data, an R script that contains all analyses and figures. The files we generated by running the script and used for analyses for rates of fin shape evolution, hypervolume simulation outputs, and stoachastic character mapping of swimming mode onto the phylogeny are provided so that users may verify similar results on their machines.  ### Files and variables #### File: FinRates2.csv **Description:** This file contains the evolutionary rates and disparity calculated using the R package 'geomorph'.  ##### Variables * fin: The type of fin on the fish for which the rate and disparity is calculated * group: The swimming mode used by the fish. BCF = Body Caudal Fin Swimmers, Benthic = Benthic species, MPF-L= Median Paired Fin - Labriform Swimmers, MPF-T = Median Paired Fin - Tetraodontiform Swimmers.   * RateGeo_Full: The evolutionary rate calculated using the 'compare.evol.rates' function in the 'geomorph' package * Disparity: The disparity in fin shape calculated using the 'morphol.disparity' function in the 'geomorph' package #### File: ReefFishCategoricals.csv **Description:** This file contains the categorical information related to the reef fishes in the data set ##### Variables * Species: The genus_species of the fish after substitutions were made to match the phylogeny * Family: the family the fish belongs to * SpeciesOriginal: The original genus_species before substituting species to match the phylogeny * Swim: The swimming mode used by the fish #### File: PectoralNames\_replaced.csv **Description:** This is a naming file to match the file name of the pectoral images to the species ##### Variables * Species: The genus_species of the fish after substitutions were made to match the phylogeny * SpeciesOriginal: The original genus_species before substituting species to match the phylogeny * ID: The name of the image file for the picture of the pectoral fin #### File: CaudalNames\_replaced.csv **Description:** This is a naming file to match the file name of the Caudal images to the species ##### Variables * Species: The genus_species of the fish after substitutions were made to match the phylogeny * SpeciesOriginal: The original genus_species before substituting species to match the phylogeny * ID: The name of the image file for the picture of the caudal fin #### File: AnalNames\_replaced.csv **Description:** This is a naming file to match the file name of the anal images to the species ##### Variables * Species: The genus_species of the fish after substitutions were made to match the phylogeny * SpeciesOriginal: The original genus_species before substituting species to match the phylogeny * ID: The name of the image file for the picture of the anal fin #### File: DorsalNames\_replaced.csv **Description:** This is a naming file to match the file name of the dorsal images to the species ##### Variables * Species: The genus_species of the fish after substitutions were made to match the phylogeny *  SpeciesOriginal: The original genus_species before substituting species to match the phylogeny * ID: The name of the image file for the picture of the Dorsal fin #### File: Sims\_2\_27.Rda **Description:** This R data file contains the output of the stochastic character mapping simulations on the phylogeny. Because each run of the simulations will produce slightly variable outputs, we include this file as the output we used for the publication.  #### File: anal\_shapes\_100.zip **Description:** This folder contains text files that describe the fixed and sliding semi-landmark locations for each anal fin. In the script provided these files are read into R using the the function 'readShapes' from the R package 'Stereomorph'.  #### File: pectoral\_shapes\_100.zip **Description:** This folder contains text files that describe the fixed and sliding semi-landmark locations for each pectoral fin. In the script provided these files are read into R using the the function 'readShapes' from the R package 'Stereomorph'.  #### File: caudal\_shapes\_100.zip **Description:** This folder contains text files that describe the fixed and sliding semi-landmark locations for each caudal fin. In the script provided these files are read into R using the the function 'readShapes' from the R package 'Stereomorph'.  #### File: dorsal\_shapes\_100.zip **Description:** This folder contains text files that describe the fixed and sliding semi-landmark locations for each dorsal fin. In the script provided these files are read into R using the the function 'readShapes' from the R package 'Stereomorph'.  #### File: ShapesPect\_100.Rda **Description:** This R data file is a product of applying the function 'readShapes' from the R package 'Stereomorph' to the text files contained in "Pectoral_shapes_100.zip". Loading this file avoids having to rerun readShapes every time the script is run.  #### File: ShapesDors\_100.Rda **Description:** This R data file is a product of applying the function 'readShapes' from the R package 'Stereomorph' to the text files contained in "Dorsal_shapes_100.zip". Loading this file avoids having to rerun readShapes every time the script is run.  #### File: ShapesCaud\_100.Rda **Description:** This R data file is a product of applying the function 'readShapes' from the R package 'Stereomorph' to the text files contained in "Caudal_shapes_100.zip". Loading this file avoids having to rerun readShapes every time the script is run.  #### File: ShapesAnal\_100.Rda **Description:** This R data file is a product of applying the function 'readShapes' from the R package 'Stereomorph' to the text files contained in "Anal_shapes_100.zip". Loading this file avoids having to rerun readShapes every time the script is run.  #### File: Hypervolume.zip **Description:** This zip folder contains the output of running the hypervolume simulation portion of the R script provided. As the simulations will produce slightly different results each time this folder is provided as a record of the results used and reported in the publication.  ## Code/software #### File: Satterfield\_etal\_2024\_evolution.R **Description:** This R script contains all analyses and figures for the manuscript "Weak integration allows novel fin shapes and spurs locomotor diversity in reef fishes." The code has been tested on a MacOS machine. The script is meant to be run line by line and is annotated to help the user follow along. **Packages:** This script requires the installation of the following R packages - phytools, geomorph, geiger, plyr, dplyr, ggplot2, ggrepel, memisc, hypervolume, foreach, parallel, doParallel, fishtree, and* stereomorph*. **Data:** The script will require you to have the following files downloaded - "pectoral_shapes_100.zip",  "caudal_shapes_100.zip", "dorsal_shapes_100.zip", "anal_shapes_100.zip", "PectoralNames_replaced.csv", "CaudalNames_replaced.csv", "DorsalNames_replaced.csv", "AnalNames_replaced.csv", "ReefFishCategoricals.csv", and "FinRates2.csv". All other data files provided in this repository can be generated by running the code and are provided as a record of the result of the run of the code we used in the associated manuscript.  **SetUp:** To run this script you will need to - 1. save the required files (mentioned in the data section above) into a folder. 2. unzip the 4 .zip files, these folders contain a text file for each sampled individual with the position of the landmarks and sliding semi-landmarks. 3. Open the "Satterfield_etal_2024_evolution.R" file in the R or R studio software. 4. set your working directory in R to the folder containing the downloaded data files.  5. you should now be able to run the script line by line.