Data for: Direct and indirect benefits of cooperation in collective defense against predation
Data files
Mar 12, 2026 version files 115.05 MB
-
FIS_all_maxindmis1.txt
806 B
-
FST_all_maxindmis1.txt
2.86 KB
-
get_cv_error.sh
613 B
-
HapDipKinship_allpop_maxindmis1_PUcorrected.txt
6.46 MB
-
HapDipKinship_KAA.R
2.23 KB
-
HapDipKinship_PIE.R
2.23 KB
-
HapDipKinship_PON.R
2.23 KB
-
HapDipKinship_PUU.R
2.23 KB
-
ind_with_missing_sex_info.txt
573 B
-
list_samples_position_on_plates_final_noumlaut_PUcorrected.txt
18.95 KB
-
list_samples_position_on_plates_final_noumlaut.txt
18.49 KB
-
list_sex_het_added.txt
16.17 KB
-
Nsertifer2021_filtered_RandSNP_maxindmis1.vcf
107.83 MB
-
README.md
34.74 KB
-
S1_predation_experiment.xlsx
23.61 KB
-
S10_depletions.xlsx
22.17 KB
-
S11_models_plots_code.R
108.39 KB
-
S12_README_assembly_kinship_maxindmis1
14.21 KB
-
S13_README_admixture_fst_fsi
1.09 KB
-
S14_relative_fitness_v.xlsx
15.29 KB
-
S2_group_defense.xlsx
22.67 KB
-
S3_individual_defense.xlsx
47.43 KB
-
S4_individual_defense_females.xlsx
37.84 KB
-
S5_individual_defense_males.xlsx
18.88 KB
-
S6_kinship.xlsx
313.11 KB
-
S7_cv_errors_summary_maxindmis1.csv
10.55 KB
-
S8_FIS_all_maxindmis1.txt
1.21 KB
-
S9_FST_maxindmis1.xlsx
15.77 KB
-
script_calculate_FIS_FST_maxindmis1.R
1.72 KB
-
script_generate_vcf_files_maxindmis1.sh
551 B
-
script_make-bed_maxindmis1.sh
477 B
-
script_merge_all_pop_HapDipKinship.sh
533 B
-
script_PUU_strings_to_be_replaced.sh
270 B
-
script_PUU_strings_to_be_replaced2.sh
315 B
-
script_randomly_chosen_females_maxindmis1_admixture.sh
553 B
-
script_randomly_chosen_females_maxindmis1.sh
1.34 KB
-
script_remove_RAD_maxindmis1.sh
157 B
Abstract
The evolution and maintenance of public goods cooperation, despite cheating, remains a key interest in social biology. Specifically, identifying how ecological factors determine the direct and indirect benefits that maintain cooperation has proven challenging, as these can vary significantly across species and environments. Here, we study this problem by using the social pine sawfly Neodiprion sertifer (Hymenoptera) as a model system. During their larval stage, N. sertifer live in groups and collectively secrete a defensive fluid against predators. This behavior comprises a public good as it is costly to exhibit and beneficial to others, and individuals vary in their contribution to group defense. We experimentally manipulated individual contributions to defense to assess how these influence individual survival. Our results indicate that defense has a group-level benefit as individuals were more likely to survive in cooperative groups that had a higher proportion of defending larvae. Moreover, being able to deploy defensive fluid confers direct survival benefits to individuals, regardless of group cooperativeness. Genetic and phenotypic analysis of natural populations further shows that kin selection promotes collective defense, as groups of larvae are often composed of full siblings. We also find that contribution to defense is female-biased and diminishes in male-biased and in larger groups, indicating that individuals adjust their contributions based on the social context. Overall, we find that cooperation in anti-predator defense provides both direct and indirect benefits and that individuals regulate their contributions mainly based on the social environment, resulting in variation within and among natural populations.
Description of the data and file structure
Groups can cooperate to achieve shared benefits, but cooperation faces an evolutionary problem because freeloaders can gain the same benefits while contributing less. Although theory suggests many ways cooperation can persist, empirical evidence from natural systems is limited. Studying pine sawfly larvae, which defend themselves collectively against predators, shows that cooperation improves survival for individuals and their relatives. However, larvae adjust their defensive effort depending on group composition, contributing less in larger or male-biased groups. This flexibility creates variation in cooperation while preventing freeloaders from dominating the population.
Data set: Predation experiment with ants
S1_predation_experiment.xlsx
| VARIABLE | DEFINITION |
|---|---|
| date | date of field experiment |
| groupID | ID of experimental group |
| indID | ID of the individual larva (randomly assigned as individual larvae can not be distinguished) |
| color | color of the subcutaneous markings |
| nestID | ID of the ant mound that was used for the field experiment |
| treatment_dep | control: larva retained its defense fluid; depleted: larva was depleted of its defense fluid |
| treatment_prop | 70: 30% of the larvae per group retained their defense fluid; 20: 80% of the larvae per group retained their defense fluid |
| survive_7 | 0: larva dead; 1: larvae alive (after approximately 7 hours) |
Data set: Defense behavior when an individual within the group is attacked (including social environmental factors)
S2_group_defense.xlsx
| VARIABLE | DEFINITION |
|---|---|
| groupID | ID of the group |
| popID | ID of the population from which the group originated |
| deffluid | number of individuals who deployed the defense fluid when an attack on the group was simulated |
| uposture | nThe umber of individuals who performed the U-posture when an attack on the group was simulated |
| groupsize | number of individuals per group at the time of the simulated attack |
| males | number of males (based on adults/cocoons) |
| females | number of females (based on adults/cocoons) |
| mf | number of females and males (based on adults/cocoons) |
| sexratio | adult/cocoon sex ratio |
| kinship_mean_ff | mean within-group kinship between females |
| kinship_mean_mm | mean within-group kinship between males |
| kinship_mean_fm | mean within-group kinship between females and males |
| sexratio_cent | centered sex ratio |
| groupsize_cent | centered group size |
| kinship_mean_ff_cent | centered within-group kinship between females |
| kinship_mean_mm_cent | centered within-group kinship between males |
| kinship_mean_fm_cent | centered within-group kinship between females and males |
| kinship_mean_F2G | mean female kinship to other group members |
| kinship_mean_M2G | mean male kinship to other group members |
| kinship_mean_ALL | mean kinship among all group members |
| kinship_mean_F2G_cent | centered mean female kinship to other group members |
| kinship_mean_M2G_cent | centered mean males kinship to other group members |
| kinship_mean_ALL_cent | centered mean kinship among all group members |
Data set: Defense behavior when an individual is directly attacked (including social environmental factors)
S3_individual_defense.xlsx
| VARIABLE | DEFINITION |
|---|---|
| id | ID of the larva within the group |
| groupID | ID of the group |
| popID | ID of the population from which the group originated |
| deffluid | 0: larva did not deploy the defense fluid 1: larva deployed the defense fluid when directly attacked |
| deffluid_volume_mm3 | Volume of deployed defense fluid in mm3 |
| length | length of the larva at the time of the simulated attack |
| sex_final | sex of the individual |
| males | number of males in the group from which the larva originated (based on adults/cocoons) |
| females | number of females in the group from which the larva originated (based on adults/cocoons) |
| mf | number of females and males in the group from which the larva originated (based on adults/cocoons) |
| sexratio | adult/cocoon sex ratio of the group from which the larva originated |
| kinship_mean_ff | mean within-group kinship between females of the group from which the larva originated |
| kinship_mean_fm | mean within-group kinship between males of the group from which the larva originated |
| kinship_mean_mm | mean within-group kinship between females and males of the group from which the larva originated |
| groupsize | number of larvae of the group from which the larva originated |
| sexratio_cent | centered sex ratio |
| groupsize_cent | centered group size |
| kinship_mean_ff_cent | centered within-group kinship between females |
| kinship_mean_fm_cent | centered within-group kinship between males |
| kinship_mean_mm_cent | centered within-group kinship between females and males |
| kinship_mean_F2G | mean female kinship to other group members |
| kinship_mean_M2G | mean male kinship to other group members |
| kinship_mean_ALL | mean kinship among all group members |
| kinship_mean_F2G_cent | centered mean female kinship to other group members |
| kinship_mean_M2G_cent | centered mean males kinship to other group members |
| kinship_mean_ALL_cent | centered mean kinship among all group members |
Data set: Defense behavior of females when directly attacked (including social environmental factors). The data is a subset of the "S3_individual_defense.xlsx" data, containing only females.
S4_individual_defense_females.xlsx
| VARIABLE | DEFINITION | |
|---|---|---|
| id | ID of the larva within the group | |
| groupID | ID of the group | |
| popID | ID of the population from which the group originated | |
| deffluid | 0: larva did not deploy the defense fluid 1: larva deployed the defense fluid when directly attacked | |
| deffluid_volume_mm3 | Volume | e of deployed defense fluid in mm3 |
| length | length of the larva at the time of the simulated attack | |
| sex_final | sex of the individual | |
| males | number of males in the group from which the larva originated (based on adults/cocoons) | |
| females | number of females in the group from which the larva originated (based on adults/cocoons) | |
| mf | number of females and males in the group from which the larva originated (based on adults/cocoons) | |
| sexratio | adult/cocoon sex ratio of the group from which the larva originated | |
| kinship_mean_ff | mean within-group kinship between females of the group from which the larva originated | |
| kinship_mean_fm | mean within-group kinship between males of the group from which the larva originated | |
| kinship_mean_mm | mean within-group kinship between females and males of the group from which the larva originated | |
| groupsize | number of larvae of the group from which the larva originated | |
| sexratio_cent | centered sex ratio | |
| groupsize_cent | centered group size | |
| kinship_mean_ff_cent | centered within-group kinship between females | |
| kinship_mean_fm_cent | centered within-group kinship between males | |
| kinship_mean_mm_cent | centered within-group kinship between females and males | |
| kinship_mean_F2G | mean female kinship to other group members | |
| kinship_mean_M2G | mean male kinship to other group members | |
| kinship_mean_ALL | mean kinship among all group members | |
| kinship_mean_F2G_cent | centered mean female kinship to other group members | |
| kinship_mean_M2G_cent | centered mean males kinship to other group members | |
| kinship_mean_ALL_cent | centered mean kinship among all group members |
Data set: Defense behavior of males when directly attacked (including social environmental factors). The data is a subset of the "S3_individual_defense.xlsx" data, containing only males.
S5_individual_defense_males.xlsx
| VARIABLE | DEFINITION | |
|---|---|---|
| id | ID of the larva within the group | |
| groupID | ID of the group | |
| popID | ID of the population from which the group originated | |
| deffluid | 0: larva did not deploy the defense fluid 1: larva deployed the defense fluid when directly attacked | |
| deffluid_volume_mm3 | Volume | e of deployed defense fluid in mm3 |
| length | length of the larva at the time of the simulated attack | |
| sex_final | sex of the individual | |
| males | number of males in the group from which the larva originated (based on adults/cocoons) | |
| females | number of females in the group from which the larva originated (based on adults/cocoons) | |
| mf | number of females and males in the group from which the larva originated (based on adults/cocoons) | |
| sexratio | adult/cocoon sex ratio of the group from which the larva originated | |
| kinship_mean_ff | mean within-group kinship between females of the group from which the larva originated | |
| kinship_mean_fm | mean within-group kinship between males of the group from which the larva originated | |
| kinship_mean_mm | mean within-group kinship between females and males of the group from which the larva originated | |
| groupsize | number of larvae of the group from which the larva originated | |
| sexratio_cent | centered sex ratio | |
| groupsize_cent | centered group size | |
| kinship_mean_ff_cent | centered within-group kinship between females | |
| kinship_mean_fm_cent | centered within-group kinship between males | |
| kinship_mean_mm_cent | centered within-group kinship between females and males | |
| kinship_mean_F2G | mean female kinship to other group members | |
| kinship_mean_M2G | mean male kinship to other group members | |
| kinship_mean_ALL | mean kinship among all group members | |
| kinship_mean_F2G_cent | centered mean female kinship to other group members | |
| kinship_mean_M2G_cent | centered mean males kinship to other group members | |
| kinship_mean_ALL_cent | centered mean kinship among all group members |
Data set: Pairwise kinship estimates
S6_kinship.xlsx
| VARIABLE | DEFINITION |
|---|---|
| INDV1 | individual ID |
| INDV2 | individual ID |
| kinshipKIMGENS | kinship estimate based on KIMGENS |
| famID1 | Family ID the individual INDV1 belongs to |
| famID2 | Family ID the individual INDV2 belongs to |
| sex1 | sex of the individual in INDV1 |
| sex2 | sex of the individual in INDV2 |
| pop1 | population the individual INDV1 belongs to |
| pop2 | population the individual INDV2 belongs to |
| sex_comb | combination of sex1 and sex2 |
Data set: One female per group from each population was randomly chosen. For each combination, K and CV error values were calculated
S7_cv_errors_summary_maxindmis1.csv
| VARIABLE | DEFINITION |
|---|---|
| sample | A combination of females (one female per group of each population) |
| k | k |
| cv_error | CV error |
Data set: One female per group from each population was randomly chosen. For each combination, FIS values were calculated
S8_FIS_all_maxindmis1.txt
| VARIABLE | DEFINITION |
|---|---|
| popID | population ID |
| fis | FIS value |
Data set: One female per group from each population was randomly chosen. For each combinatio,n the FST value was calculated
S9_FST_maxindmis1.xlsx
| VARIABLE | DEFINITION |
|---|---|
| popID | comparison between two populations |
| FST1 | 1st combination of randomly chosen females (one per group of each population) |
| FST2 | 2nd combination of randomly chosen females (one per group of each population) |
| FST3 | 3rd combination of randomly chosen females (one per group of each population) |
| FST4 | 4th combination of randomly chosen females (one per group of each population) |
| FST5 | 5th combination of randomly chosen females (one per group of each population) |
| FST6 | 6th combination of randomly chosen females (one per group of each population) |
| FST7 | 7th combination of randomly chosen females (one per group of each population) |
| FST8 | 8th combination of randomly chosen females (one per group of each population) |
| FST9 | 9th combination of randomly chosen females (one per group of each population) |
| FST10 | 10th combination of randomly chosen females (one per group of each population) |
| FST11 | 11th combination of randomly chosen females (one per group of each population) |
| FST12 | 12th combination of randomly chosen females (one per group of each population) |
| FST13 | 13th combination of randomly chosen females (one per group of each population) |
| FST14 | 14th combination of randomly chosen females (one per group of each population) |
| FST15 | 15th combination of randomly chosen females (one per group of each population) |
| FST16 | 16th combination of randomly chosen females (one per group of each population) |
| FST17 | 17th combination of randomly chosen females (one per group of each population) |
| FST18 | 18th combination of randomly chosen females (one per group of each population) |
| FST19 | 19th combination of randomly chosen females (one per group of each population) |
| FST20 | 20th combination of randomly chosen females (one per group of each population) |
| avThe g | average FST of all 20 combinations |
| popID1 | population ID |
| popID2 | population ID |
Data set: Effect of the depletion treatment on the probability of the larvae regurgitating the defensive fluid
S10_depletions.xlsx
Sheet 1: data
| VARIABLE | DEFINITION |
|---|---|
| famID | ID of the larval family |
| number1 | The number of individuals who were attacked for the first time |
| nondef1 | number of individuals within the family that did not regurgitate any defense fluid after being attacked for the first time |
| number2 | number of individuals within the family that were attacked for the second time |
| nondef2 | number of individuals within the family that did not regurgitate any defense fluid after being attacked for the second time |
| number3 | number of individuals within the family that were attacked for the third time |
| nondef3 | number of individuals within the family that did not regurgitate any defense fluid after being attacked for the third time |
| prop1 | proportion of individuals within the family that did not regurgitate any defense fluid after being attacked for the first time |
| prop2 | proportion of individuals within the family that did not regurgitate any defense fluid after being attacked for the second time |
| prop3 | proportion of individuals within the family that did not regurgitate any defense fluid after being attacked for the third time |
Sheet 2: for_plotting
| VARIABLE | DEFINITION |
|---|---|
| prop_nondef | proportion of individuals within the family that did not regurgitate any defense fluid after being attacked for the first, second, or third time |
| prop_def | proportion of individuals within the family that regurgitated any defense fluid after being attacked for the first, second, or third time |
| depletion | number of depletion treatments |
Code: The R script contains all models used in this study, including the code for the plots presented
S11_models_plots_code.R
Data sets and scripts for the kinship analysis
S12:
- S12_README_assembly_kinship_maxindmis1: Contains full explanations on how the analysis was done.
- HapDipKinship_KAA.R, HapDipKinship_PIE.R, HapDipKinship_PON.R, HapDipKinship_PUU.R: R code to estimate pairwise kinship values using KIMGENS.
- script_merge_all_pop_HapDipKinship.sh: Script to merge pairwise kinship estimates of the four populations.
- HapDipKinship_allpop_maxindmis1_PUcorrected.txt: Pairwise kinship values of all individuals.
- ind_with_missing_sex_info.txt: List of individuals that have no sex assigned (as DNA was extracted from larvae) and sex was later identified using heterozygosity.
- list_samples_position_on_plates_final_noumlaut.txt: Information about the position of each sample in the 96-well plate to identify which sample belongs to which individual.
- list_samples_position_on_plates_final_noumlaut_PUcorrected.txt: Information about the position of each sample in the 96-well plate to identify which sample belongs to which individual (with corrected inconsistencies in sample names).
- script_PUU_strings_to_be_replaced.sh: 1st script to correct inconsistencies in sample names.
- script_PUU_strings_to_be_replaced2.sh: 2nd script to correct inconsistencies in sample names.
- list_sex_het_added.txt: Information about the sex of each individual.
- Nsertifer2021_filtered_RandSNP_maxindmis1.vcf: Filtered VCF file (for filter steps see 1_README_assembly_kinship_maxindmis1).
Data sets and scripts for the population genetic analysis
S13:
- S13_README_admixture_fst_fsi: Contains full explanations on how the analysis was done.
- script_remove_RAD_maxindmis1.sh: Script to remove "RAD_" in all .bim files (ADMIXTURE only accepts integers in the chromosome (1st) column).
- script_randomly_chosen_females_maxindmis1_admixture.sh: Script to run ADMIXTURE analysis for each of the 20 combinations.
- script_randomly_chosen_females_maxindmis1.sh: Script to generate 20 combinations of randomly chosen females from each group.
- script_make-bed_maxindmis1.sh: Script to generate bed files for each of the 20 vcf files.
- script_generate_vcf_files_maxindmis1.sh: Script to generate vcf files for each of these 20 combinations.
- script_calculate_FIS_FST_maxindmis1.R: Script to calculate FIS and FST values.
- Nsertifer2021_filtered_RandSNP_maxindmis1.vcf: Filtered vcf file (for filter steps see 1_README_assembly_kinship_maxindmis1).
- get_cv_error.sh: Extract CV error values from LOG files.
- FST_all_maxindmis1.txt: FST values of all population comparisons and combinations of randomly chosen females (one per group of each population).
- FIS_all_maxindmis1.txt: FIS values of all populations and combinations of randomly chosen females (one per group of each population).
- S7_cv_errors_summary_maxindmis1.csv: CV error values for all combinations of randomly chosen females (one per group of each population).
Data set: Calculation of relative fitness
S14_relative_fitness_v.xlsx
| VARIABLE | DEFINITION |
|---|---|
| nestID | ID of nest where the larvae were exposed to ant predation |
| groupID | ID of the group the larvae belong to |
| alive_end | number of larvae at the start of the group in each group and treatment |
| alive_start_x1 | The number of larvae that were alive at the end of the experiment |
| non_dep_surv | number of larvae that were depleted of their defense fluid and alive at the end of the experiment |
| dep_surv | number of larvae that were not depleted of their defense fluid and alive at the end of the experiment |
| non_dep_killed | number of larvae that were depleted of their defense fluid and dead at the end of the experiment |
| dep_killed | number of larvae that were not depleted of their defense fluid and dead at the end of the experiment |
| x1 | proportion of cheats (i.e., depleted larvae) at the start of the experiment |
| x2 | proportion of cheats (i.e., depleted larvae) at the end of the experiment |
| 1-x1 | proportion of cooperators (i.e., non-depleted larvae) at the start of the experiment |
| 1-x2 | proportion of cooperators (i.e., non-depleted larvae) at the end of the experiment |
| v | relative fitness of depleted larvae |
| categories_by_v | groups divided into two classes based on the v-value: 1) groups where the depleted individuals have a higher or equal relative fitness (v >= 1) compared to non-depleted individuals, and 2) groups where depleted individuals have lower relative fitness compared to non-depleted ones (v < 1). |
