Nutritional niches reveal mutualism resilience in urban fungus-farming ants
Data files
Nov 06, 2026 version files 3 MB
-
FNN_Data_raw.csv
72.36 KB
-
General_Functions_04-01-2024.R
10.60 KB
-
README.md
22.40 KB
-
RNN_Data_raw.csv
4.24 KB
-
Shik_Area_boot_RNN_data2_macro.csv
1.08 MB
-
Shik_Area_boot_RNN_data2.csv
1.37 MB
-
Shik_RNN_IT_boot_data2.csv
292.56 KB
-
Shiketal_2026_Code_GFN_Final_V2.R
66.50 KB
-
Shiketal_code.R
29.41 KB
-
Shiketal_data.xlsx
54.04 KB
Abstract
Maintaining optimized nutrient exchange between partnered species across changing environments presents a fundamental challenge for nutritional mutualisms. Yet quantitative approaches linking nutrient acquisition by one partner with the nutritional requirements of the other have been lacking. Here we extend the Nutritional Geometry Framework from organisms and colonies to interspecific mutualisms by linking realized nutritional niches (RNNs) with nutritional performance landscapes to quantify nutritional homeostasis between interacting species. Nutritional analyses of thousands of DNA-barcoded plant fragments collected by free-ranging Panamanian leafcutter ants revealed that RNNs for fungal cultivar provisioning diverged between degraded urban and intact rainforest habitats. Despite this, colonies converged on similar nutritional intake targets that were similarly positioned relative to regions of high fungal performance, while fungal nutritional yield remained stable across habitats. These findings demonstrate that correspondence between colony nutritional intake and fungal nutritional performance provides a quantitative means of assessing nutritional homeostasis across interacting species and establishes a foundation for comparative analyses of nutrient exchange across mutualisms experiencing environmental change.
Shik et al.
Authors and contact
Corresponding author: Prof. Jonathan Shik
Email: jonathan.shik@bio.ku.dk
Overview
This repository contains the data, derived bootstrap outputs, R scripts, and helper functions used for the analyses in Nutritional niches reveal mutualism resilience in urban fungus-farming ants.
Data files
FNN_Data_raw.csv— Fundamental Nutritional Niche (FNN) data describing fungal cultivar performance across diets varying in protein and carbohydrate. The response variables include final hyphal growth area (mm2) and staphyla density (number per mm2).RNN_Data_raw.csv— Realized Nutritional Niche (RNN) data describing the elemental and macronutrient composition of foraged plant fragments. These data are used to estimate RNN intake targets (RNN ITs) and convex-hull RNN areas.Shiketal_data.xlsx— Workbook containing five sheets:pie(data for pie charts),col_hab(foraging data summarized by colony and sampling interval),col_hab_model(foraging data in long format for fragment-type analyses, plus an ancillary wide-format summary block),nutrient_data(elemental and macronutrient composition of plant fragments), andglycogen(glycogen measurements from field-collected fungal cultivar).
Derived bootstrap files
Shik_Area_boot_RNN_data2.csv— Bootstrapped RNN convex-hull points and areas for the elemental plane.Shik_Area_boot_RNN_data2_macro.csv— Bootstrapped RNN convex-hull points and areas for the macronutrient plane.Shik_RNN_IT_boot_data2.csv— Bootstrapped RNN intake-target estimates.
R scripts and helper functions
Shiketal_2026_Code_GFN_Final_V2.R— Main analysis script for constructing FNN performance landscapes, bootstrapping RNN hulls and intake targets, quantifying overlap between habitats, and comparing realized nutrient intake with fungal performance landscapes.General_Functions_04-01-2024.R— Helper-function library used for nutritional geometry analyses. These functions are sourced by the main analysis script.Shiketal_code.R— Script for analyzingShiketal_data.xlsxand producing the figures and statistical analyses based on those data.
Repository structure
.
├── README_6Nov2026.md
├── FNN_Data_raw.csv
├── RNN_Data_raw.csv
├── Shiketal_data.xlsx
├── Shik_Area_boot_RNN_data2.csv
├── Shik_Area_boot_RNN_data2_macro.csv
├── Shik_RNN_IT_boot_data2.csv
├── Shiketal_2026_Code_GFN_Final_V2.R
├── Shiketal_code.R
└── General_Functions_04-01-2024.R
Software requirements
R version 4.2 or later is recommended.
Packages used by the main analysis script
dplyr, ggplot2, tidyr, pracma, Hmisc, alphahull, purrr, terra, agricolae, patchwork, lmerTest, stringr, viridis, MuMIn, and effsize.
Packages used by Shiketal_code.R
tidyverse (including ggplot2, dplyr, tidyr, readr, stringr, purrr, and scales), readxl, nlme, car, emmeans, ggh4x, colorspace, ggforce, performance, gridExtra, moments, and lmerTest.
Randomness and reproducibility
The main analysis script sets the random seed to 321321.
Bootstrap settings:
- RNN bootstrap: 1,000 repetitions.
- Additional bootstrap for confidence intervals of mismatch distances: 10,000 repetitions.
Script 1: FNN and RNN analyses
Input data: FNN_Data_raw.csv
Purpose. Raw data used to construct FNN performance landscapes across diets varying in protein and carbohydrate.
Read into R with:
fnndt <- read.csv("FNN_Data_raw.csv", header = TRUE)
Key variables:
colony_ID: colony or strain identifier, used to assign the duration of data collection.dataset: study label used to distinguish the Shik et al. dataset (Shik_NEE) from the other study dataset.pctprot: dietary protein (% by mass).pctcarb: dietary carbohydrate (% by mass).FinalArea: final hyphal growth area (mm2).staph_dens: staphyla density (number per mm2).prot: protein concentration (g/L), used for supplementary concentration-based figures.carb: carbohydrate concentration (g/L), used for supplementary concentration-based figures.
Derived variables.
The script creates days_col from colony_ID as follows: Ac_11 = 44 days, Ac_9 = 73 days, Ac_10 = 71 days, and all other colony IDs = 56 days. It then calculates growth rate as FinalArea / days_col.
Important subsets.
fnndt_biomass8: records wheredataset == "Shik_NEE".fnndt_others: records wheredataset != "Shik_NEE".fnndt_full: the full dataset.
Outputs from the FNN analysis.
The script generates predicted thin-plate spline surfaces (objects named FNN_land_*, typically containing PROT, CARB, and tps columns). PROT and CARB are the protein and carbohydrate coordinates of the prediction grid, and tps is the predicted response. Peak-performance regions are identified using predict_region_GF_lm() and converted to polygons using design_hull(). Peak-region centroids are calculated using calculate_centroid_boot().
Input data: RNN_Data_raw.csv
Purpose. Raw field data used to quantify realized nutritional niches across sites and plant species or tissue types, and to estimate intake targets using dry-mass weighting.
Read into R with:
rnndt <- read.csv(
"RNN_Data_raw.csv",
header = TRUE,
strip.white = TRUE,
na.strings = "n/a"
)
Pre-processing.
Tissue-type labels are converted to title case. The script also standardizes labels as follows: Leaf_petiole becomes Petiole, Leaf_stipule becomes Stipule, and Fruit_2 becomes Fruit.
Key variables:
Site: site identifier;GAM= Gamboa (urban) andPLR= Pipeline Road (rainforest).type: plant tissue type.sp: plant species code or name.Tot_fragment_no: total number of fragments recorded for the species.Sum_dry_weight..g.: total dry mass (g), as read by R after standardization of the source column name.pct_Nandpct_C: nitrogen and carbon content (% by mass).pct_protein: protein content (% by mass), estimated from nitrogen content.pct_TNC: total non-structural carbohydrate content (% by mass), calculated as the sum of starch and soluble sugar.
Derived quantities.
Nutrient values are multiplied by dry mass to obtain mass-weighted nutrient values. These are summed by site, tissue type, and species, then divided by the corresponding total dry mass to obtain mass-weighted nutrient composition for each site–tissue type–species combination. Site-level intake targets (IT_N, IT_C, IT_protein, and IT_TNC) are calculated as the means of these mass-weighted values across tissue-type–species combinations within each site.
Missing values in the RNN data
The pct_TNC column contains 30 blank cells among the 52 records in RNN_Data_raw.csv. These values indicate that a TNC value is unavailable for the corresponding plant-fragment record due to insufficient biomass for wet chemistry analyses (described in detail in the manuscript Methods); they do not represent zero or a value below detection. The same 30 records thus also have missing pct_TNC values in the nutrient_data sheet of Shiketal_data.xlsx. The elemental measurements (pct_N and pct_C) and protein estimates (pct_protein) are present for these records.
Analyses requiring TNC use only records with an available TNC value. In particular, the macronutrient convex-hull bootstrap excludes records with missing values. The missing TNC values are retained as missing in the deposited data rather than being replaced with zero or an estimated value.
Derived bootstrap output: Shik_Area_boot_RNN_data2.csv
Purpose. Bootstrapped convex-hull points and hull areas for each site in the elemental plane (%N versus %C).
Within each bootstrap replicate, records are sampled with replacement within site. Convex-hull points are identified from pct_N and pct_C, and hull area is calculated using terra::expanse() on the convex hull. The output includes site, hull-point coordinates, hull area (area_chull), and bootstrap replicate identifier (rep).
Derived bootstrap output: Shik_RNN_IT_boot_data2.csv
Purpose. Bootstrapped estimates of RNN intake targets for each site.
Within each bootstrap replicate, records are sampled with replacement within site and the intake-target calculation is repeated. The output includes Site, IT_N, IT_C, IT_protein, IT_TNC, their corresponding standard deviations where returned by the function, and the bootstrap replicate identifier (rep).
Derived bootstrap output: Shik_Area_boot_RNN_data2_macro.csv
Purpose. Bootstrapped convex-hull points and hull areas for each site in the macronutrient plane (%protein versus %TNC).
Before sampling, records with missing values are omitted. Convex-hull points are identified from pct_protein and pct_TNC, and hull area is calculated using terra::expanse() on the convex hull. The output includes Site, pct_protein, pct_TNC, area_chull, and rep.
Analysis workflow
A. FNN performance landscapes
The script estimates continuous performance landscapes across protein–carbohydrate space for staphyla density (staph_dens), final hyphal growth area (FinalArea), and growth rate (FinalArea / days_col). It loads the FNN data, derives collection duration and growth rate, and analyzes the Shik et al. dataset, the other study dataset, and the combined dataset. Thin-plate spline surfaces are fitted using predict_surface(). The high-performance region is identified using predict_region_GF_lm() with a 90 % region threshold, and the region is converted to a hull polygon using design_hull(). The surfaces and peak regions are plotted using ggplot2.
Mixed-effects models are also used to test how performance traits vary with diet, with study dataset and colony identity included as random effects.
B. Standardization of FNN traits
FNN response traits are standardized within each study to make performance values comparable across datasets. The standardize_shik() function creates standardized variables (std_staph_dens, std_FinalArea, and std_growth_rate). Thin-plate spline surfaces and peak regions are then calculated for the standardized traits.
C. RNN bootstrapping and overlap
The analysis quantifies realized nutritional niche breadth (convex-hull area) and intake targets for each site, with uncertainty estimated by bootstrap resampling. Elemental hulls are calculated in the %N–%C plane, and macronutrient hulls are calculated in the %protein–%TNC plane using records with available values for both variables.
The analysis calculates the intersection area between the GAM and PLR convex hulls for each bootstrap replicate and expresses overlap relative to each site's hull area. It also calculates the proportion of bootstrapped intake-target estimates that fall within the overlap region between the two sites and within the overlap between an RNN and an FNN high-performance region.
D. FNN–RNN comparison and correspondence distance
The analysis overlays RNN points, hulls, and intake-target estimates on standardized FNN performance landscapes. For each FNN high-performance hull, the script calculates its centroid. It then calculates Euclidean distances between the FNN centroid and bootstrapped RNN points and compares these distances between sites using Wilcoxon or Kruskal–Wallis tests and Cliff's delta effect sizes.
Helper functions
The main analysis script sources General_Functions_04-01-2024.R. The functions called directly include:
predict_surface()predict_region_GF_lm()design_hull()
Other helper functions in this library are also used by the analysis workflow. The main analysis script requires this helper-function file to run.
Running Script 1
Place the following files in the same working directory:
FNN_Data_raw.csvRNN_Data_raw.csvShik_Area_boot_RNN_data2.csv(optional if it is to be regenerated)Shik_RNN_IT_boot_data2.csv(optional if it is to be regenerated)Shik_Area_boot_RNN_data2_macro.csv(optional if it is to be regenerated)Shiketal_2026_Code_GFN_Final_V2.RGeneral_Functions_04-01-2024.R
Set the R working directory to this folder and run:
source("Shiketal_2026_Code_GFN_Final_V2.R")
The script creates ggplot objects in the R session, including FNN landscape panels for the individual and combined datasets, standardized FNN landscapes, RNN scatterplots and hulls in elemental and macronutrient planes, and combined FNN–RNN overlay and mismatch plots. The script does not automatically save figures to disk; use ggsave() with explicit filenames and dimensions if exported figure files are needed.
Script 2: Analyses of foraging and fungal glycogen data
Workbook: Shiketal_data.xlsx
The workbook contains five sheets.
pie sheet
Purpose. Data used to construct the pie charts (Fig. 2A), showing the relative biomass of foraged plant species within each habitat.
Read into R with:
pie <- readxl::read_excel("Shiketal_data.xlsx", sheet = "pie")
Key variables:
site: habitat (GAM= Gamboa, urban;PLR= Pipeline Road, rainforest).type: plant-fragment category (leaf, flower, or fruit); Ficus sp. also includes petiole and stipule tissues.sp: plant species identification, determined by DNA barcoding.sp_type: concatenation of thetypeandspvariables.tot_fragment_no: total number of fragments for each species.mass_g: total fragment mass (g) for each species.percent_mass: relative mass of each species as a proportion of the total foraged mass in that habitat.pct_mass_tot:percent_massmultiplied by 100.
The script summarizes species by site and produces one pie chart per site. Wedges are ordered by relative abundance and use habitat-specific color gradients (orange for rainforest and purple for urban). Number labels restart for each site and correspond to Table 1.
col_hab_model sheet
Purpose. Long-format foraging data used to construct the stacked bar chart of plant-fragment type relative abundance (Fig. 2B).
Read into R with:
m <- readxl::read_excel("Shiketal_data.xlsx", sheet = "col_hab_model") |>
dplyr::select(dplyr::where(~ !all(is.na(.))))
Key variables:
site: habitat (GAM= Gamboa, urban;PLR= Pipeline Road, rainforest).col_id: abbreviated colony identifier.day: sampling day; each colony was sampled on two non-consecutive days.sampling_period: sampling interval within a day; each colony was sampled during two 30-minute periods separated by a break.Type: fragment category (leaf, flower, fruit, or other).worker_no: number of workers observed during a 10-minute observation period on the foraging trail before fragment collection.frag_no: number of fragments collected during the 30-minute sampling interval.frag_mass: total dry mass (g) of fragments collected during the 30-minute sampling interval.
Additional columns and blank cells. This worksheet also contains an ancillary wide-format summary block in columns to the right of the long-format data. The block has eight variable rows (id) and separate columns for individual colonies (gam_* and plr_*). Blank cells outside this eight-row block are structural: those rows do not correspond to entries in the ancillary summary block. The fully empty spacer columns between the long-format data and this block are also blank by design. These cells are not missing observations in the long-format variables used for the analyses.
The script uses the long-format data to produce stacked bar charts comparing the relative biomass of leaf, flower, fruit, and other fragments among colonies (Fig. 2B), and to perform mixed-effects analyses of fragment number and mass by fragment type and habitat.
col_hab sheet
Purpose. Foraging data summarized by colony and sampling interval, used for figures showing fragment number and mass (Fig. S1A–B) and for mixed-effects analyses.
Read into R with:
m <- readxl::read_excel("Shiketal_data.xlsx", sheet = "col_hab")
Key variables:
site: habitat (GAM= Gamboa, urban;PLR= Pipeline Road, rainforest).col_id: abbreviated colony identifier.day: sampling day; each colony was sampled on two non-consecutive days.sampling_period: sampling interval within a day; each colony was sampled during two 30-minute periods separated by a break.date: sampling date (day.month.year).field_col_id: detailed field colony identifier (collector initials, date, and number).worker_no: number of workers observed during a 10-minute observation period before fragment collection.leaf_frag_no,fruit_frag_no,flower_frag_no, andother_frag_no: numbers of leaf, fruit, flower, and non-plant fragments collected during the 30-minute interval.tot_frag_no: total number of plant fragments collected during the 30-minute interval.flower_mass_g,fruit_mass_g,leaf_mass_g, andother_mass_g: dry mass (g) of the corresponding fragment categories collected during the 30-minute interval.tot_mass_g: total dry mass (g) of plant fragments collected during the 30-minute interval.
The other category is excluded from the mixed-effects analyses of plant-fragment number and mass.
nutrient_data sheet
Purpose. Plant-fragment elemental data used for figures showing %C and %N (Fig. S2A–B) and analyses of elemental composition.
Read into R with:
nutrient_data <- readxl::read_excel("Shiketal_data.xlsx", sheet = "nutrient_data")
Key variables:
site: habitat (GAM= Gamboa, urban;PLR= Pipeline Road, rainforest).type: plant-fragment category.sp: plant species.Tot_fragment_no: total number of fragments collected for each species across sampling intervals.mass_g: total dry mass (g) of fragments collected for each species across sampling intervals.pct_N: nitrogen content (% by mass).pct_C: carbon content (% by mass).pct_protein: protein content (% by mass), estimated from nitrogen content.pct_TNC: total non-structural carbohydrate content (% by mass), calculated as the sum of starch and soluble sugar.NandC: nitrogen and carbon mass values used in the analyses.
The pct_TNC column has 30 blank cells among the 52 records. These indicate that a TNC value is unavailable for the corresponding plant-fragment record due to insufficient biomass for wet chemistry analyses; they are not zero values. The records retain their measured elemental and protein values. Analyses of TNC use only records with available TNC measurements.
glycogen sheet
Purpose. Data used to test for differences in glycogen content of field-collected fungal cultivar between habitats and fungal tissue types (Fig. S3).
Read into R with:
dfr <- readxl::read_excel("Shiketal_data.xlsx", sheet = "glycogen")
Key variables:
Sample_ID: parent colony and technical-replicate identifier.Colony_ab: abbreviated colony identifier, used to determine habitat (Gamboa or Pipeline Road).chamber: excavated chamber within the colony from which the fungal sample originated.TechRep: technical replicate; each fungal sample was analyzed twice.Tissue: fungal tissue type (mycelium or staphyla).Person: researcher who generated the data point.Tissue_mass: dry mass of the analyzed sample (mg).Run: 96-well plate on which the extracted sample was analyzed.Gly_per_Tissue: glycogen concentration (µg/mL) normalized by mg dry tissue mass.
Derived variables and processing.
Habitat identity (Gamboa or Pipeline Road) is derived from Colony_ab. A small number of marginally negative glycogen values were set to zero; these occurred when glycogen or sample mass values were low relative to the calibration curves. Gly_per_Tissue was then log10(x + 1) transformed for analysis.
The script fits a mixed-effects model testing for differences in transformed glycogen concentration between habitats and tissue types, with technical replicate nested within chamber and chamber nested within colony as random effects. The results are presented in Fig. S3.
Running Script 2
Place Shiketal_code.R and Shiketal_data.xlsx in the same working directory. Set the R working directory to this folder and run:
source("Shiketal_code.R")
The script creates pie charts (Fig. 2A), stacked bar charts (Fig. 2B), boxplots of fragment number and mass (Fig. S1A–B), boxplots of fragment %C and %N (Fig. S2A–B), and a boxplot of fungal glycogen content (Fig. S3). It also performs the corresponding mixed-effects model and ANOVA analyses.
References
Source studies
Crumière, A. J. J., et al. (2021). The multidimensional nutritional niche of fungus-cultivar provisioning in free-ranging colonies of a neotropical leafcutter ant. Ecology Letters, 24, 2439–2451.
Shik, J. Z., et al. (2021). Nutritional niches reveal fundamental domestication trade-offs in fungus-farming ants. Nature Ecology & Evolution, 5, 122–134.
Software
R Core Team (2023). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria.
Pinheiro, J., et al. (2024). nlme: Linear and nonlinear mixed effects models. R package version 3.1-164.
Lenth, R. V. (2021). emmeans: Estimated marginal means. R package version 1.10.7.
Nychka, D., et al. (2017). fields: Tools for spatial data. R package version 16.3.1.
Kuznetsova, A., Brockhoff, P. B., and Christensen, R. H. B. (2017). lmerTest package: Tests in linear mixed effects models. Journal of Statistical Software, 82, 1–26.
Hijmans, R. J., et al. (2025). terra: Spatial data analysis. R package version 1.8-54.
Borchers, H. W. (2025). pracma: Practical numerical math functions. R package version 2.4.6.
Torchiano, M. (2020). effsize: Efficient effect size computation. R package version 0.8.1.
Methods
Sampling plant fragments foraged by free-ranging leafcutter ants
From 4 May to 27 May 2024, we performed 47 plant-fragment collections on the most active trails of 12 mature Atta colombica colonies in Soberanía Park, Panama. Six colonies were in the urban town of Gamboa (24 collection events), and six were in nearby rainforest at Pipeline Road (23 collection events).
We performed four 30-min collection events per colony (two per day over two nonconsecutive days). During each event, we gently removed plant fragments from the mandibles of laden returning foragers. In the laboratory, fragments were counted and sorted under a dissecting microscope by tissue type (leaf, flower, or fruit) and morphospecies. This sorting yielded 485 samples, which were freeze-dried for 24 h, weighed to the nearest 0.1 mg (dry mass), and stored at −20 °C. A small fraction of the collected material (approximately 2.5%) was not plant material (e.g., soil fragments) and was excluded from downstream analyses.
We used mixed-effects models with the nlme R package to test for differences in log(x + 1)-transformed total fragment number and total fragment biomass between sites (Pipeline Road and Gamboa), fragment types (fruit, flower, and leaf), and their interaction. Sampling period nested within sampling day, nested within colony ID, was included as a random effect (model structure: ~ habitat + type + habitat:type, with random structure ~1 | colony/day/period). A binomial distribution was used to account for overdispersion in the fragment-number response variable. Significant main effects were explored using pairwise Tukey post hoc tests based on estimated marginal means, calculated with the emmeans R package (version 1.6.3). Statistical analyses were performed in R.
Identifying plant fragments using DNA barcoding
At the University of Copenhagen, samples were consolidated within colony and sampling day into 119 morphotypes (51 from Gamboa and 68 from Pipeline Road). Representative subsamples of 3–15 mg of each morphotype from each colony were selected for DNA extraction and barcode identification.
We used the Trac01 primer set to amplify the ITS1 region of nuclear ribosomal DNA in vascular plants (forward primer Trac01F: 5′-GATATCCRTTGCCGAGAGTC-3′; reverse primer Trac01R: 5′-GAAGGAGAAGTCGTAACAAGG-3′). DNA was sequenced by Eurofins Genomics. Sequences were aligned using Geneious Prime (version 2019.1.1). Sequences of at least 160 bp were compared with known samples using BLASTn against the NCBI BLAST sequence database. When multiple species-level matches had similar E-values and percentage identity, the identification was restricted to genus. Sequences without a clear match were extracted and sequenced again.
Biochemical analyses of foraged plant fragments
We pooled samples by species and tissue type, submerged them in liquid nitrogen, and homogenized them using a Qiagen TissueLyser. Sufficient biomass was available for carbon (%C) and nitrogen (%N) analyses of 53 distinct species–tissue samples, representing 95% of total foraged biomass. We estimated crude protein content (hereafter %protein) by multiplying the total nitrogen mass of each analyzed sample by 6.25.
After carbon and nitrogen analyses, 22 species–tissue samples, representing 91.3% of total foraged plant biomass, had sufficient biomass remaining for analyses of total nonstructural carbohydrates (starch plus extractable sugars; hereafter %TNC). Starch was measured using a Total Starch Assay Kit (Megazyme), and extractable sugars were measured using a Total Carbohydrate Assay Kit (Sigma-Aldrich).
We used univariate ANOVA to test for differences in plant-fragment elemental composition (%C and %N) and macronutrient composition (%TNC and %protein) between habitats (rainforest and urban), fragment types (flower, fruit, and leaf), and the habitat-by-type interactions. Significant main effects were followed by pairwise Tukey post hoc tests.
Quantifying realized nutritional niche (RNN) dimensions
We quantified realized nutritional niches (RNNs) using the elemental currencies %C and %N and the macronutrient currencies %protein and %TNC. Elemental RNNs describe the elemental composition of foraged plant fragments, including carbon in both nonstructural carbohydrates (e.g., starch and sugars) and structural carbohydrates (e.g., cellulose, lignin, and hemicellulose). Macronutrient RNNs facilitate comparison with fungal-cultivar nutritional performance landscapes (NPLs), which were measured on growth media containing defined amounts of nonstructural carbohydrates and no structural carbohydrates.
For each habitat, we represented the RNN by plotting diet items in a bivariate nutritional space, using %N or %protein on one axis and %C or %TNC on the other. We used the geom_polygon function in ggplot2 to draw convex hulls enclosing the observed nutritional values.
We calculated the RNN intake target (IT) for each habitat as the biomass-weighted mean elemental or macronutrient content across plant species and tissue types. Each species–tissue item was weighted by its contribution to total foraged biomass. We estimated variation around each habitat's RNN intake target using more than 1,000 bootstrap replicates. For each replicate, forage items were resampled, with each forage-item type represented at least once, to generate a distribution of elemental and macronutrient values. Standard deviations were calculated from these bootstrap distributions.
Quantifying nutritional performance landscapes (NPLs) of the fungal cultivar
We generated consensus NPLs for Leucoagaricus gongylophorus fungal hyphal growth (mm²) and staphyla density (number per mm²), based on two published in vitro experiments using fungi isolated from A. colombica colonies in the same study populations. Both experiments used the same diet ingredients and recipe framework to cover comparable ranges of protein-to-carbohydrate (P:C) ratios, while also including different total protein-plus-carbohydrate (P+C) concentrations.
The experiment reported by Shik et al. used 36 diet treatments: nine P:C ratios (1:9, 1:6, 1:3, 1:2, 1:1, 2:1, 3:1, 6:1, and 9:1) and four P+C concentrations (8, 20, 40, and 60 g/L), with eight replicates per treatment (864 Petri dishes in total). The experiment reported by Crumière et al. used 21 diet treatments: seven P:C ratios (9:1, 6:1, 3:1, 1:1, 1:3, 1:6, and 1:9) and three P+C concentrations (4, 8, and 25 g/L).
We replotted the resulting consensus NPL heatmaps in terms of %protein and %TNC to enable comparisons of nutritional intake–performance distances. Response variables were standardized using Z-scores. Individual and consensus NPLs based on raw response-variable values did not differ meaningfully.
We used the fields R package to visualize consensus NPLs for fungal growth area (mm²) and staphyla density (number per mm²), fitting nonparametric thin-plate splines with the Tps function and smoothing parameter λ = 0.05. Mixed-effects least-squares regressions, fitted using the lmerTest R package, were used to assess the significance of linear and quadratic terms and their linear interaction for protein and carbohydrate diet treatments. Dataset source (study) and ant colony ID were included as random effects.
We then used a nutrigonometric modelling approach to estimate the high-performance region of each NPL, defined as the region containing the upper 90% of response values. The approach triangulates performance landscapes to estimate a threshold-defined level set, represented here by a convex hull enclosing the upper 90% peak-performance region. We used the centroids function in the terra R package to calculate the centroid of this convex hull. We refer to the convex hull enclosing this region as the high-performance region and to its centroid as the high-performance centroid (HPC).
Quantifying nutritional correspondence between partners
Using both elemental and macronutrient currencies, we calculated the percentage of area overlap between RNNs from the two habitats using the polyarea function in the pracma R package. We then tested whether colonies from rainforest and urban habitats selected similar nutritional blends by determining whether each habitat's RNN intake target fell within the area of overlap between the two habitat RNN polygons.
We assessed spatial containment using the relate function in the terra R package. Specifically, we calculated the frequency with which bootstrapped RNN intake-target estimates (1,000 per bootstrap replicate, as implemented in the analysis) fell within the boundaries of the overlapping RNN polygon. A frequency of 100% indicates that all bootstrapped intake-target estimates fall within the overlapping RNN area.
We also quantified the area of overlap between the plant-fragment RNN for each habitat and the fungal-cultivar high-performance regions for hyphal growth area and staphyla density. Nutritional intake–performance distance was calculated as the Euclidean distance between the RNN intake target and the HPC. For the two-dimensional macronutrient space, this is the square root of the sum of the squared difference in protein between the HPC and RNN intake target and the squared difference in TNC between the HPC and RNN intake target:
Intake–performance distance = √[(HPCprotein − RNN ITprotein)² + (HPC_TNC − RNN IT_TNC)²].
We visualized these distances by overlaying intake–performance distance values on fungal-cultivar NPL heatmaps. We assessed differences in intake–performance distances between habitats by comparing bootstrap estimates and interpreting effect sizes using Cliff's delta, calculated with the effsize R package.
Field-measured glycogen produced by the fungal cultivar
We collected >50 ml samples of fungal cultivar from the centers of three chambers in each of 20 colonies (10 per habitat), including 11 of the 12 colonies used in the plant-fragment foraging study. These chambers were selected because gongylidium density is highest in their centers. In the laboratory, acupuncture needles were used to collect two technical replicates of each of two tissue types: hyphae (0.2 mg) and staphylae (25 staphylae). Samples were weighed to the nearest 10 -5 g (wet mass). Wet-mass-to-dry-mass conversions were generated separately using fungus from each chamber to standardize final glycogen values.
At the University of Copenhagen, glycogen concentrations were measured using a glycogen assay kit (Sigma-Aldrich MAK465), following the manufacturer's instructions. Glycogen concentration was expressed as µg/mL per mg of dry tissue mass.
Before analysis, slightly negative glycogen values (23 of 252 measurements) were converted to zero, and all data were log10(x + 1) transformed. We used a mixed-effects model with the nlme R package to test for differences in log10(fungal glycogen + 1) between habitats (rainforest and urban), tissue types (hyphae and staphylae), and their interaction. Technical replicate nested within chamber, nested within colony, was included as a random effect (model structure: log glycogen ~ habitat + tissue + habitat:tissue, with random structure ~1 | colony/chamber/technical replicate). We then used ANOVA to test for significant differences between fixed effects.
References and software
The following publications describe the two in vitro fungal-cultivar experiments used to construct the consensus nutritional performance landscapes:
- Crumière, A. J. J., et al. (2021). The multidimensional nutritional niche of fungus-cultivar provisioning in free-ranging colonies of a neotropical leafcutter ant. Ecology Letters, 24, 2439–2451.
- Shik, J. Z., et al. (2021). Nutritional niches reveal fundamental domestication trade-offs in fungus-farming ants. Nature Ecology & Evolution, 5, 122–134.
The analyses were performed in R and used the following packages: nlme, emmeans (version 1.6.3), ggplot2, fields, lmerTest, terra, pracma, and effsize. Package documentation and source code are available from the Comprehensive R Archive Network (CRAN; https://cran.r-project.org/).
The associated article describing the study is:
Shik, J. Z., et al. (2026). Nutritional niches reveal mutualism resilience in urban fungus-farming ants. Proceedings of the National Academy of Sciences. https://doi.org/10.1073/pnas.2626610123.
