These scripts were generated for the study "The evolution of cheaper workers facilitated larger societies and accelerated diversification in ants", authored by Arthur Matte, Benoit Guénard, Fumika Azuma, Julian Katzke, Shubham Gautam, Francisco Hita Garcia, Thomas van de Kamp and Evan P. Economo

Contact: matte.arthur01[at]gmail.com

Main Scripts

cuticle_00_allometry.R:
Investigates the allometry between cuticle volume and body volume. Produces Fig. 2 and Fig. S1.

cuticle_00_benchmarking_auto_segmentation.R:
Benchmark our automated segmentation approach by comparing exctracted values from hand-made and automated segmentation. Produces Fig. S5.

cuticle_00_phylogenetic_signal.R:
Models the evolution of size-standardized cuticle investment. Produces Table S1.

cuticle_01_ancestral_state_reconstruction.R:
Reconstructs ancestral states for size-standardized cuticle investment in workers, queens and males. Produces Fig. 1 and Fig. S3.

cuticle_01_OU_shifts.R:
Search OU-shifht in the relationship between cuticle volume and body volume using a Bayesian reversible-jump MCMC approach. Produces Fig. S3.

cuticle_01_OU_shifts_sensititivity_analysis.R:
Same analysis as in cuticle_01_OU_shifts.R but using the phylogeny from Borowiec et al., 2025.

cuticle_02_PGLS_analysis.R:
Runs PGLS analysis to test for correlations between cuticle volume, body volume and various traits. Produces Table S2 and S3 and Fig. 2.

cuticle_02_PGLS_analysis_sensititivity_analysis.R:
Same analysis as in cuticle_02_PGLS_analysis.R but using the phylogeny from Borowiec et al., 2025.

cuticle_02_phylopath.R:
Performs multi-phylopath analysis across various models for size-standardized cuticle investment. Produces Fig. 3.

cuticle_02_phylopath_sensititivity_analysis.R:
Same analysis as in cuticle_02_phylopath.R but using the phylogeny from Borowiec et al., 2025.


cuticle_03_ES-sim_div_rates.R:
Analyse correlations between size-standardized cuticle investment, colony size and body volume with diversification rates. Produces Fig. 4, Fig. S4  and Table S4.

cuticle_script_for_plot_trait_correlation.R:
Generates Fig. 2 from the data obtained with cuticle_02_PGLS_analysis.R.




Resources

Several utility scripts used across the main analyses:

load_data.R:
Loads Dataset_S1_individual_measurements.xlsx dataset and prepare it for direct use.

multiphylopath_function.R:
Includes functions to run phylopath across multiple phylogenies and compile the results.

load_trees.R:
Loads trees from Economo et al. 2018 and adapts them to the current dataset.

load_trait_data.R:
Loads variable tested for correlations with cuticle investment (colony size, diet, ecological stratification, spin number, climatic data).

cuticle_00_personal_library.R:
Contains various functions used accross several main scripts.

exctract_climatic_data_from_GABI.R:
Combine climatic data and ant collection point coordinate (GABI database) to extract mean annual temperature and precipitation per species.
