DOI: 10.5061/dryad.q83bk3jq7
title: Data from: Ecological specialisation of reef fishes peaks in global biodiversity hotspots

description: The role off ecological specialization in shaping evolutionary and
 biogeographic patterns remains unresolved. To date, few studies have
 quantitatively examined ecological specialization at a global scale,
 especially for reef fishes. Here, we describe global biogeographic and
 evolutionary patterns of reef fish specialization. We assemble the largest
 dataset on reef fish trophic interactions, including dietary information
 for 5,000 individuals across 387 reef fishes. We add reef fish geographic
 distributions, using their thermal niche as a proxy for thermal
 specialization. We reveal that species richness is positively associated
 with trophic specialization, while isolated reefs are dominated by trophic
 and thermal generalists. We also reveal a trade-off in specialization:
 while specialization may be favored in biodiversity hotspots, generalists
 have a higher colonization capacity and represent an advantageous strategy
 on isolated reefs. This work sheds new light on the origin and maintenance
 of fish communities in coral reefs.
description: # Data from: Ecological specialisation of reef fishes peaks in global
 biodiversity hotspots Dataset DOI:
 [10.5061/dryad.q83bk3jq7](10.5061/dryad.q83bk3jq7) ## Description of the
 data and file structure # Ecological specialisation scripts and datasets
 [https://doi.org/10.5061/dryad.q83bk3jq7](https://doi.org/10.5061/dryad.q83bk3jq7) This file contains 6 datasets required to reproduce the statistical analyses and 2 RMarkDown containing the Grid-level analyses and the Species-level analyses. The .rds files used for these analyses have been uploaded to Zenodo. The Grid_wgs84 folder contains shapefiles. ## Description of the data and file structure **Grid-level analyses** SPECIALIZATION_grid_analyses.Rmd: RMarkDown used to produce the Bivariate Map (fig. 1), the Structural Equation Model, the Linear Model and the Fourth Corner analysis (6 chuncks, 254 lines). Grid_wgs84 folder: geospatial files required to map the data. Assemblage_level_dataset.csv: Dataset used to produce the Bivariate Map (fig. 1), the Structural Equation Model, the Linear Model and the Fourth Corner analysis and plot (fig. 3). This dataset includes the mean trophic and thermal niche breadth, the past and present isolation, the past and present area and the present species richness for each grid cell (270 grid cells). Site_Speciesdataset.csv: Dataset used in the Fourth Corner analysis (fig. 3). Allows to retrieve occurring fish species within grid cells.  **Species-level analyses** SPECIALIZATION_species_analyses.Rmd: RMarkDown used to produce the Bayesian phylogenetic model at the species level with its result plot (fig. 4) (4 chunks, 86 lines). Species_level_dataset.csv: Dataset used to run the Bayesian phylogenetic model at the species level. This dataset includes the trophic niche breadth (i.e. taxonomic distinctness), the thermal niche breadth (i.e. the coefficient of variation of the met temperatures) and the net median diversification rate for each species (387 species). ### Files and variables #### File: Grid\_wgs84.zip #### File: Assemblage\_level\_dataset.csv ##### Variables * FISHNET_ID: identification number of the grid cell * mean_trophic: geometric mean of the assemblage trophic niche breadth in the grid cell * mean_thermal: mean of the assemblage thermal niche breadth in the grid cell * Past_Isolation: isolation value of the grid cell in the Quaternary, in km * Past_Reef: area of the reef surface of the grid cell in the Quaternary, in square km * Species_richness: count of consumer species of fish present in the grid cell * Isolation: isolation value of the grid cell, in km * Reef.area: area of the reef surface in the grid cell, in square km * Realm: ocean region the grid cell belongs to (Atlantic, Indo-Pacific or Tropical Eastern Pacific) Missing values are indicated as "NA". #### File: Species\_level\_dataset.csv ##### Variables * Genus_Species: scientific name (genus + species) of the consumer species * tip_diversification: diversification value for the consumer species, based on the output of the BAMM program * thermal: thermal niche breadth of the consumer species computed from the coefficient of variation between the lowest and highest temperature undergone by the consumer species * trophic: trophic niche breadth of the consumer species computed from the taxonomic diversity between all consumed resources by the consumer species Missing values are indicated as "NA". #### File: Site\_Species\_dataset.csv ##### Variables * FISHNET_ID: identification number of the grid cell * Genus_Species: scientific name (genus + species) of the consumer species Missing values are indicated as "NA". ## Code/software The software needed to open and run the provided RMarkdown files is R (version 4.4.3 or more recent). The Grid_wgs84.zip contains shapefiles. Shapefiles are a common format for vector-based geographic information system (GIS) data developed by the company esri. They can be opened and used in any GIS software (e.g. QGIS) and in R or Python. A shapefile consists of multiple file types beyond the .shp (specifically, .cpg, .dbf, .prj, .sbn, and .sbx). The user only interacts directly with the .shp file but the other files need to be in the same directory. In this case, shapefiles were open in R with the st_read function of the sf R package.  ## Access information Other publicly accessible locations of the data: * [https://zenodo.org/records/15295006](https://zenodo.org/records/15295006) Data was derived from the following sources: * [https://doi.org/10.1073/pnas.2100966118](https://doi.org/10.1073/pnas.2100966118) * [https://zenodo.org/records/15295006](https://zenodo.org/records/15295006)