DOI: 10.5061/dryad.dz08kps4s
title: Data from: Inheritance of material wealth in a natural population

description: Evolutionary adaptation occurs when individuals vary in access to
 fitness-relevant resources and these differences in “material wealth” are
 heritable. It is typically assumed that the inheritance of material wealth
 reflects heritable variation in the phenotypic abilities needed to acquire
 material wealth. We scrutinize this assumption by investigating additional
 mechanisms underlying the inheritance of material wealth in collared
 flycatchers. A genome-wide-association analysis reveals a high genomic
 heritability (h2=0.405+/-0.08) of access to caterpillar larvae, a
 fitness-relevant resource, in the birds’ breeding territories. However, we
 find little evidence for heritable variation in phenotypic abilities
 needed to acquire this material wealth. Instead, combined evidence from
 simulations, experimental, and long-term monitoring data indicate that
 inheritance of material wealth is largely explained by philopatry causing
 a within-population genetic structure across a heterogeneous landscape.
 Therefore, allelic variants associated with high material wealth may
 spread in the population without having causal connections to traits
 promoting local adaptation.
description: long term monitoring of a wild nestbox breeding population
description: # Data from: Inheritance of material wealth in a natural population Doi:
 to be updated upon acceptance. This is the data and code accompanying the
 publication of " Inheritance of material wealth in a natural
 population ", submitted for consideration at Ecology Letters. This
 record contains all datasets and code necessary to reproduce the analyses,
 which consists in natural records of phenotypic traits, access to
 resources (food) and dispersal behaviour, quantitative genetic (full
 pedigree) and genomic analyses (GWAS on 38705 SNPs) on wild collared
 flycatchers (Ficedula albicollis) in the long-term monitoring population
 of Öland, Sweden. Throughout the files, "NA" indicates "no
 data available" for that specific cell. ## Description of the data
 and file structure ### Analyses #### 1. Genome Wide Association Analysis
 (GWAS) of wealth among 800 collared flycatchers after filtering steps
 ##### 1.1. Scripts `wealth_GWAS.R` : main GWAS on material wealth in
 collared flycatchers, taking into account sex and year the individual was
 measured `getSEh2.R`: script used to extract heritability value
 `vlookup_R.R` ##### 1.2 Datasets: * `new_phenotype_Mar1.xls`: phenotypic
 information for 1996 individuals. Variables: ring (unique identifier),
 helper (ring number and year combined), sex_cha (sex as f= female and m=
 male), sex (sex as numeric, 1=female, 0 = male), year, NestID (unique
 identifier for each nest), area (3 letters abreviation for forest areas in
 the monitored population), box (nestbox number), Y_projection (GPS
 coordinate for latitude), laydate (day the first egg was laid, 1 = May
 1st) * `meanphenos_Mar2.txt`: data on wealth for measured individuals,
 variables: id (unique identifier), sex (sex as numeric, 1=female, 0 =
 male), habitat (relative measure of caterpillar abundance in a territory),
 dd (caterpillar biomass in a territory in dl/m3) * `CFgenotype.raw`:
 genotypic information (SNPs position and genotype across the genome) ####
 2. LASSO: Are the top SNPs (lowest p-values) from the GWAS analysis on
 material wealth correlated with: * forehead patch size * laying date #####
 2.1. Script wealth\_GWAS.R: needs to be ran after
 "wealth\_GWAS.R" to get the top 100 SNPs as output ##### 2.2
 Dataset * `flycatchers_adults_20022020.csv`: information on forehead patch
 size and laying date for individuals measured between 2002 and 2020.
 variables: breeding_id (unique identifier for each breeding pair), year ,
 ring_nb (unique identifier for each individual bird), patch_h (forehead
 patch height in mm), patch_b (forehead patch width in mm), laying_date
 (day the first egg was laid, 1 = May 1st), clutch_size (number of eggs in
 a clutch), chicks_hatched (number of chicks that successfully hatched),
 chicks_fledged (number of chicks that successfully fledged), wealth
 (relative measure of caterpillar abundance in a territory) *
 `yearmeans.csv`: mean laying date (LD) and standard deviation across years
 for the whole population, variables: year, meanLD (mean date where the
 first egg was laid averaged across the population), sdLD (standard
 deviation on meanLD) #### 3. Gene Set over-representation analysis: This
 analysis uses the 100 top SNPs from a GWAS on material wealth in collared
 flycatchers and compares the occurrence of specific gene functions among
 those genes to the functions of the whole genome, identifying gene sets
 over-represented in this subset. ##### 3.1. Scripts gene_functions.rmd
 ##### 3.2 Datasets ###### 3.2.1 `gwas_top100_genes.csv` Variables: SNP_id:
 name of the SNP, ensembl_gene_id: ensembl database unique gene identifier,
 external_gene_name: external gene name, start and end position in the
 collared flycatcher genome #### 4. Animal models * Animal model on
 material wealth to estimate heritability from the full pedigree * Animal
 models to determine genetic correlation between material wealth and *
 forehead patch size (dominance status in males) * laying date (when the
 first egg of the clutch was laid) * hatching success (number of eggs that
 hatched) * fledging success (number of nestlings that left the nest alive)
 ##### 4.1. Scripts: **####### !!! Note that these models are highly
 demanding in terms of computing power. They were ran on a cluster with
 200G memory per cpu !!! ###############** `wealth_animalmodel_20240702.R`:
 main animal model to calculate heritability of material wealth
 `wealth_animalmodel_patch_20240703.R`: genetic correlation between
 material wealth and forehead patch size
 `wealth_animalmodel_laydate_20240703.R`: genetic correlation between
 material wealth and laying date `wealth_animalmodel_hatch_20240703.R`:
 genetic correlation between material wealth and hatching success
 `wealth_animalmodel_fledge_20240703.R`: genetic correlation between
 material wealth and fledging success ##### 4.2 Datasets: *
 `pruned_pedigree_for_wealth_animalmodel.csv`: social pedigree of collared
 flycatchers on Öland. variables: id (unique individual identifier), sire
 (unique identifier of the social father of that individual), dam ((unique
 identifier of the mother of that individual)) *
 `collared_data_for_wealth_animalmodel.csv`: phenotypic information for
 animals in the pedigree. Variables: ring_nb (unique individual
 identifier), sex (female or male), species (CF = collared flycatcher), age
 (years), area (3 letters code for forest area in the monitored
 population), box_name (nestbox number), day_real_hatch (date where the
 eggs hatched, 1 = May 1st), year, nestbox (area and box_name combined),
 wealth (relative measure of caterpillar abundance), species2 (species, CF
 = collared flycatcher), animal (unique individual identifier), indatabase
 (check that the animal is in the pedigree) #### 5. Phenotypic correlations
 Models with phenotypes for recruiting individuals,born in our population
 and coming back to breed as adults Testing for phenotypic correlations
 between material wealth of the breeding territory and * forehead patch
 size (patcharea) * wing length * tarsus length * mass * age * laying date
 (relative to the peak of laying for each year, ld_centered) * mass as a
 nestling (12 days old, mass_d12.natal) * sex Random effects controlling
 for natal nest to take into account recruiting siblings, as well as year
 and person measuring the phenotypic traits All variables centered around
 the mean. ##### 5.1. Script `phenotypic_correlations.Rmd` ##### 5.2
 Dataset * `recruits_May2024.csv`: individuals born in our population that
 recruited as adults to breed. variables: nestbox.breed: unique identifier
 for the breeding nestbox year.breed: year the bird bred as an adult
 sex.breed: sex (male or female) measurer.breed: initials of the person
 measuring the bird tarsus.breed: adult tarsus length (mm) wing.breed:
 adult wing length (mm) mass.breed: adult mass (g) latitude.breed: latitude
 of the breeding nestbox longitude.breed: longitude of the breeding nestbox
 material_wealth.breed: relative caterpillar abundance on the breeding
 territory breeding_id.natal: unique identifier for the natal nest
 nestbox.natal: unique identifier for the natal nestbox year.natal: year
 the individual was born mass_d12.natal: mass (g) of the individual at 12
 days of age foster.natal: was the nestling cross-fostered (0 = no, 1 =
 yes) latitude.natal: latitude of the natal nest longitude.natal: longitude
 of the natal nest material_wealth.natal: relative caterpillar abundance of
 the natal territory material_wealth_biol.natal: relative caterpillar
 abundance of the biological parents' territory disp_dist: distance
 dispersed from natal to breeding nest (m) ld_centered: relative laying
 date (day the first egg was laid, 1 = May 1st) estimated_age: age in years
 patcharea: forehead patch size area (mm2) #### 6. Cross-fostering
 experiments This analysis compares the material wealth of recruiting adult
 individuals (breeding_wealth) that had been cross-fostered between several
 nests as nestlings to the material wealth of their biological parents
 (where they were born, bionest_wealth) and that of their foster parents
 (where they were raised, fosternest_wealth), controlling for both of these
 nest environments as random effects (foster_nestbox and bionest_nestbox).
 ##### 6.1. Scripts `foster_nestlings_material_wealth.rmd ` ##### 6.2
 Datasets * `foster_recruits_May2024.csv`: individuals born in our
 population and cross-fostered as eggs or chicks that recruited as adults
 to breed variables: bionest_nestbox (unique identifier for the nest of the
 biological parents), foster_nestbox (unique identifier for the nest were
 the chicks were raised), breeding_wealth (relative caterpillar abundance
 on the breeding territory), fosternest_wealth (relative caterpillar
 abundance on the territory where the individual was raised as a chick),
 bionest_wealth (relative caterpillar abundance on the territory of the
 biological parents) #### 7.natal dispersal Does dispersal distance
 influence the link between natal and breeding territory material wealth?
 Analysis and simulations of the correlation between material wealth of the
 natal territory (material_wealth.natal) and that of the first recorded
 breeding territory as an adult (material_wealth.breed) at different
 dispersal distances. Do individuals that disperse far away look for
 similar habitats to where they grew up? ##### 7.1 Scripts
 `natal_dispersal_and_simulations.r` ##### 7.2 Datasets *
 `recruits_May2024.csv`: see variable descriptions under 5.2 #### 8. Frass
 Caterpillar frass biomass (i.e. frass) collected for 11 tree species in
 2013 and 2014, sampled every fourth day. The data was used to produce
 supplementary figure S1 and Figure 2B, where 3 trees representing low,
 medium and high caterpillar productivity where chosen
 (...oak_birch_pine... dataset) ##### 8.1 script: no code was used, figures
 produced in excel ##### 8.2 Datasets *
 `Caterpilla_biomass_11_tree_species_2013_2014.xlsx`: caterpillar biomass
 produced by 11 tree species in 2013 and 2014 variables: year: year
 Maydate: sampling date, 1= 1st of May, frass sampled every 4th day
 alder_raw: caterpillar biomass estimated as amount of frass (mg), sampled
 every fourth day, for alder ash_raw: caterpillar biomass estimated as
 amount of frass (mg), sampled every fourth day, for ash birch_raw:
 caterpillar biomass estimated as amount of frass (mg), sampled every
 fourth day, for birch elm_raw: caterpillar biomass estimated as amount of
 frass (mg), sampled every fourth day, for elm hazel_raw: caterpillar
 biomass estimated as amount of frass (mg), sampled every fourth day, for
 hazel hornbeam_raw: caterpillar biomass estimated as amount of frass (mg),
 sampled every fourth day, for hornbeam lime_raw: caterpillar biomass
 estimated as amount of frass (mg), sampled every fourth day, for lime
 maple_raw: caterpillar biomass estimated as amount of frass (mg), sampled
 every fourth day, for maple oak_raw: caterpillar biomass estimated as
 amount of frass (mg), sampled every fourth day, for oak pine_raw:
 caterpillar biomass estimated as amount of frass (mg), sampled every
 fourth day, for pine spruce_raw: caterpillar biomass estimated as amount
 of frass (mg), sampled every fourth day, for spruce * `Caterpillar biomass
 oak_birch_pine_2013_2014.xlsx`: mean of caterpillar frass biomass
 (estimated as frass, mg/d/m3) of all sampled tree individuals during each
 sampling period (4 days) for oak, birch, and pine in May 2013 and 2014
 variables: mean_Maydate_2014: average sampling date in 2014, 1= 1st of
 May, mean of Maydate of the sampling period of 4 days Tree_species_2014:
 tree species mean_sp_period_2014: mean of caterpillar frass biomass
 (estimated as frass, mg/d/m3 ) of all sampled tree individuals during each
 sampling period (4 days) in 2014 mean_Maydate_2013:average sampling date
 in 2013, 1= 1st of May, mean of Maydate of the sampling period of 4 days
 Tree_species_2013: tree species mean_sp_period_2013: mean of caterpillar
 frass biomass (estimated as frass, mg/d/m3 ) of all sampled tree
 individuals during each sampling period (4 days) in 2013 #### 9. Material
 wealth variation Variograms comparing material wealth between territories
 at different scales across Öland, mirroring the scales found in Figure 2A:
 Horns Kungsgård and Halltorps Hage (two big forest patches on Öland),
 Northern and Southern Öland, as well as across all nestboxes on the
 island. ##### 9.1 script `variogram.r` ##### 9.2 Datasets *
 `nestboxes.csv`: location and material wealth data for all nestboxes on
 the island, grouped by forest patch (area) variables nestbox: unique
 identifier for the nestbox area: 3 letters abreviation for forest patch in
 the studied population box: name of the nestbox latitude: latitude
 longitude: longitude x_proj: coordinate representing latitude y_proj:
 coordinate representing longitude material_wealth: relative abundance of
 caterpillar on the territory #### 10. Distribution of material wealth
 Figure 2A: map of territories and estimation of material wealth ##### 10.1
 script `wealth_figure2a_map.Rmd` ##### 10.2 Dataset * `nestboxes.csv`: see
 variable descriptions under 9.2 \##Code/Software Code was produced using R
 (version 4.3.1 for most analyses, version 4.1.2 for the script
 "wealth_GWAS.R"), in R studio (version 2023.06.1) The following
 R packages were used: * AnnotationForge (v. 1.42.2) * AnnotationHub (v.
 3.8.0) * BiocManager (v. 1.30.22) * biomaRt (v.2.56.1 ), date accessed: 26
 June 2024 * clusterProfiler (v. 4.8.2) * cowplot (v.1.1.1) * dplyr (v.
 1.1.2) * geosphere (v. 1.5.18) * ggplot2 (v.3.4.4 ) * ggspatial (v.1.1.9)
 * glmnet (v.4.1.8 ) * lme4 (v.1.1.35.1 ) * lmerTest (v. 3.1.3) * MCMCglmm
 (v.2.35 ) * plyr (v.1.8.8 ) * RCurl (v.1.98.1.12 ) * RepeatABEL (v.1.1) *
 rnaturalearth (v.0.3.4) * rnaturalearthdata (v.0.1.0) * rnaturalearthhires
 (v.0.2.1) * sf (v.1.0.14 ) * sjPlot (v. 2.8.15) * Stringr (v.1.5.0 ) *
 tidyverse (v.2.0.0 )