Title: Trait-space disparity in fish communities spanning 380 million years from the Late Devonian to present
Authors: John Llewelyn, John A. Long, Richard Cloutier, Alice M. Clement, Giovanni Strona, Frédérik Saltré, Michael S. Y. Lee, Brian Choo, Kate Trinajstic, Olivia Vanhaesebroucke, Austin Fitzpatrick, Corey J. A. Bradshaw
In this study, we compare trait space of modern and Devonian fish communities to test whether species have dealt with their environment using similar strategies through time. Fish trait data was collected from databases, scientific literature, photographs, and expert opinion. Missing data was inferred using multiple imputation. The complete trait data set was then used to calculate Gower distances, quantifying differences between fish species in trait space. Principal coordinate analysis was applied to these Gower distances to ordinate species in lower dimensional space, and the species’ coordinates from the PCoA analysis were used to calculate functional diversity metrics, including: functional richness, functional nearest neighbour, functional specialisation, distance between community trait space centroids, and overlap between community trait spaces (Jaccard Index). The data and R code for replicating our analyses are provided in this repository. In the code, search for ‘filepath/’ to find lines where file paths need to be specified/updated. The code files are numbered in the order they should be run.
Repository Structure
Data Folder This folder contains five subfolders:
- taxonomy/
- Contains an Excel file (.xlsx) with taxonomic information for the Devonian fish species.
- Devonian_fish_traits/
- Contains an Excel file (.xlsx) of Devonian fish traits, excluding traits inferred through multiple imputation.
- modern_fish_traits_RDSs/
- Contains RDS files of species traits for each modern community.
- Devonian_fish_traits_RDS/
- Contains an RDS file with the Devonian species' traits, including imputed data.
- output/
- Contains RDS files produced by the code (below) and used to generate the study’s figures.
Code Folder This folder contains six subfolders, organized by the specific steps of the analysis:
- 1_multiple_imputation/
Contains one file:
- 1_missForest_taxonomyHiGitHub.R: Imputes missing trait data for Devonian fish.
- 2_3_tidy_data/
Contains two files:
- 2_combine_and_tidy_modern_RDS_files.R: Tidies the modern fish data.
- 3_Devonian_tidy.R: Tidies the Devonian fish data.
- 4_5_6_mFD/
Contains seven files:
- 4_gawdis_and_mFD.R: Calculates Gower distances, applies PCoA, and computes community functional diversity metrics (functional richness, nearest neighbour, specialization, evenness, divergence).
- 4b_gawdis_and_mFD_HighAccuracyTraitsOnly.R: Same as above but restricted to traits that were imputed with high accuracy.
- 4c_gawdis_and_mFD_MorphometricTraitsOnly.R: Same as above but restricted to morphometric traits.
- 5_gawdis_and_mFD_NullModel.R: Performs the same calculations as 4_gawdis_and_mFD_allSP.R, but build null models to calculate standardized effect sizes.
- 6_barchart_OnePanel_cross-hatched.R: Plots the functional diversity metrics calculated in 4_gawdis_and_mFD_allSP.R and 5_gawdis_and_mFD_NullModel.R.
- 6b_barchart_OnePanelHighAccuracyTraits.R: same as above but uses 4b_gawdis_and_mFD_HighAccuracyTraitsOnly.R.
- 6c_barchart_OnePanelMorphometrics.R: same as above but uses 4c_gawdis_and_mFD_MorphometricTraitsOnly.R.
- 7_8_hypervolume/
Contains four files:
- 7_Hypervolumes_fixedBandwidthsMean_JaccardSplit.R: Uses PCoA coordinates to fit hypervolumes describing each community’s trait space and calculates distances between trait space centroids and overlap (Jaccard Index).
- 7b_Hypervolumes_fixedBandwidths_dataForPlots_and plot versus global.R: Build hypervolumes and make plots of each community's trait space versus the global trait space.
- 8_combine_heatmaps_and_within_vs_between.R: Plots the hypervolume results as heatmaps and within versus between violin plot.
- 8b_combine_heatmaps_and_within_vs_between_TurnoverNestedness.R: decomposes differences in Jaccard index due to turnover versus nested, and builds heatmaps and violin plots for both.
- 9_traits_by_site/
Contains one file:
- 9_plot_traits_by_sites_violin_hatch.R: Plots the distribution of traits across the two Devonian and six modern communities.
- 10_species richness estimates/
Contains one file:
- Canowindra Chao1 estimate.R: Estimates species richness for Canowindra.