DOI: 10.5061/dryad.qjq2bvqv2
title: Data and code from: Climate and parasite pressure jointly shape traits mediating the coevolution between an ant social parasite and its host

description: Host-parasite relationships are often shaped by coevolutionary arms races.
 While abiotic influences on these dynamics are well documented, a combined
 analysis of abiotic and biotic factors is essential for understanding
 coevolution, particularly under climate change. In this study, we analysed
 the interactions of the obligate social parasite Temnothorax americanus, a
 dulotic ant, and its primary host, the ant Temnothorax longispinosus,
 focusing on behavioural and cuticular hydrocarbon (CHCs) traits that
 govern parasite invasion and host defence. We studied the link between
 these traits and local climate as well as parasite prevalence. Our results
 revealed that behavioural interactions were more strongly associated with
 climate than parasite prevalence. Hosts from warmer, drier regions
 exhibited reduced aggression during parasite encounters, opting to pick up
 the brood and flee, while parasites from these regions exhibited greater
 aggression and activity. CHCs mediating enemy recognition in these ants
 were linked to local climate and parasite prevalence in both species. As
 all colonies were maintained under standardised conditions for a year, we
 attribute the observed phenotypic traits to evolutionary adaptation rather
 than phenotypic plasticity. Our findings suggest that both abiotic and
 biotic factors play critical roles in shaping co-evolving traits,
 sometimes leading to unexpected patterns that would potentially be
 overlooked when considering only a single factor. These insights provide a
 framework for understanding how climate influences coevolution of
 interacting species.
description: # Data and code from: Climate and parasite pressure jointly shape traits
 mediating the coevolution between an ant social parasite and its host
 Dataset DOI: [10.5061/dryad.qjq2bvqv2](10.5061/dryad.qjq2bvqv2) ##
 Description of the data and file structure **Data overview** This section
 contains information related to the datasets, scripts, and figures used to
 analyse and visualise the variation in the expression of host and parasite
 traits across space: 1. "behaviour" traits: We used behavioural
 assays to evaluate the behavioural response of *T. longispinosus*
 subcolonies to different intruders (i.e. *T. americanus* workers), and
 intruder themselves, across space.  Of the 450 videos, a representative
 subset of videos (N = 30; one video per treatment (n = 3) / per population
 (n = 10)) was selected and stored on Dryad to represent the behavioural
 assays, as the total video volume was very large (&lt;3 TB). Each video is
 named with the random number of the host colony, followed by an “_”, and
 then the number of the intruder’s source colony (e.g.,
 `7_219_noaudio.mp4`, where the host colony = 7 and the intruder colony =
 219). The data corresponding to these videos can be retrieved from the
 file `behaviour_data.csv` using the columns `ID_rand_subcol` (host colony)
 and `ID_col_intrud` (intruder colony) 2.  "CHCs" traits: We
 characterised the CHC profiles of these species to determine changes of
 composition within and between species across space. 3.
 "algorithm": stepwise reduction algorithm used to identify sets
 of CHCs related to host behavioural aggression from hosts towards
 conspecifics and social parasite. 4. "colony_structure": We
 tested how the structure of *T. longispinosus* and *T. americanus*
 colonies varied across space. **Description of the data and file
 structure** * `*_data.csv`: Datasets containing the information necessary
 to perform analyses and generate figures `*_analyses.Rmd`, `*_analyses.R`:
 Scripts used to run statistical models based on the datasets (R version
 4.2.3) `*_plots.R`: Scripts used to visualise figures (R version 4.2.3)
 **Example for behavioural traits** * **Dataset:** `behaviour_data.csv` *
 **Analyses script:** `behaviour_analyses.Rmd` * **Figure script:**
 `behaviour_plots.R` The file `predictors_data.csv` contains information
 about the collection sites (parasite prevalence, climate). It was used by
 the scripts analysing `colony_structure` and `CHCs` traits. It was not
 used for the behavioural analyses because `behaviour_data.csv` already
 included the relevant predictor columns. For the analyses script
 `algorithm_analyses.Rmd`, two datasets were required to calculate which
 CHCs are associated with host aggression: 1.
 `behaviour_algorithm_data.csv`, extracted from the script
 `behaviour_analyses.Rmd` (filtered from the original `behaviour_data.csv`
 dataset). 2. `CHC_data.csv`, also used for the CHCs analyses. ### Files
 and variables **File: behaviour_algorithm_data.csv**
 **Description:** Filtered dataset used for the stepwise reduction
 algorithm that identified sets of CHCs related to host behavioural
 aggression from hosts towards conspecifics and social parasite.
 **Variables** * ID_subcol_project: Colony ID from the subcolony used
 across different datasets. It contains all information of the colony in
 that form: X (species: SM for *T. americanus* or L for *T.
 longispinosus*)_XX (population origin)_X (colony number). -
 ID_intrud_project: Colony ID from the intruder used across different
 datasets. It contains all information of the colony in that form: X
 (species: SM or L) \_XX (population origin)_X (colony number). * week: The
 week in which the behavioural assay was recorded (either week 1,2 or 3). *
 type: Type of intruder placed in the arena. * prevalence: Parasite
 prevalence estimates based on the 10 collection sites. * population: Sites
 from which colonies were collected, in reference to the states in Northern
 America. - subcol_aggression_prop: Probability of a *T. longispinosus*
 worker to respond aggressively towards an intruder.   **File:
 colony_structure_data.csv** **Description:** Each row of the dataset
 represents the composition of a colony at the time of collection.
 **Variables** * population: Sites from which colonies were collected, in
 reference to the states in Northern America. * Colony_ID: Unique number
 given to a colony as identifier. * Slave_Maker: specifies whether a colony
 is dulotic based on the term “*T. americanus*”; an empty cell indicates a
 free-living colony. * Host1: If filled, contains the identity of the first
 host species in a nest. A colony is considered free-living if the column
 Slave_maker is empty, otherwise it refers to the identity of enslaved
 hosts. * Host2: If filled, contains the identity of the second host
 species in a nest. A colony is considered free-living if the column
 Slave_maker is empty, otherwise it refers to the identity of enslaved
 hosts. * SM_queen: gives the number of dulotic queens in the nest. *
 SM_worker: provides the number of dulotic workers in the nest. *
 Host1_queen: records the numbers of queens of the first host species. *
 Host1_worker: records the numbers of workers of the first host species. *
 Host2_queen: records the numbers of queens of the second host species. *
 Host2_worker: records the numbers of workers of the second host species.  
 **File: CHCs_data.csv** **Description:** Each row of the dataset
 represents one chemical profile (one worker for the parasite *T.
 americanus*, two pooled workers for the host *T. longispinosus*) from a
 colony replicate. **Variables** * ReplicateID: indicates the replicate
 number within each population for each species. * Filename: corresponds to
 the raw colony identifier based on the GC-MS data file of the processed
 sample. * ID_project: Unique colony identifier combining the species code
 (L for *T. longispinosus* and SM for *T. americanus*), the population
 origin, and the replicate number; this identifier is also consistently
 used in behavioural analyses. * Species: refers to the species identity,
 either *Temnothorax longispinosus* or *T. americanus*. * population:
 provides the geographic origin of the colony. * C29-en: Known CHC compound
 * 5-MeC27: Known CHC compound * 3-MeC27: Known CHC compound * 4-MeC28:
 Known CHC compound * 5-MeC29: Known CHC compound * 3-MeC29: Known CHC
 compound * 7-MeC31: Known CHC compound * 11,15; 13,17-DiMeC31, traces of
 5-MeC31: Known CHC compound * 3-MeC31: Known CHC compound * 5,x-DiMeC33:
 Known CHC compound * 11-;13-;15-MeC27 : Known CHC compound * 7-MeC27:
 Known CHC compound * 11,15-DiMeC27 (identification tentative): Known CHC
 compound * 12-;13-MeC28 : Known CHC compound * 3-MeC28: Known CHC compound
 * 11-;13-;15-MeC29 : Known CHC compound * 7-MeC29: Known CHC compound *
 11,15-;13,17-DiMeC29 : Known CHC compound * 5,x-DiMeC29: Known CHC
 compound * 3,7-DiMeC29, possibly other 3,x-DiMeC29: Known CHC compound *
 11-;12-;13-;14-MeC30 : Known CHC compound * 3-MeC30: Known CHC compound *
 x,y-DiMeC30: Known CHC compound * 9-;11-;13-;15-MeC31 : Known CHC compound
 * 7,11-DiMeC31: Known CHC compound * 11,15,19-TriMeC31: Known CHC compound
 * 7,15,21-TriMeC31: Known CHC compound * 3,11-DiMeC31, traces of other
 3,x-DiMeC31: Known CHC compound * 3,25-DiMeC31 (identification tentative):
 Known CHC compound * 3,x,y-TriMeC31 (identification tentative): Known CHC
 compound * 11-;13-;15-;17-MeC33 : Known CHC compound *
 13,17-;15,19-DiMeC33, possibly also 11,21-DiMeC33: Known CHC compound *
 3,9-;3,11-DiMeC33 : Known CHC compound * 11-;13-;15-MeC35 : Known CHC
 compound * 11,x-;13,x-;15,x-DiMeC35 : Known CHC compound *
 11,x-;13,x-;15,x-DiMeC37 : Known CHC compound * n-C25: Known CHC compound
 * n-C26: Known CHC compound * n-C27: Known CHC compound * n-C28: Known CHC
 compound * n-C29: Known CHC compound * n-C30: Known CHC compound * n-C31:
 Known CHC compound * unknown_RT19.90/RI27.81: Unknown CHC compound *
 unknown_RT20.34/RI28.09: Unknown CHC compound * unknown_RT20.74/RI28.33:
 Unknown CHC compound * unknown_RT20.88/RI28.41: Unknown CHC compound *
 unknown_RT21.02/RI28.50: Unknown CHC compound * unknown_RT23.98/RI30.38:
 Unknown CHC compound * unknown_RT24.50/RI30.71: Unknown CHC compound *
 unknown_RT25.66/RI31.48: Unknown CHC compound * unknown_RT26.38/RI31.97:
 Unknown CHC compound * unknown_RT26.56/RI32.09: Unknown CHC compound *
 unknown_RT26.98/RI32.37: Unknown CHC compound * unknown_RT27.14/RI32.47:
 Unknown CHC compound * unknown_RT27.28/RI32.56: Unknown CHC compound *
 unknown_RT27.34/RI32.60: Unknown CHC compound * unknown_RT27.84/RI32.93:
 Unknown CHC compound * unknown_RT28.44/RI33.35: Unknown CHC compound *
 unknown_RT29.16/RI33.85: Unknown CHC compound * unknown_RT29.48/RI34.08:
 Unknown CHC compound * unknown_RT29.70/RI34.25: Unknown CHC compound *
 unknown_RT29.78/RI34.31: Unknown CHC compound * unknown_RT29.88/RI34.38:
 Unknown CHC compound * unknown_RT30.06/RI34.52: Unknown CHC compound *
 unknown_RT30.36/RI34.74: Unknown CHC compound * unknown_RT30.50/RI34.85:
 Unknown CHC compound * unknown_RT30.66/RI34.97: Unknown CHC compound *
 unknown_RT31.22/RI35.38: Unknown CHC compound * unknown_RT31.58/RI35.63:
 Unknown CHC compound * unknown_RT31.74/RI35.75: Unknown CHC compound *
 unknown_RT31.88/RI35.85: Unknown CHC compound * unknown_RT32.08/RI36.00:
 Unknown CHC compound * unknown_RT32.16/RI36.05: Unknown CHC compound *
 unknown_RT32.30/RI36.15: Unknown CHC compound * unknown_RT32.48/RI36.29:
 Unknown CHC compound * unknown_RT32.78/RI36.50: Unknown CHC compound *
 unknown_RT33.06/RI36.71: Unknown CHC compound * unknown_RT33.34/RI36.91:
 Unknown CHC compound * unknown_RT33.70/RI37.18: Unknown CHC compound *
 unknown_RT33.80/RI37.28: Unknown CHC compound * unknown_RT34.34/RI37.69:
 Unknown CHC compound * unknown_RT34.68/RI37.96: Unknown CHC compound *
 IS_RT7.02: Internal Standard   **File: behaviour_data.csv**
 **Description:** Dataset used to test behavioural variation in subcolonies
 and intruders. Each row represents a behavioural assay. **Variables** *
 ID_col_subcol: Unique subcolony ID used during the collection for all
 colonies (parasite and host). * ID_rand_subcol: Subcolony random ID, from
 1 to 150. * ID_col_intrud: Unique intruder colony ID used during the
 collection for all colonies (Parasite and host). * ID_subcol_project:
 Colony ID from the subcolony used across different datasets. It contains
 all information of the colony in that form: X (species: SM or L)_XX
 (population origin)_X (colony number). * ID_intrud_project: Colony ID from
 the intruder used across different datasets. It contains all information
 of the colony in that form: X (species: SM or L) \_XX (population
 origin)_X (colony number). * week: The week in which the behavioural assay
 was recorded (either week 1,2 or 3). * type: Type of intruder placed in
 the arena. * prevalence: Parasite prevalence estimates based on the 10
 collection sites. * population: Sites from which colonies were collected,
 in reference to the states in Northern America. * PC1_climate: Values of
 the 1st PC axis from the population climate data spanning over temperature
 and precipitations. * day: The day the behavioural assays was recorded. *
 start_assay: The time of the day the behavioural assay record started. *
 n_queen_subcol: Number of queens in the arena at the beginning of the
 video (1 is expected, except for queenless colonies). * n_workers_subcol:
 Number of workers in the arena at the beginning of the video before
 introduction. * subcol_mandibles: Number of host workers that open their
 mandibles as a threat response around an introduced worker. *
 subcol_biting: Number of host workers that grab with their mandibles the
 libs of an introduced worker without dragging. * subcol_stinging: Number
 of host workers that bit and curve the thorax and stab with their stinger
 an introduced worker. * subcol_dragging: Number of hosts workers that grab
 the libs of an introduced worker and drag it in a direction. *
 subcol_carrying: Number of host workers that lift an introduced worker
 with their mandibles while moving around. * subcol_pinning: Number of host
 workers dragging in opposite directions the legs of an introduced worker.
 * subcol_antennation: Number of host workers that touch bodyparts of an
 introduced worker with their antenna. * subcol_grooming: Number of host
 workers that gently use their mouthparts on the introduced worker while
 touching it with the antenna. * subcol_trophallaxis: Number of host
 workers showing a mutual mouthpart contact with an introduced ant. *
 subcol_brood_carrying: Number of host workers that carry the brood with
 their mandibles. * intrud_mandibles: An introduced worker that opens its
 mandibles around another worker (threat behaviour) . * intrud_biting: An
 introduced worker that grabs with its mandibles the libs of another worker
 without dragging. * intrud_stinging: An introduced worker that bits and
 curves its thorax and stabs with its stinger another worker. *
 intrud_dragging: An introduced worker that grabs the libs of another
 worker and drags it in a direction. * intrud_carrying: An introduced
 worker that lifts another worker with its mandibles while moving around. *
 intrud_antennation: An introduced worker that touches bodyparts of another
 worker with its antenna. * intrud_grooming: An introduced worker that
 gently uses its mouthparts on another worker while touching it with its
 antenna. * intrud_trophallaxis: An introduced worker showing a mutual
 mouthpart contact with another ants. * intrud_immobile: An introduced
 worker that stands on its legs, inactive during an interaction with
 another worker. * intrud_curled: An introduced worker that adopts a pupae
 like posture, where the legs are back hidden close to the thorax and the
 antenna close to the head in an interaction with another worker. *
 corpse_begin: Number of dead workers found on the arena floor at the
 beginning of the video before the introduction of the worker. \** **
 **File: predictors_data.csv** **Description:** Each row of the dataset
 represents one site where colonies were collected. The column *population*
 indicates the geographic origin of the colonies. The variables *PC1* to
 *PC5* correspond to principal component values summarizing climatic
 conditions at each site. The column *prevalence* provides the parasite
 prevalence values associated with the respective population. **Variables**
 * population: Sites from which colonies were collected, in reference to
 the states in Northern America. * PC1: Principal Component 1 eigenvalues
 of climate CHELSA Bio-database. * PC2: Principal Component 2 eigenvalues
 of climate CHELSA Bio-database. * PC3: Principal Component 3 eigenvalues
 of climate CHELSA Bio-database. * PC4: Principal Component 4 eigenvalues
 of climate CHELSA Bio-database. * PC5: Principal Component 5 eigenvalues
 of climate CHELSA Bio-database. * prevalence: Parasite prevalence
 estimates based on the 10 collection sites.   **File:
 algorithm_analyses.R** **Description:** Script that calculates which CHCs
 are associated with host aggression based on 1)
 `behaviour_algorithm_data.csv`, extracted from the script `behaviour.Rmd`,
 and 2) `CHC_data.csv`, also used for the CHC analyses. **File:
 functions.R** **Description:** Script used in combination with
 `algorithm_analyses.R`, necessary to run the reductive algorithm. **File:
 behaviour_analyses.Rmd** **Description:** Script used to analyse
 `behaviour_data.csv`. From this script was extracted
 `behaviour_algorithm_data.csv` then used for the script
 `algorithm_analyses.R`. **File: CHCs_americanus_analyses.Rmd**
 **Description:** Script used to perform CHC analyses on the parasite
 *Temnothorax americanus* using the `CHC_data.csv` dataset. **File:
 CHCs_longispinosus_analyses.Rmd** **Description:** Script used to perform
 CHC analyses for the host species *Temnothorax longispinosus* using the
 `CHC_data.csv` dataset. **File: CHCs_bothspecies_analyses.Rmd**
 **Description:** Script used to perform comparative CHC analyses between
 the host and the parasite using the `CHC_data.csv` dataset. **File:
 colony_structure_analyses.Rmd** **Description:** Script used to perform
 colony structure analyses using the `colony_structure.csv` dataset.
 **File: behaviour_plots.R** **Description:** Script used to perform
 behavioural analyses using the `behaviour_data.csv` dataset. **File:
 CHCs_plots.R** **Description:** Script used to generate all plots from the
 analyses in `CHCs_longispinosus_analyses.Rmd`,
 `CHCs_americanus_analyses.Rmd`, and `CHCs_bothspecies_analyses.Rmd`.
 **File: colony_structure_plots.R** **Description:** Script used to
 generate all plots from the analyses in `colony_structure_analyses.Rmd`.
 **File: Wilcoxon_parasite_prevalence.R** **Description:** Script used to
 compare long-term prevalence data with the 2021 collection using a
 Wilcoxon signed-rank test for paired samples. **Files: Reference
 behavioural videos** * 10_877_noaudio.MP4 * 105_1977_noaudio.MP4 *
 115_1838_noaudio.MP4 * 124_1946_noaudio.MP4 * 129_1533_noaudio.MP4 *
 130_1563_noaudio.MP4 * 141_2183_noaudio.MP4 * 143_1924_noaudio.MP4 *
 149_438_noaudio_noaudio.MP4 * 150_1576_noaudio.MP4 * 24_835_noaudio.MP4 *
 25_389_noaudio.MP4 * 28_899_noaudio.MP4 * 30_1681_noaudio.MP4 *
 32_1346_noaudio.MP4 * 33_422_noaudio.MP4 * 37_2136_noaudio.MP4 *
 4_1178_noaudio.MP4 * 40_2115_noaudio.MP4 * 6_1833_noaudio.MP4 *
 61_1893_noaudio.MP4 * 64_73_noaudio.MP4 * 7_219_noaudio.MP4 *
 73_744_noaudio.MP4 * 75_576_noaudio.MP4 * 81_1805_noaudio.MP4 *
 83_1045_noaudio.MP4 * 9_1628_noaudio.MP4 * 91_1243_noaudio.MP4 *
 94_99_noaudio.MP4 ## Code/software **Models** We performed generalised
 linear mixed models (GLMMs) with the *glmmTMB* package in R v.4.2.3. We
 ensured the correct distribution of the models with the diagnostic tools
 provided by the DHARMa package.  In addition for the CHC analyses, we
 performed Permutational Multivariate Analyses of Variance (PERMANOVAs)
 using the adonis2 function from the *vegan* package to examine links
 between the composition of overall CHC profiles, *n*-alkanes, or
 recognition cues, and parasite prevalence or climate. **Packages used in
 analyses: "_analyses.Rmd" files** Behavioural analyses were
 conducted using *tidyverse* (data filtering and manipulation), *glmmTMB*
 (generalised linear mixed models with random effects), *DHARMa* (residual
 diagnostics), *buildmer* (stepwise model selection), *emmeans* (post hoc
 comparisons and joint tests), and *performance* (assessment of
 collinearity, singularity, and convergence). CHC analyses were conducted
 using *tidyverse* (data filtering and manipulation), *vegan* (multivariate
 analyses based on Bray–Curtis distances), *glmmTMB* (generalised linear
 mixed models with random effects), *performance* (model diagnostics),
 *DHARMa* (residual diagnostics), *ggeffects* (extraction of model
 estimates for plotting), *emmeans* (post hoc comparisons and joint tests),
 and *ggplot2* (visualisation). In addition, for the script
 `CHCs_bothspecies_analyses.Rmd`, *reshape2* was used to build the heatmap
 of chemical presence/absence between species. Colony structure analyses
 were conducted using *tidyverse* (data filtering and manipulation),
 *glmmTMB* (generalised linear mixed models with random effects),
 *performance* (model diagnostics), *DHARMa* (residual diagnostics),
 *emmeans* (post hoc comparisons and joint tests), *ggeffects* (extraction
 of model predictions for plotting), and *ggplot2* (visualisation). Figures
 were assembled with *gridExtra*. **Figure visualization:
 "_plots.R" files** For each `analyses.Rmd` script, there is a
 corresponding `_plots.R` script. To generate the figures, the analysis
 script must be run first, as the plotting scripts require the fitted
 models to be loaded. Figure visualisations were produced in R using
 *ggplot2* (plotting and custom themes), *ggeffects* (extraction of model
 predictions for plotting, used for behavioural and colony structure
 figures), and *gridExtra* (assembling multi-panel figures). For CHC
 figures (script: `CHCs_plots.R`), additional packages included *ggvenn*
 and *eulerr* (set-overlap diagrams) and *VennDiagram* (alternative Venn
 rendering).