---
authors:
  - givenNames:
      - Simon
    familyNames:
      - Tragust
    type: Person
    emails:
      - simon.tragust@zoologie.uni-halle.de
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Claudia
    familyNames:
      - Herrmann
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Jane
    familyNames:
      - Häfner
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Ronja
    familyNames:
      - Braasch
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Christina
    familyNames:
      - Tilgen
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Maria
    familyNames:
      - Hoock
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Margarita
      - Artemis
    familyNames:
      - Milidakis
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
  - givenNames:
      - Roy
    familyNames:
      - Gross
    type: Person
    affiliations:
      - name: 'Microbiology, Biocenter, University of Würzburg, Am Hubland'
        address:
          addressCountry: Germany
          addressLocality: Würzburg
          type: PostalAddress
        type: Organization
  - givenNames:
      - Heike
    familyNames:
      - Feldhaar
    type: Person
    affiliations:
      - name: >-
          Animal Ecology I, Bayreuth Center for Ecology and Environmental
          Research (BayCEER), University of Bayreuth, Universitätsstraße
        address:
          addressCountry: Germany
          addressLocality: Bayreuth
          type: PostalAddress
        type: Organization
editors:
  - givenNames:
      - Bruno
    familyNames:
      - Lemaître
    type: Person
    affiliations:
      - name: École Polytechnique Fédérale de Lausanne
        address:
          addressCountry: Switzerland
          type: PostalAddress
        type: Organization
datePublished:
  value: '2020-11-03'
  type: Date
dateReceived:
  value: '2020-06-22'
  type: Date
dateAccepted:
  value: '2020-10-14'
  type: Date
title: >-
  Formicine ants swallow their highly acidic poison for gut microbial selection
  and control
description: >-
  Animals continuously encounter microorganisms that are essential for health or
  cause disease. They are thus challenged to control harmful microbes while
  allowing the acquisition of beneficial microbes. This challenge is likely
  especially important for social insects with respect to microbes in food, as
  they often store food and exchange food among colony members. Here we show
  that formicine ants actively swallow their antimicrobial, highly acidic poison
  gland secretion. The ensuing acidic environment in the stomach, the crop, can
  limit the establishment of pathogenic and opportunistic microbes ingested with
  food and improve the survival of ants when faced with pathogen contaminated
  food. At the same time, crop acidity selectively allows acquisition and
  colonization by Acetobacteraceae, known bacterial gut associates of formicine
  ants. This suggests that swallowing of the poison in formicine ants acts as a
  microbial filter and that antimicrobials have a potentially widespread but so
  far underappreciated dual role in host-microbe interactions.
isPartOf:
  volumeNumber: 9
  isPartOf:
    title: eLife
    issns:
      - 2050-084X
    identifiers:
      - name: nlm-ta
        propertyID: 'https://registry.identifiers.org/registry/nlm-ta'
        value: elife
        type: PropertyValue
      - name: publisher-id
        propertyID: 'https://registry.identifiers.org/registry/publisher-id'
        value: eLife
        type: PropertyValue
    publisher:
      name: 'eLife Sciences Publications, Ltd'
      type: Organization
    type: Periodical
  type: PublicationVolume
licenses:
  - url: 'http://creativecommons.org/licenses/by/4.0/'
    content:
      - content:
          - 'This article is distributed under the terms of the '
          - content:
              - Creative Commons Attribution License
            target: 'http://creativecommons.org/licenses/by/4.0/'
            type: Link
          - >-
            , which permits unrestricted use and redistribution provided that
            the original author and source are credited.
        type: Paragraph
    type: CreativeWork
keywords:
  - Camponotus floridanus
  - Acetobacteraceae
  - Serratia marcescens
  - phylosymbiosis
  - microbiom
  - external immune defense
  - Other
identifiers:
  - name: publisher-id
    propertyID: 'https://registry.identifiers.org/registry/publisher-id'
    value: 60287
    type: PropertyValue
  - name: doi
    propertyID: 'https://registry.identifiers.org/registry/doi'
    value: 10.7554/eLife.60287
    type: PropertyValue
  - name: elocation-id
    propertyID: 'https://registry.identifiers.org/registry/elocation-id'
    value: e60287
    type: PropertyValue
about:
  - name: Evolutionary Biology
    type: DefinedTerm
  - name: Microbiology and Infectious Disease
    type: DefinedTerm
genre:
  - Research Article
bibliography: elife-60287.references.bib
---

# Introduction

Animals commonly harbor gut-associated microbial communities (@bib42; @bib99). Patterns of recurring gut microbial communities have been described for many animal groups (@bib20; @bib84; @bib106). The processes generating these patterns are however often not well understood. They might result from host filtering (@bib94), a shared evolutionary history between gut-associated microbes and their hosts (@bib98) involving microbial adaptations to the host environment (@bib95), simply be a byproduct of similar host dietary preferences (@bib2; @bib56), or result from interactions between microbes in the gut-associated microbial community (@bib15; @bib48).

Food is an important environmental source of microbial gut associates (@bib12; @bib16; @bib36; @bib56; @bib115; @bib114) but also poses a challenge, the need to discriminate between harmful and beneficial microbes, as food may contain microbes that produce toxic chemicals or that are pathogenic (@bib24; @bib38; @bib73; @bib142). In social animals, control of harmful microbes in food while at the same time allowing the acquisition and transmission of beneficial microbes from and with food, is likely especially important. Eusocial Hymenoptera not only transport and store food in their stomach, the crop, but also distribute food to members of their colony via trophallaxis, i.e. the regurgitation of crop content from donor individuals to receiver individuals through mouth-to-mouth feeding (@bib49; @bib53; @bib86). While trophallaxis can facilitate the transmission of beneficial microbes, it can also entail significant costs, as it might open the door to unwanted microbial opportunists and pathogens that can take advantage of these transmission routes (@bib108; @bib125).

Here we investigate how formicine ants, specifically the Florida carpenter ant _Camponotus floridanus_, solve the challenge to control harmful microbes in their food while allowing acquisition and transmission of beneficial microbes from and with their food. Apart from specialized intracellular endosymbionts associated with the midgut in the ant tribe Camponotini (@bib37; @bib45; @bib124; @bib148), formicine ant species have only low abundances of microbial associates in their gut lumen but carry members of the bacterial family Acetobacteraceae as a recurring part of their gut microbiota (@bib18; @bib31; @bib59; @bib72; @bib124). Some formicine gut-associated Acetobacteraceae show signs of genomic and metabolic adaptations to their host environment indicating coevolution and mutual benefit (@bib19; @bib32). But the recurrent presence of Acetobacteraceae in the gut of formicine ants potentially also reflects the direct transmission of bacteria among individuals, selective uptake on the part of the ants, specific adaptations for colonizing ant guts on the part of the bacteria, or some combination of all three (@bib42).

Formicine ant species possess a highly acidic poison gland secretion containing formic acid as its main component (@bib88; @bib110; @bib128). Although the poison is presumably foremost used as a defensive weapon (@bib111), it is also distributed to the environment of these ants as an external immune defense trait (sensu @bib112) to protect their offspring and the nest and to limit disease spread within the society (see references in @bib141; @bib21; @bib116). To this end, ants take up their poison from the acidopore, the opening of the poison gland at the gaster tip, into their mouth (@bib140) during a specialized behavior existing only in a subset of ant families among all Hymenopterans (@bib5; @bib43), termed acidopore grooming.

Here we first investigate whether the poison is also swallowed during acidopore grooming in _C. floridanus_ and seven other formicine ant species from three genera in a comparative survey. In survival experiments and in in vitro and in vivo bacterial viability and growth experiments, we then investigate whether swallowing of the poison can serve gut microbial control and may prevent bacterial pathogen infection. Complementing these experiments, we also test whether poison swallowing has the potential to limit pathogen transmission during trophallactic food exchange. Finally, we explore whether swallowing of the poison acts as a microbial filter that is permissible to gut colonization by bacteria from the family Acetobacteraceae.

# Results
```{r echo=FALSE,warning=FALSE,message=FALSE,results='hide',fig.show='hide'}
#############The following packages need to be installed with: install.packages("name of the package") before calling them
#############code and functions need to be run first before use

#############calling used packages

#computational packages and code
#R version 3.6.1: "Action of the Toes"
library(plyr)#version 1.8.4
library(dplyr)#version 0.8.3
drop.levels <- function(dat){
  # Drop unused factor levels from all factors in a data.frame
  # Author: Kevin Wright.  Idea by Brian Ripley.
  dat[] <- lapply(dat, function(x) x[,drop=TRUE])
  return(dat)
}

#graphical packages
library(ggplot2)#version 3.2.1
library(ggkm)#version 0.6.0; see https://github.com/sachsmc/ggkm

#statistical packages
library(lme4)#version 1.1-21
library(multcomp)#version 1.4-10
library(DHARMa)#version 0.2.4
library(coxme)#2.2-14
library(glmmTMB)#version 0.2.3

#in order for the package multcomp to work with glmmTMB you need this function see: https://github.com/glmmTMB/glmmTMB/blob/master/glmmTMB/vignettes/model_evaluation.rmd
glht_glmmTMB <- function (model, ..., component="cond") {
    glht(model, ...,
         coef. = function(x) fixef(x)[[component]],
         vcov. = function(x) vcov(x)[[component]],
         df = NULL)
}
modelparm.glmmTMB <- function (model, coef. = function(x) fixef(x)[[component]],
                               vcov. = function(x) vcov(x)[[component]],
                               df = NULL, component="cond", ...) {
    multcomp:::modelparm.default(model, coef. = coef., vcov. = vcov.,
                        df = df, ...)
}

library(broman) # for myround function to round p-values for inline text
format_pval <- function(x){
  if (x < .001) return(paste('<0.001'))
  if (x > .05 & x < 0.1) return(paste('>0.05'))
  paste('=', myround(x, 3))   # 3 = no. of digits to round p value to if .001 < p < .250.
}


#############the raw data is stored at the Dryad Digital Data Repository: https://doi.org/10.5061/dryad.k0p2ngf4v

```

## Swallowing of the formicine ant poison gland secretion leads to acidic crop environments
```{r echo=FALSE,warning=FALSE,message=FALSE,results='hide',fig.show='hide'}
######################################################################################################
######################### Fig 1 a,b,c: Crop acidification ############################################
######################################################################################################


#############loading data for Fig.1a
acidification.c.floridanus<-read.delim("https://datadryad.org/stash/downloads/file_stream/708509",header=T)#choose file: Supplementary Data Fig.1a.txt
str(acidification.c.floridanus)
acidification.c.floridanus$time<-factor(acidification.c.floridanus$time,c("0+4h","0+24h","0+48h","48+4h"))#reorder factor time


#############statistcal analysis
m.acidification.c.floridanus<-lmer(log(ph)~time+(1|colony),data=acidification.c.floridanus)
summary(m.acidification.c.floridanus)

#model validation
res.m.acidification.c.floridanus<-simulateResiduals(fittedModel=m.acidification.c.floridanus)
plot(res.m.acidification.c.floridanus)

#significance of predictor time since feeding (four levels: 0+4h, 0+24h, 0+48h, 48h+4h)
m.acidification.c.floridanus0<-lmer(log(ph)~1+(1|colony),data=acidification.c.floridanus)
anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)

#post-hoc comporisons of predictor-levels time since feeding
m.acidification.c.floridanus.glht<-glht(m.acidification.c.floridanus,linfct=mcp(time="Tukey"))
output.m.acidification.c.floridanus.glht<-summary(m.acidification.c.floridanus.glht,test=adjusted("Westfall"))
output.m.acidification.c.floridanus.glht

#calculation of median values and confidence intervals of predictor time since feeding (four levels: 0+4h, 0+24h, 0+48h, 48h+4h)
ph.summary.c.floridanus<-ddply(acidification.c.floridanus,"time",summarize,
N=length(ph),
median=quantile(ph,0.5),
lowerCI=quantile(ph,0.025),
upperCI=quantile(ph,0.975))
ph.summary.c.floridanus


#############loading data for Fig.1b
mobility.c.floridanus<-read.delim("https://datadryad.org/stash/downloads/file_stream/708508",header=T)#choose file: Supplementary Data Fig.1b.txt
str(mobility.c.floridanus)


#############statistcal analysis for Fig.1b
m.mobility.c.floridanus<-lmer(ph~treatment+(1|colony),data=mobility.c.floridanus)
summary(m.mobility.c.floridanus)

#model validation
res.m.mobility.c.floridanus<-simulateResiduals(fittedModel=m.mobility.c.floridanus)
plot(res.m.mobility.c.floridanus)

#significance of predictor ant manipulation (two levels: FA+ and FA-, i.e. ants with and without acidopore access)
m.mobility.c.floridanus0<-lmer(ph~1+(1|colony),data=mobility.c.floridanus)
anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)



#############loading data for Fig.1c
mobility.formicine.ants<-read.delim("https://datadryad.org/stash/downloads/file_stream/708511",header=T)#choose data: Supplementary Data Fig.1c.txt
str(mobility.formicine.ants)

#subsetting the data frame into the six formicine ant species
mobility.c.maculatus<-subset(mobility.formicine.ants,colony=="c2")
mobility.c.maculatus<-drop.levels(mobility.c.maculatus)
str(mobility.c.maculatus)

mobility.l.fuliginosus<-subset(mobility.formicine.ants,colony=="l1")
mobility.l.fuliginosus<-drop.levels(mobility.l.fuliginosus)
str(mobility.l.fuliginosus)

mobility.f.pratensis<-subset(mobility.formicine.ants,colony=="f1")
mobility.f.pratensis<-drop.levels(mobility.f.pratensis)
str(mobility.f.pratensis)

mobility.f.rufibarbis<-subset(mobility.formicine.ants,colony=="f2")
mobility.f.rufibarbis<-drop.levels(mobility.f.rufibarbis)
str(mobility.f.rufibarbis)

mobility.f.cinerea<-subset(mobility.formicine.ants,colony=="f3")
mobility.f.cinerea<-drop.levels(mobility.f.cinerea)
str(mobility.f.cinerea)

mobility.f.cunicularia<-subset(mobility.formicine.ants,colony=="f4")
mobility.f.cunicularia<-drop.levels(mobility.f.cunicularia)
str(mobility.f.cunicularia)

mobility.f.fuscocinerea<-subset(mobility.formicine.ants,colony=="f5")
mobility.f.fuscocinerea<-drop.levels(mobility.f.fuscocinerea)
str(mobility.f.fuscocinerea)


#############statistcal analysis for Fig.1c
wilcox.test(ph~treatment,data=mobility.c.maculatus)
wilcox.test(ph~treatment,data=mobility.l.fuliginosus)
wilcox.test(ph~treatment,data=mobility.f.pratensis)
wilcox.test(ph~treatment,data=mobility.f.rufibarbis)
wilcox.test(ph~treatment,data=mobility.f.cinerea)
wilcox.test(ph~treatment,data=mobility.f.cunicularia)
wilcox.test(ph~treatment,data=mobility.f.fuscocinerea)



######################################################################################################
###################### Fig. 1 - figure supplement 1: crop acidity baseline ###########################
######################################################################################################


#############loading data for Fig.1 - figure supplement 1
acidification.baseline<-read.delim("https://datadryad.org/stash/downloads/file_stream/708512",header=T)#choose file: Supplementary Data Fig.1 - figure supplement 1.txt
str(acidification.baseline)

#calculation of median values and confidence intervals of predictor status (two levels:satiated and starved) and worker caste (two levels: minor and major)
ph.summary.acidification.baseline<-ddply(acidification.baseline,c("status","caste"),summarize,
N=length(ph),
median=quantile(ph,0.5),
lowerCI=quantile(ph,0.025),
upperCI=quantile(ph,0.975))
ph.summary.acidification.baseline



######################################################################################################
###################### Fig. 1 - figure supplement 2: acidopore grooming ##############################
######################################################################################################


#############loading data for Fig. 1 - figure supplement 2
acidopore.grooming<-read.delim("https://datadryad.org/stash/downloads/file_stream/708513",header=T)#choose file: Supplementary Data Fig.1 - figure supplement 2.txt
str(acidopore.grooming)
food.treatment1<-factor(acidopore.grooming$food.treatment,levels=c("unfed","water","honey"))#reorder factor treatment


#############statistcal analysis for Fig. 1 - figure supplement 2
m.grooming<-glmer.nb(groomingevents~food.treatment+(1|colony),data=acidopore.grooming)
summary(m.grooming)

#model validation
res.m.grooming<-simulateResiduals(fittedModel=m.grooming)
plot(res.m.grooming)

#significance of predictor food treatment (three levels: unfed, water, honey)
m.grooming0<-glmer.nb(groomingevents~1+(1|colony),data=acidopore.grooming)
anova(m.grooming,m.grooming0)

#post-hoc comporisons of predictor-levels food treatment
m.grooming.glht<-glht(m.grooming,linfct=mcp(food.treatment="Tukey"))
output.m.grooming.glht<-summary(m.grooming.glht,test=adjusted("Westfall"))
output.m.grooming.glht




######################################################################################################
############################### Fig. 1 - figure supplement 3: pH midgut  #############################
######################################################################################################


#############loading data for Fig.1 - figure supplement 3
ph.midgut<-read.delim("https://datadryad.org/stash/downloads/file_stream/708514", header=T)#choose data: Supplementary Data Fig.1 - figure supplement 3.txt
str(ph.midgut)


#############statistcal analysis for Fig.1 - figure supplement 3
m.ph.midgut<-lmer(ph~gutregion+(1|colony),data=ph.midgut)
summary(m.ph.midgut)

#model validation
res.m.ph.midgut<-simulateResiduals(fittedModel=m.ph.midgut)
plot(res.m.ph.midgut)

#significance of predictor gutregion (five levels: crop, midgut.position1, midgut.position2, midgut.position3, midgut.position4)
m.ph.midgut0<-lmer(ph~1+(1|colony),data=ph.midgut)
anova(m.ph.midgut,m.ph.midgut0)

#post-hoc comporisons of predictor-levels position 
m.ph.midgut.glht<-glht(m.ph.midgut,linfct=mcp(gutregion="Tukey"))
output.m.ph.midgut.glht<-summary(m.ph.midgut.glht,test=adjusted("Westfall"))
output.m.ph.midgut.glht

#calculation of median values and confidence intervals of predictor position 
ph.summary.midgut<-ddply(ph.midgut,"gutregion",summarize,
N=sum(!is.na(ph)),
median=quantile(ph,0.5,na.rm=TRUE),
lowerCI=quantile(ph,0.025,na.rm=TRUE),
upperCI=quantile(ph,0.975,na.rm=TRUE),
mean=mean(ph,na.rm=TRUE),
sd=sd(ph,na.rm=TRUE),
length=length(!is.na(ph)),
se=sd/sqrt(length))
ph.summary.midgut

```

To reveal whether formicine ants swallow their acidic poison during acidopore grooming, we first monitored acidity levels in the crop lumen of the Florida carpenter ant _Camponotus floridanus_ after feeding them 10% honey water (pH = 5). We found that after feeding the crop became increasingly acidic over time, reaching highly acidic values 48 hr after feeding (median pH = `r ph.summary.c.floridanus[3,3]`; 95% CI: `r myround(ph.summary.c.floridanus[3,4],1)`–`r myround(ph.summary.c.floridanus[3,5],1)`), whilst renewed access to food after 48 hr raised the pH to levels recorded after the first feeding ([Figure 1a](#fig1); LMM, LR-test, χ^2^ = `r myround(anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)[2,6],2)`, df = `r anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)[2,7]`, p`r format_pval( myround(anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)[2,8],3))`; Westfall corrected post-hoc comparisons: 0+4 hr versus. 48h+4 hr: p=`r myround((output.m.acidification.c.floridanus.glht$test)$pvalues[3],3)`, all other comparisons: p`r format_pval(myround((output.m.acidification.c.floridanus.glht$test)$pvalues[2],3))`). We also found that crop pH levels of _C. floridanus_ ants were highly acidic in workers taken directly out of a satiated colony ([Figure 1—figure supplement 1](#fig1s1); major workers: median pH = `r ph.summary.acidification.baseline[1,4]`, 95% CI: `r myround(ph.summary.acidification.baseline[1,5],1)`–`r myround(ph.summary.acidification.baseline[1,6],1)`; minor workers: median pH = `r ph.summary.acidification.baseline[2,4]`, CI: `r myround(ph.summary.acidification.baseline[2,5],1)`–`r myround(ph.summary.acidification.baseline[2,6],1)`) and in worker cohorts that were satiated for 3 d and then starved for 24 hr before measurements (majors: median pH = `r ph.summary.acidification.baseline[3,4]`, 95% CI: `r myround(ph.summary.acidification.baseline[3,5],1)`–`r myround(ph.summary.acidification.baseline[1,6],1)`; minors: median pH = `r ph.summary.acidification.baseline[4,4]`, CI: `r myround(ph.summary.acidification.baseline[4,5],1)`–`r myround(ph.summary.acidification.baseline[4,6],1)`), suggesting that under natural conditions an acidic baseline pH in the crop lumen is maintained following perturbation thereof through ingested fluids.

figure: Figure 1.
:::
![](elife-60287.rmd.media/fig1.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}

#addition of median values per time since feeding into the data.frame as a new variable
acidification.c.floridanus2<-acidification.c.floridanus%>%group_by(time)%>%mutate(medianph=median(ph))

#definition of universal ph indicator colors: 1-6
ph.colors.rgb1<-c(
"202 58 67",
"235 81 42",
"252 125 19",
"253 190 2",
"254 250 0",
"235 230 54"
)

#transformation of RGB colors into hex colors
ph.colors.hex1<-sapply(strsplit(ph.colors.rgb1, " "), function(ph.colors.rgb1)
    rgb(ph.colors.rgb1[1], ph.colors.rgb1[2], ph.colors.rgb1[3], maxColorValue=255))

#plotting of Fig.1a
fig.1a<-ggplot()+
geom_boxplot(data=acidification.c.floridanus2,mapping=aes(x=time,y=ph,fill=medianph),colour="grey30",lwd=1.5,outlier.shape=NA,alpha=0.5,width=0.4,coef=0)+
scale_fill_gradientn(colours=ph.colors.hex1,breaks=c(1,2,3,4,5,6),limits=c(1,6.5),guide=FALSE)+
geom_point(data = acidification.c.floridanus,mapping=aes(x=time,y=ph,fill=ph),pch=21,color="white",position=position_jitter(width=0.1),size=6.5,alpha=1)+
scale_x_discrete(name="Time after feeding",labels=c("0h+4h","0h+24h","0h+48h","48h+4h"))+
scale_y_continuous(name="pH-value",limits=c(1,6),breaks=c(1,2,3,4,5,6))+
annotate("text",x=c(1,2,3,4),y=c(5.5,4.4,4,5.5),size=14,label=c("a","b","c","a"),fontface=2)+#statistical significance 
annotate("text",x=c(2.5),y=c(6),size=16,label=c("***"),fontface=2)+
labs(tag="a")+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=35),
      axis.text.y=element_text(colour="black",size=35),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(4,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.1a
```
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot fig.1b
#calculation of median values and confidence intervals of predictor ant manipulation
ph.summary.mobility.c.floridanus<-ddply(mobility.c.floridanus,"treatment",summarize,
N=length(ph),
median=quantile(ph,0.5),
lowerCI=quantile(ph,0.025),
upperCI=quantile(ph,0.975))

#addition of median values per ant manipulation into the data.frame as a new variable
mobility.c.floridanus2<-mobility.c.floridanus%>%group_by(treatment)%>%mutate(medianph=median(ph))

#definition of universal ph indicator colors: 1-6
ph.colors.rgb1<-c(
"202 58 67",
"235 81 42",
"252 125 19",
"253 190 2",
"254 250 0",
"235 230 54"
)

#transformation of RGB colors into hex colors
ph.colors.hex1<-sapply(strsplit(ph.colors.rgb1, " "), function(ph.colors.rgb1)
    rgb(ph.colors.rgb1[1], ph.colors.rgb1[2], ph.colors.rgb1[3], maxColorValue=255))

#plotting of Fig.1b
fig.1b<-ggplot()+
geom_boxplot(data=mobility.c.floridanus2,mapping=aes(x=treatment,y=ph,fill=medianph,colour=treatment),outlier.shape=NA,lwd=1.5,alpha=0.5,width=0.6,coef=0)+
scale_fill_gradientn(colours=ph.colors.hex1,breaks=c(1,2,3,4,5,6),limits=c(1,6.5),guide=FALSE)+
scale_color_manual(values=c("grey70","grey30"),guide=FALSE)+
geom_point(data = mobility.c.floridanus, mapping=aes(x=treatment,y=ph,fill=ph),pch=21,color="white",position=position_jitter(width=0.1),size=6.5,alpha=1)+
scale_x_discrete(name="Treatment",labels=c("FA -","FA +"))+
scale_y_continuous(name="pH-value",limits=c(1,6),breaks=c(1,2,3,4,5,6))+
geom_segment(aes(x = 1, y = 5.5, xend = 2, yend = 5.5),lwd=1.5)+
annotate("text",x=c(1.5),y=c(5.6),size=16,label=c("***"),fontface=2)+#statistical significance
labs(tag="b")+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=35),
      axis.text.y=element_text(colour="black",size=35),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(4,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.1b
```
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=20,fig.width=20,out.height=800,out.width=800}
#############plot fig.1c
mobility.formicine.ants$species2<-factor(mobility.formicine.ants$species,levels=c("maculatus","fuliginosus","cinerea","cunicularia","fuscocinerea","pratensis","rufibarbis"))#reorder facotr species

#calculation of median values and confidence intervals of predictor ant manipulation (two levels:FA- and FA+) and of factor species (six levels)
ph.summary.mobility.formicine.ants<-ddply(mobility.formicine.ants,c("species2","treatment"),summarize,
N=length(ph),
median=quantile(ph,0.5),
lowerCI=quantile(ph,0.025),
upperCI=quantile(ph,0.975))

#addition of median values per ant manipulation into the data.frame as a new variable
mobility.formicine.ants2<-mobility.formicine.ants%>%group_by(colony,treatment)%>%mutate(medianph=median(ph))

#definition of universal ph indicator colors: 1-6
ph.colors.rgb1<-c(
"202 58 67",
"235 81 42",
"252 125 19",
"253 190 2",
"254 250 0",
"235 230 54"
)

#transformation of RGB colors into hex colors
ph.colors.hex1<-sapply(strsplit(ph.colors.rgb1, " "), function(ph.colors.rgb1)
    rgb(ph.colors.rgb1[1], ph.colors.rgb1[2], ph.colors.rgb1[3], maxColorValue=255))

#plotting of Fig.1c
fig.1c<-ggplot()+
geom_boxplot(data=mobility.formicine.ants2,mapping=aes(x=species2,y=ph,fill=medianph,colour=treatment),position=position_dodge(0.5),outlier.shape=NA,lwd=1.5,alpha=0.5,width=0.4,coef=0)+
scale_fill_gradientn(colours=ph.colors.hex1,guide=FALSE,breaks=c(1,2,3,4,5,6),limits=c(1,6.5))+
scale_color_manual(values=c("grey70","grey30"),name="Animal treatment:",labels=c("FA-","FA+"))+
geom_point(data = mobility.formicine.ants, mapping=aes(x=species2,y=ph,fill=ph,group=treatment),pch=21,color="white",position=position_jitterdodge(jitter.width=0.1,jitter.height=0.05,dodge.width=0.5),size=5,alpha=1)+
scale_x_discrete(name="Species",
labels=c(
expression(paste(italic("C. maculatus"))),
expression(paste(italic("L. fuliginosus"))),
expression(paste(italic("F. cinerea"))),
expression(paste(italic("F.cunicularia"))),
expression(paste(italic("F. fuscocinerea"))),
expression(paste(italic("F. pratensis"))),
expression(paste(italic("F. rufibarbis")))
))+
scale_y_continuous(name="pH-value",limits=c(1,6),breaks=c(1,2,3,4,5,6))+
geom_segment(aes(x = 0.875, y = 3.9, xend = 1.125, yend = 3.9),lwd=2)+
geom_segment(aes(x = 1.875, y = 3.9, xend = 2.125, yend = 3.9),lwd=2)+
geom_segment(aes(x = 2.875, y = 4.9, xend = 3.125, yend = 4.9),lwd=2)+
geom_segment(aes(x = 3.875, y = 4.9, xend = 4.125, yend = 4.9),lwd=2)+
geom_segment(aes(x = 4.875, y = 4.9, xend = 5.125, yend = 4.9),lwd=2)+
geom_segment(aes(x = 5.875, y = 5.4, xend = 6.125, yend = 5.4),lwd=2)+
geom_segment(aes(x = 6.875, y = 4.4, xend = 7.125, yend = 4.4),lwd=2)+
annotate("text",x=c(1,2,3,4,5,6,7),y=c(4.1,4.1,5.1,5.1,5.1,5.6,4.6),size=8,label=
c(
expression(paste(italic("P")," = 0.036")),
expression(paste(italic("P")," < 0.001")),
expression(paste(italic("P")," < 0.001")),
expression(paste(italic("P")," = 0.007")),
expression(paste(italic("P")," < 0.001")),
expression(paste(italic("P")," = 0.018")),
expression(paste(italic("P")," < 0.001"))),
fontface=1)+
labs(tag="c")+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=30,angle=50,hjust=1),
      axis.text.y=element_text(colour="black",size=30),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=30),
      legend.text=element_text(size=30),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(4,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.1c
```


### Acidification of formicine ant crop lumens through swallowing of acidic poison gland secretions.

(**a**) The pH of crop lumens at 4 hr, 24 hr, and 48 hr after feeding _C. floridanus_ ants 10% honey water (pH = 5) at 0 hr and at 4 hr after re-feeding ants at 48 hr (LMM, LR-test, χ^2^ = `r myround(anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)[2,6],2)`, df = `r anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)[2,7]`, p`r format_pval( myround(anova(m.acidification.c.floridanus,m.acidification.c.floridanus0)[2,8],3))`, same letters indicate p=`r myround((output.m.acidification.c.floridanus.glht$test)$pvalues[3],3)` and different letters indicate p`r format_pval(myround((output.m.acidification.c.floridanus.glht$test)$pvalues[2],3))` in Westfall corrected post hoc comparisons). (**b**) The pH of crop lumens in _C. floridanus_ ants that were either prevented to ingest the formic acid containing poison gland secretion (FA-) or not (FA+) for 24 hr after feeding (LMM, LR-test, χ^2^ = `r myround( anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)[2,6],2)`, df = `r  anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)[2,7]`, p`r format_pval( format_pval(myround(anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)[2,8],3)))`). (**c**) The pH-value of crop lumens 24 hr after feeding in seven formicine ant species that were either prevented to ingest the formic acid containing poison gland secretion (FA-) or not (FA+). Wilcoxon rank-sum tests (two-sided). Lines and shaded boxes show the median and interquartile range; points show all data. Colors in shaded rectangles near the y-axis represent universal indicator pH colors. Color filling of shaded boxes correspond to the median pH color of x-axis groups and color filling of points correspond to universal indicator pH colors. The border of shaded boxes represents animal treatment (light gray: prevention of poison ingestion, FA-; dark gray: poison ingestion not prevented, FA+).
:::
{#fig1}

figure: Figure 1—figure supplement 1.
:::
![](elife-60287.rmd.media/fig1-figsupp1.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#addition of median values per status and caste into the data.frame as a new variable
acidification.baseline2<-acidification.baseline%>%group_by(status,caste)%>%mutate(medianph=median(ph))

#definition of universal ph indicator colors: 1-6
ph.colors.rgb1<-c(
"202 58 67",
"235 81 42",
"252 125 19",
"253 190 2",
"254 250 0",
"235 230 54"
)

#transformation of RGB colors into hex colors
ph.colors.hex1<-sapply(strsplit(ph.colors.rgb1, " "), function(ph.colors.rgb1)
    rgb(ph.colors.rgb1[1], ph.colors.rgb1[2], ph.colors.rgb1[3], maxColorValue=255))

#plotting of Fig.1 - figure supplement 1
fig.1.figure.supplement1<-ggplot()+
geom_boxplot(data=acidification.baseline2,mapping=aes(x=status,y=ph,fill=medianph,colour=caste),position=position_dodge(0.5),outlier.shape=NA,lwd=1.5,alpha=0.5,width=0.4,coef=0)+
scale_fill_gradientn(colours=ph.colors.hex1,guide=FALSE,breaks=c(1,2,3,4,5,6),limits=c(1,6.5))+
scale_color_manual(values=c("grey70","grey30"),name="Worker caste:",labels=c("Major","Minor"))+
geom_point(data = acidification.baseline, mapping=aes(x=status,y=ph,fill=ph,group=caste),pch=21,color="white",position=position_jitterdodge(jitter.width=0.1,jitter.height=0.05,dodge.width=0.5),size=5,alpha=1)+
scale_x_discrete(name="Animal feeding status",labels=c("Colony:\nsatiated","Colony cohort:\nstarved"))+
scale_y_continuous(name="pH-value",limits=c(1,6),breaks=c(1,2,3,4,5,6))+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=30,angle=30,hjust=1),
      axis.text.y=element_text(colour="black",size=30),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=30),
      legend.text=element_text(size=30),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(4,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.1.figure.supplement1

```


### Baseline acidity of _C. floridanus_ crop lumens under satiated and starved conditions.

pH of crop lumens in _C. floridanus_ workers (light gray: major workers, dark gray: minor workers) that were either taken directly out of a satiated colony or that were kept in cohorts of ~100 individuals under satiated conditions for 3 d and then starved for 24 hr before measuring the pH. Lines and shaded boxes show the median and interquartile range; points show all data. Colors in shaded rectangles near the y-axis represent universal indicator pH colors. Color filling of shaded boxes correspond to the median pH color of x-axis groups and color filling of points correspond to universal indicator pH colors. Border of shaded boxes represents animal caste (light gray: major workers; dark gray: minor workers).
:::
{#fig1s1}

figure: Figure 1—figure supplement 2.
:::
![](elife-60287.rmd.media/fig1-figsupp2.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
############plot Fig. 1 - figure supplement 2
fig.1.figure.supplement2<-ggplot()+
geom_boxplot(data=acidopore.grooming,mapping=aes(x=food.treatment1,y=groomingevents,fill=food.treatment1),outlier.shape=NA,lwd=1.5,alpha=0.2,width=0.4,coef=0)+
geom_point(data=acidopore.grooming,mapping=aes(x=food.treatment1,y=groomingevents,color=food.treatment1),position=position_jitter(width=0.1),size=4,alpha=0.7)+
scale_fill_manual(values=c("white","white","white"),name="Food treatment (Mean/Median):",labels=c("unfed","water","honey"),guide=FALSE)+
scale_colour_manual(values=c("grey","dodgerblue","yellow1"),name="Raw data",guide=FALSE)+
scale_x_discrete(name="Food",labels=c("unfed","water","honey"))+
scale_y_continuous(name="Acidopre grooming frequency",limits=c(-0.5,15))+
annotate("text",x=c(1,2,3),y=c(8,11,11),size=10,label=c("a","b","b"),fontface=2)+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=18),
      axis.text.y=element_text(colour="black",size=18),
      axis.title.x=element_text(colour="black",size=25,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=25,margin=margin(0,22,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.1.figure.supplement2

```

### Acidopore grooming frequency of _C. floridanus_ after ingestion of different food types.

Frequency of acidopore grooming within 30 min. after fluid ingestion (water or 10% honey water) compared to ants that did not receive any fluid (unfed) (GLMM, LR-test, χ^2^ = `r myround(anova(m.grooming,m.grooming0)[2,6],3)`, df = `r anova(m.grooming,m.grooming0)[2,7]`, p`r format_pval( myround(anova(m.grooming,m.grooming0)[2,8],3))`,same letters indicate p=`r myround((output.m.grooming.glht$test)$pvalues[2],3)` and different letters indicate p`r format_pval(myround((output.m.grooming.glht$test)$pvalues[1],3))` in Westfall corrected post hoc comparisons).
:::
{#fig1s2}

figure: Figure 1—figure supplement 3.
:::
![](elife-60287.rmd.media/fig1-figsupp3.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig.1 - figure supplement 3

#addition of median values per position into the data.frame as a new variable
ph.midgut2<-ph.midgut%>%group_by(gutregion)%>%mutate(medianph=median(ph,na.rm=TRUE))

#definition of universal ph indicator colors: 1-7
ph.colors.rgb<-c(
"202 58 67",
"235 81 42",
"252 125 19",
"253 190 2",
"254 250 0",
"235 230 54",
"133 203 40"
)

#transformation of RGB colors into hex colors
ph.colors.hex<-sapply(strsplit(ph.colors.rgb, " "), function(ph.colors.rgb)
    rgb(ph.colors.rgb[1], ph.colors.rgb[2], ph.colors.rgb[3], maxColorValue=255))

#plotting of Fig.1 - figure supplement 3
fig.1.figure.supplement3<-ggplot()+
geom_boxplot(data=ph.midgut2,mapping=aes(x=gutregion,y=ph,fill=medianph),colour="grey30",lwd=1.5,outlier.shape=NA,alpha=0.5,coef=0)+
scale_fill_gradientn(colours=ph.colors.hex,guide=FALSE,breaks=c(1,2,3,4,5,6,7),limits=c(1,7.5))+
geom_point(data=ph.midgut2,mapping=aes(x=gutregion,y=ph,fill=ph),pch=21,color="white",position=position_jitter(width=0.1),size=6.5,alpha=1)+
scale_x_discrete(name="Gut position",labels=c("Crop","Midgut\nposition 1","Midgut\nposition 2","Midgut\nposition 3","Midgut\nposition 4"))+
scale_y_continuous(name="pH-value",limits=c(1,7),breaks=c(1,2,3,4,5,6,7))+
annotate("text",x=c(1,2,3,4,5),y=c(4.5,6.5,6.5,6.5,6.5),size=9,label=c("a","b","b","b","b"),fontface=2)+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=20),
      axis.text.y=element_text(colour="black",size=20),
      axis.title.x=element_text(colour="black",size=25,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=25,margin=margin(0,22,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(3.6,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.1.figure.supplement3
```

### Acidity along the gastrointestinal tract of _C. floridanus_.

pH-measurements 24 hr after access to 10% honey-water in the crop (N = `r ph.summary.midgut[1,2]`) and directly after the proventriculus at four points along the midgut (N = `r ph.summary.midgut[2,2]` except position four with N = `r ph.summary.midgut[5,2]`) (LMM, LR-test, χ^2^ = `r myround(anova(m.ph.midgut,m.ph.midgut0)[2,6],3)`, df = `r anova(m.ph.midgut,m.ph.midgut0)[2,7]`, p`r format_pval( myround(anova(m.ph.midgut,m.ph.midgut0)[2,8],3))`, same letters indicate p≥`r myround((output.m.ph.midgut.glht$test)$pvalues[6],3)` and different letters indicate p`r format_pval(myround((output.m.ph.midgut.glht$test)$pvalues[1],3))` in Westfall corrected post hoc comparisons). Lines and shaded boxes show the median and interquartile range; points show all data. Colors in shaded rectangles near the y-axis represent universal indicator pH colors. Color filling of shaded boxes correspond to the median pH color of x-axis groups and color filling of points correspond to universal indicator pH colors.
:::
{#fig1s3}

To pinpoint acidopore grooming and swallowing of the poison gland secretion as the source for crop acidity and to exclude that internal, physiological mechanisms cause crop acidity, we then prevented acidopore grooming in _C. floridanus_ ants for 24 hr after feeding through immobilization. This experiment revealed that acidopore grooming prevented ants showed a significantly diminished acidity in their crop compared to ants that were not prevented from acidopore grooming ([Figure 1b](#fig1); LMM, LR-test, χ^2^ = `r myround(anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)[2,6],3)`, df = `r anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)[2,7]`, p`r format_pval( myround(anova(m.mobility.c.floridanus,m.mobility.c.floridanus0)[2,8],3))`). A similar, significantly diminished acidity in crop lumens was ubiquitously obtained in a comparative survey across seven formicine ant species and three genera (_Camponotus_, _Lasius_, and _Formica_) upon comparison of ants that were prevented from acidopore grooming through immobilization to non-prevented ants ([Figure 1c](#fig1); two-sided Wilcoxon rank-sum tests, comparisons for all ant species: p≤`r myround(wilcox.test(ph~treatment,data=mobility.c.maculatus)$p.value,3)`). We conclude that formicine ants attain a highly acidic baseline pH in their crop lumen by taking up their poison into their mouth during acidopore grooming (@bib140), and subsequently swallowing it. The comparative survey also shows that this behavior is widespread among formicine ants.

Although venomous animals often bear a cost of venom production and express behavioural adaptations to limit venom expenditure (@bib27), we also found that _C. floridanus_ ants increase the frequency of acidopore grooming within the first 30 min after ingesting fluids compared to unfed ants irrespective of the fluid’s nutritional value ([Figure 1—figure supplement 2](#fig1s2); GLMM, LR-test, χ^2^ = `r myround(anova(m.grooming,m.grooming0)[2,6],3)`, df = `r anova(m.grooming,m.grooming0)[2,7]`, p`r format_pval( myround(anova(m.grooming,m.grooming0)[2,8],3))`; Westfall corrected post-hoc pairwise comparisons, water versus. 10% honey-water: p=`r myround((output.m.grooming.glht$test)$pvalues[2],3)`, unfed versus water and unfed versus 10% honey-water: both p`r format_pval(myround((output.m.grooming.glht$test)$pvalues[1],3))`). Moreover, we found that the strong acidity was limited to the crop of _C. floridanus_ ants and did not extend to the midgut, the primary site of digestion in insects (@bib66; @bib137; [Figure 1—figure supplement 3](#fig1s3); pH-measurements at four points along the midgut 24 hr after access to 10% honey-water; mean ± se; midgut position 1 = `r myround(ph.summary.midgut[2,6],2)` ± `r myround(ph.summary.midgut[2,9],2)`, midgut position 2 = `r myround(ph.summary.midgut[3,6],2)` ± `r myround(ph.summary.midgut[3,9],2)`, midgut position 3 = `r myround(ph.summary.midgut[4,6],2)` ± `r myround(ph.summary.midgut[4,9],2)`, midgut position 4 = `r myround(ph.summary.midgut[5,6],2)` ± `r myround(ph.summary.midgut[5,9],2)`). Together, these results led us to hypothesize that poison acidified crop lumens in formicine ants do not primarily serve a digestive function but may serve microbial control, limiting infection by oral pathogens.

## Poison acidified crops can prevent the passage of pathogenic and opportunistic bacteria to the midgut
```{r echo=FALSE,warning=FALSE,message=FALSE,results='hide',fig.show='hide'}
######################################################################################################
############################### Fig 2 a,b: Serratia viability in vivo ################################
######################################################################################################


#############loading data for Fig.2a,b
growth.serratia<-read.delim("https://datadryad.org/stash/downloads/file_stream/708515",header=T)#choose data file: Supplementary Data Fig.2a,b.txt
str(growth.serratia)

#create factor variable time2 from the continuous variable time
growth.serratia$time2<-as.factor(growth.serratia$time)

#subsetting the data frame into two groups (serratia.crop, serratia.midgut)
growth.serratia.crop<-subset(growth.serratia,gutregion=="crop")
growth.serratia.crop<-drop.levels(growth.serratia.crop)
growth.serratia.midgut<-subset(growth.serratia,gutregion=="midgut")
growth.serratia.midgut<-drop.levels(growth.serratia.midgut)

#calculation of median values and confidence intervals of change in CFUs relative to 0h in the crop
growth.serratia.summary<-ddply(growth.serratia,c("gutregion","time"),summarise,
N=length(cfu.change.relative),
median=quantile(cfu.change.relative,0.5),
lowerCI=quantile(cfu.change.relative,0.025),
upperCI=quantile(cfu.change.relative,0.975))
growth.serratia.summary

#removal of time factor levels 4h and 48h in the midgut of serratia fed ants, as these levels consisted only of zeros and were not included in the statistical analysis
growth.serratia.midgut1<-subset(growth.serratia.midgut,time2!="48"&time2!="4")
growth.serratia.midgut1<-drop.levels(growth.serratia.midgut1)


#############statistical analysis Fig. 2a
m.growth.serratia.crop<-glmmTMB(cfu~time2+(1|colony),ziformula=~1,data=growth.serratia.crop,family=nbinom1)
summary(m.growth.serratia.crop)

#model validation
res.m.growth.serratia.crop<-simulateResiduals(fittedModel=m.growth.serratia.crop)
plot(res.m.growth.serratia.crop)

#significance of predictor time since feeding (five levels: 0h, 0.5h, 4h, 24h, 48h)
m.growth.serratia.crop0<-glmmTMB(cfu~1+(1|colony),ziformula=~1,data=growth.serratia.crop,family=nbinom1)
anova(m.growth.serratia.crop,m.growth.serratia.crop0)

#post-hoc comporisons of predictor-levels time since feeding
m.growth.serratia.crop.glht<-glht(m.growth.serratia.crop,linfct=mcp(time2="Tukey"))
output.m.growth.serratia.crop.glht<-summary(m.growth.serratia.crop.glht,test=adjusted("Westfall"))
output.m.growth.serratia.crop.glht


#############statistical analysis Fig. 2b
m.growth.serratia.midgut<-glmmTMB(cfu~time2+(1|colony),data=growth.serratia.midgut1,ziformula=~1,family=nbinom2)
summary(m.growth.serratia.midgut)

#model validation
res.m.growth.serratia.midgut<-simulateResiduals(fittedModel=m.growth.serratia.midgut)
plot(res.m.growth.serratia.midgut)

#statistical significance of predictor time (three levels: 0h, 0.5h, 24h)
m.growth.serratia.midgut0<-glmmTMB(cfu~1+(1|colony),data=growth.serratia.midgut1,ziformula=~1,family=nbinom2)
anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)



######################################################################################################
############ Fig. 2 - figure supplement 1a,b: food passage fluorescent particles #####################
######################################################################################################


#############loading data for Fig. 2 - figure supplement 1a,b
food.flow<-read.delim("https://datadryad.org/stash/downloads/file_stream/708516",header=T)#choose data file: Supplementary Data Fig.2 - figure supplement 1a,b.txt
str(food.flow)
food.flow$time<-factor(food.flow$time,levels=c("2h","4h","6h","8h","12h","14h","16h","18h","24h","48h"))#reorder factor time
food.flow$gutregion<-factor(food.flow$gutregion,levels=c("crop","midgut","hindgut"))#reorder factor gutregion

#calculation of median values and confidence intervals of particles in gutregion over time per minor and major workers
food.flow.summary<-ddply(food.flow,c("caste","gutregion","time"),summarise,
N=length(particles),
median=quantile(particles,0.5),
lowerCI=quantile(particles,0.025),
upperCI=quantile(particles,0.975))
food.flow.summary

#subsetting the data frame food.flow into two groups (food.flow.minor, food.flow.major)
food.flow.minor<-subset(food.flow,caste=="minor")
food.flow.minor<-drop.levels(food.flow.minor)
food.flow.major<-subset(food.flow,caste=="major")
food.flow.major<-drop.levels(food.flow.major)



######################################################################################################
################### Fig. 2 - figure supplement 2a,b: E.coli viability in vivo ########################
######################################################################################################


#############loading data for Fig. 2 - figure supplement 2a,b
growth.ecoli<-read.delim("https://datadryad.org/stash/downloads/file_stream/708517",header=T)#choose data file: Supplementary Data Fig.2 - figure supplement 2a,b.txt
str(growth.ecoli)

#create factor variable time2 from the continuous variable time
growth.ecoli$time2<-as.factor(growth.ecoli$time)

#subsetting the data frame into two groups (ecoli.crop, ecoli.midgut)
growth.ecoli.crop<-subset(growth.ecoli,gutregion=="crop")
growth.ecoli.crop<-drop.levels(growth.ecoli.crop)
growth.ecoli.midgut<-subset(growth.ecoli,gutregion=="midgut")
growth.ecoli.midgut<-drop.levels(growth.ecoli.midgut)

#calculation of median values and confidence intervals of change in CFUs relative to 0h in the crop
growth.ecoli.summary<-ddply(growth.ecoli,c("gutregion","time"),summarise,
N=length(cfu.change.relative),
median=quantile(cfu.change.relative,0.5),
lowerCI=quantile(cfu.change.relative,0.025),
upperCI=quantile(cfu.change.relative,0.975))
growth.ecoli.summary

#removal of time factor levels 0h in the midgut of e.coli fed ants, as this level consisted only of zeros and were not included in the statistical analysis
growth.ecoli.midgut1<-subset(growth.ecoli.midgut,time2!="0")
growth.ecoli.midgut1<-drop.levels(growth.ecoli.midgut1)


#############statistical analysis Fig. 2 - figure supplement 2a
m.growth.ecoli.crop<-glmmTMB(cfu~time2+colony,data=growth.ecoli.crop,ziformula=~1,family=nbinom1)
summary(m.growth.ecoli.crop)

#model validation
res.m.growth.ecoli.crop<-simulateResiduals(fittedModel=m.growth.ecoli.crop)
plot(res.m.growth.ecoli.crop)

#statistical significance of predictor time since feeding (five levels: 0h, 0.5h, 4h, 24h, 48h)
m.growth.ecoli.crop0<-glmmTMB(cfu~colony,data=growth.ecoli.crop,ziformula=~1,family=nbinom1)
anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)

#statistical significance of predictor colony (four levels: C313, C322, C333, C94)
m.growth.ecoli.crop1<-glmmTMB(cfu~time2,data=growth.ecoli.crop,ziformula=~1,family=nbinom1)
anova(m.growth.ecoli.crop,m.growth.ecoli.crop1)

#post-hoc comporisons of predictor-levels time since feeding
m.growth.ecoli.crop1.glht<-glht(m.growth.ecoli.crop1,linfct=mcp(time2="Tukey"))
output.m.growth.ecoli.crop1.glht<-summary(m.growth.ecoli.crop1.glht,test=adjusted("Westfall"))
output.m.growth.ecoli.crop1.glht


#############statistical analysis Fig. 2 - figure supplement 2b
m.growth.ecoli.midgut<-glmmTMB(cfu~time2+(1|colony),data=growth.ecoli.midgut1,ziformula=~1,family=nbinom1)
summary(m.growth.ecoli.midgut)

#model validation
res.m.growth.ecoli.midgut<-simulateResiduals(fittedModel=m.growth.ecoli.midgut)
plot(res.m.growth.ecoli.midgut)

#statistical significance of predictor time since feeding (four levels: 0.5h, 4h, 24h, 48h)
m.growth.ecoli.midgut0<-glmmTMB(cfu~1+(1|colony),data=growth.ecoli.midgut1,ziformula=~1,family=nbinom1)
anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)

#post-hoc comporisons of predictor-levels time since feeding
m.growth.ecoli.midgut.glht<-glht(m.growth.ecoli.midgut,linfct=mcp(time2="Tukey"))
output.m.growth.ecoli.midgut.glht<-summary(m.growth.ecoli.midgut.glht,test=adjusted("Westfall"))
output.m.growth.ecoli.midgut.glht



######################################################################################################
##################### Fig. 2 - figure supplement 3: Serratia growth in vitro #########################
######################################################################################################


#############loading data for Fig. 2 - figure supplement 3
serratia.growth.invitro<-read.delim("https://datadryad.org/stash/downloads/file_stream/708518",header=T)#choose file: Supplementary Data Fig. 2 - figure supplement 3.txt
str(serratia.growth.invitro)

#calculation of median values and confidence intervals of change in CFUs relative to pH 5
serratia.growth.invitro.summary<-ddply(serratia.growth.invitro,c("ph"),summarize,
median.cfu.change=quantile(cfu.change.relative,0.5),
lowerCI.cfu.change=quantile(cfu.change.relative,0.025),
upperCI.cfu.change=quantile(cfu.change.relative,0.975))
serratia.growth.invitro.summary

#removal of pH levels 2 and 3 from serratia.growth.invitro, as these levels consisted only of zeros
serratia.growth.invitro1<-subset(serratia.growth.invitro,ph=="pH5"|ph=="pH4")
serratia.growth.invitro1<-drop.levels(serratia.growth.invitro1)
str(serratia.growth.invitro1)


#############statistical analysis Fig. 2 - figure supplement 3
m.serratia.growth.invitro1<-glm.nb(cfu~ph,data=serratia.growth.invitro1)
summary(m.serratia.growth.invitro1)

#model validation
res.m.serratia.growth.invitro1<-simulateResiduals(fittedModel=m.serratia.growth.invitro1)
plot(res.m.serratia.growth.invitro1)

#statistical significance of predictor pH-level (two levels: pH5, pH4)
m.serratia.growth.invitro10<-glm.nb(cfu~1,data=serratia.growth.invitro1)
anova(m.serratia.growth.invitro1,m.serratia.growth.invitro10)
```

To investigate a potential microbial control function, we next tested whether poison acidified crop lumens can inhibit _Serratia marcescens_, an insect pathogenic bacterium (@bib54), when ingested together with food and prevent its passage from the crop to the midgut in _C. floridanus_ ants. To this end, we first estimated food passage times through the gut of _C. floridanus_ with fluorescent particles contained in food, as we surmised that ingested fluids need to remain in the crop for a minimum time before being passed to the midgut in order for poison swallowing and the ensuing crop acidity to take effect after perturbation of the crop pH through ingested fluids. In agreement with food passage times through the gastrointestinal tract of other ants (@bib25; @bib79; @bib78; @bib67; @bib91), we found that only a small amount of ingested food is passed from the crop to the midgut 2–4 hr after feeding, while thereafter food is steadily passed from the crop to the midgut until 18 hr after feeding ([Figure 2—figure supplement 1](#fig2s1)).

We then measured the viability of _Serratia marcescens_ ingested together with food in the gastrointestinal tract of _C. floridanus_ at two time points before (0.5 hr and 4 hr) and after (24 hr and 48 hr) main food passage from the crop to the midgut, with the time directly after food ingestion (0 hr) serving as a reference. We found that _S. marcescens_ presence decreased sharply over time in the crop ([Figure 2a](#fig2); GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.serratia.crop,m.growth.serratia.crop0)[2,6],3)`, df = `r anova(m.growth.serratia.crop,m.growth.serratia.crop0)[2,7]`, p`r format_pval( myround(anova(m.growth.serratia.crop,m.growth.serratia.crop0)[2,8],3))`). The proportion of CFUs that we were able to retrieve from the crop relative to the mean at 0 hr in the crop diminished from `r round(growth.serratia.summary[2,4]*100)`% at 0.5 hr post-feeding (median, CI: `r round(growth.serratia.summary[2,5]*100)`–`r round(growth.serratia.summary[2,6]*100)`%) to `r round(growth.serratia.summary[3,4]*100)`% at 4 hr (CI: `r round(growth.serratia.summary[3,5]*100)`–`r round(growth.serratia.summary[3,6]*100)`%), 24 hr (CI: `r round(growth.serratia.summary[4,5]*100)`–`r round(growth.serratia.summary[4,6]*100)`%), and 48 hr (CI: `r round(growth.serratia.summary[5,5]*100)`–`r round(growth.serratia.summary[5,6]*100)`%) post-feeding. In addition, relative to the mean at 0 hr in the crop, _S. marcescens_ could only be detected at extremely low numbers in the midgut (median `r round(growth.serratia.summary[6,4]*100)`%) at 0 hr (CI: `r round(growth.serratia.summary[6,5]*100)`–`r round(growth.serratia.summary[6,6]*100)`%), 0.5 hr (CI: `r round(growth.serratia.summary[7,5]*100)`–`r round(growth.serratia.summary[7,6]*100)`%) and 24 hr (CI: `r round(growth.serratia.summary[9,5]*100)`–`r round(growth.serratia.summary[9,6]*100)`%) post-feeding and not at all at 4 hr and 48 hr post-feeding ([Figure 2b](#fig2); GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)[2,6],3)`, df = `r anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)[2,7]`, p=`r  myround(anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)[2,8],3)`)). A similar, rapid reduction in the crop and inability to pass from the crop to the midgut was obtained when we fed _E. coli,_ a potential opportunistic bacterium that is not a gut associate of insects (@bib10) to _C. floridanus_ ants ([Figure 2—figure supplement 2](#fig2s2); crop: GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,6],3)`, df = `r anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,7]`, p`r format_pval( myround(anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,8],3))`; midgut: GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)[2,6],3)`, df = `r anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)[2,7]`, p=`r  myround(anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)[2,8],3)`).

figure: Figure 2.
:::
![](elife-60287.rmd.media/fig2.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 2a
fig.2a<-ggplot()+
geom_boxplot(data=growth.serratia.crop,aes(x=time2,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,alpha=0.3,coef=0,width=0.4)+
geom_point(data=growth.serratia.crop,aes(x=time2,y=cfu.change.relative),pch=21,fill="deeppink1",color="white",alpha=1,position=position_jitter(width=0.1),size=5)+
annotate("text",x=c(1,2,3,4,5),y=c(6.5,6.5,0.7,0.7,0.7),size=9,label=c("a","a","b","b","b"),fontface=2)+
scale_x_discrete(name="Time",labels=c("0h","0.5h","4h","24h","48h"))+
scale_y_continuous(name="CFU change",limits=c(-0.01,7.5))+
labs(tag="a")+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15,face="italic"),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      aspect.ratio=1)
fig.2a

```
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 2b
fig.2b<-ggplot()+
geom_boxplot(data=growth.serratia.midgut,aes(x=time2,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,alpha=0.7,coef=0,width=0.4)+
geom_point(data=growth.serratia.midgut,aes(x=time2,y=cfu.change.relative),fill="deeppink1",pch=21, color="white",alpha=1,position=position_jitter(width=0.1),size=5)+
annotate("text",x=c(3),y=c(0.15),size=9,label=c(expression(paste(italic("P")," = 0.593"))),fontface=2)+
scale_x_discrete(name="Time",labels=c("0h","0.5h","4h","24h","48h"))+
scale_y_continuous(name="CFU change",limits=c(-0.01,0.17))+
labs(tag="b")+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15,face="italic"),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      aspect.ratio=1)
fig.2b

```

### Viability of _S. marcescens_ over time in the digestive tract of _C. floridanus_.

Change in the number of colony forming units (CFUs) in the crop (**a**) and midgut (**b**) part of the digestive tract (yellow color in insert) relative to the mean CFU-number at 0 hr in the crop (CFU change corresponds to single data CFU-value divided by mean CFU-value at 0 hr in the crop), 0 hr, 0.5 hr, 4 hr, 24 hr, and 48 hr after feeding _Camponotus floridanus_ ants 10% honey water contaminated with _Serratia marcescens_. (**a**), Change of _S. marcescens_ in the crop (GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.serratia.crop,m.growth.serratia.crop0)[2,6],3)`, df = `r anova(m.growth.serratia.crop,m.growth.serratia.crop0)[2,7]`, p`r format_pval( myround(anova(m.growth.serratia.crop,m.growth.serratia.crop0)[2,8],3))`, same letters indicate p≥`r myround(( output.m.growth.serratia.crop.glht$test)$pvalues[8],3)` and different letters indicate p`r format_pval(myround((output.m.growth.serratia.crop.glht$test)$pvalues[2],3))` in Westfall corrected post hoc comparisons). (**b**), Change of _S. marcescens_ in the midgut (GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)[2,6],3)`, df = `r anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)[2,7]`, p=`r  myround(anova(m.growth.serratia.midgut,m.growth.serratia.midgut0)[2,8],3)`). Note that timepoints with zero bacterial growth in the midgut (4 hr and 48 hr) were excluded from the statistical model.
:::
{#fig2}

figure: Figure 2—figure supplement 1.
:::
![](elife-60287.rmd.media/fig2-figsupp1.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=15,fig.width=15,out.height=800,out.width=800}
#############plot Fig.2 - figure supplement 1a
#subsetting the data frame food.flow.summary into three groups (food.flow.summary.minor.crop, food.flow.summary.minor.midgut, food.flow.summary.minor.hindgut)
food.flow.summary.minor<-subset(food.flow.summary,caste=="minor")
food.flow.summary.minor<-drop.levels(food.flow.summary.minor)
food.flow.summary.minor.crop<-subset(food.flow.summary.minor,gutregion=="crop")
food.flow.summary.minor.crop<-drop.levels(food.flow.summary.minor.crop)
food.flow.summary.minor.midgut<-subset(food.flow.summary.minor,gutregion=="midgut")
food.flow.summary.minor.midgut<-drop.levels(food.flow.summary.minor.midgut)
food.flow.summary.minor.hindgut<-subset(food.flow.summary.minor,gutregion=="hindgut")
food.flow.summary.minor.hindgut<-drop.levels(food.flow.summary.minor.hindgut)

#plot Fig.2 - figure supplement 1a
fig.2.figure.supplement1a<-ggplot()+
geom_line(data = food.flow.summary.minor.crop,aes(x=time,y=median+1,group="time"),colour="blue",lwd=1.5,alpha=0.8)+
geom_line(data = food.flow.summary.minor.midgut,aes(x=time,y=median+1,group="time"),colour="skyblue",lwd=1.5,alpha=0.8)+
geom_line(data = food.flow.summary.minor.hindgut,aes(x=time,y=median+1,group="time"),colour="turquoise",lwd=1.5,alpha=0.8)+
geom_point(data = food.flow.minor,mapping=aes(x=time,y=particles+1,fill=gutregion),pch=21,color="white",position=position_jitter(width=0.1),size=7,alpha=1)+
scale_fill_manual(values=c("blue","skyblue","turquoise"))+
scale_x_discrete(name="Time after feeding",labels=c("2h","4h","6h","8h","12h","14h","16h","18h","24h","48h"))+
scale_y_continuous(trans="log10",name="Number particles",limits=c(-1,3000))+
annotation_logticks(sides="l",size=1, short = unit(0.25, "cm"), mid = unit(0.5, "cm"), long = unit(0.8,  "cm"))+
labs(tag="a")+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=35),
      axis.text.y=element_text(colour="black",size=35),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(4,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.2.figure.supplement1a

```
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=15,fig.width=15,out.height=800,out.width=800}
#############plot Fig.2 - figure supplement 1b
#subsetting the data frame food.flow.summary into three groups (food.flow.summary.major.crop, food.flow.summary.major.midgut, food.flow.summary.major.hindgut)
food.flow.summary.major<-subset(food.flow.summary,caste=="major")
food.flow.summary.major<-drop.levels(food.flow.summary.major)
food.flow.summary.major.crop<-subset(food.flow.summary.major,gutregion=="crop")
food.flow.summary.major.crop<-drop.levels(food.flow.summary.major.crop)
food.flow.summary.major.midgut<-subset(food.flow.summary.major,gutregion=="midgut")
food.flow.summary.major.midgut<-drop.levels(food.flow.summary.major.midgut)
food.flow.summary.major.hindgut<-subset(food.flow.summary.major,gutregion=="hindgut")
food.flow.summary.major.hindgut<-drop.levels(food.flow.summary.major.hindgut)

#plot Fig.2 - figure supplement 1b
fig.2.figure.supplement1b<-ggplot()+
geom_line(data = food.flow.summary.major.crop,aes(x=time,y=median+1,group="time"),colour="blue",lwd=1.5,alpha=0.8)+
geom_line(data = food.flow.summary.major.midgut,aes(x=time,y=median+1,group="time"),colour="skyblue",lwd=1.5,alpha=0.8)+
geom_line(data = food.flow.summary.major.hindgut,aes(x=time,y=median+1,group="time"),colour="turquoise",lwd=1.5,alpha=0.8)+
geom_point(data = food.flow.major,mapping=aes(x=time,y=particles+1,fill=gutregion),pch=21,color="white",position=position_jitter(width=0.1),size=7,alpha=1)+
scale_fill_manual(values=c("blue","skyblue","turquoise"))+
scale_x_discrete(name="Time after feeding",labels=c("2h","4h","6h","8h","12h","14h","16h","18h","24h","48h"))+
scale_y_continuous(trans="log10",name="Number particles",limits=c(-1,3000))+
annotation_logticks(sides="l",size=1, short = unit(0.25, "cm"), mid = unit(0.5, "cm"), long = unit(0.8,  "cm"))+
labs(tag="b")+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=35),
      axis.text.y=element_text(colour="black",size=35),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key.height=unit(4,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.2.figure.supplement1b

```

### Food passage of fluorescent particles through the digestive tract of _C. floridanus_.

Number of fluorescent particles on a logarithmic scale in the crop (dark blue), midgut (light blue), and hindgut (turquoise) part of the digestive tract of minor (**a**) and major (**b**) ants 2 hr, 4 hr, 6 hr, 8 hr, 12 hr, 14 hr, 16 hr, 18 hr, 24 hr, and 48 hr after feeding them a 1:1 honey-water mix with polymethylmethacrylate (PMM) particles (size ≤40 µm). Note that for displaying purposes and better visibility of zero values a value of one has been added to all datapoints. Points represent the number of counted particles per individual ant and lines connect the median value of particles at the different time points after feeding.
:::
{#fig2s1}

figure: Figure 2—figure supplement 2.
:::
![](elife-60287.rmd.media/fig2-figsupp2.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 2 - figure supplement 2a
fig.2.figure.supplement2a<-ggplot()+
geom_boxplot(data=growth.ecoli.crop,aes(x=time2,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,alpha=0.3,coef=0,width=0.4)+
geom_point(data=growth.ecoli.crop,aes(x=time2,y=cfu.change.relative),pch=21,fill="darkolivegreen",color="white",alpha=1,size=5,position=position_jitter(width=0.1))+
annotate("text",x=c(1,2,3,4,5),y=c(2.5,1.5,1,0.5,0.5),size=9,label=c("a","b","c","d","d"),fontface=2)+#statistical significance 
scale_x_discrete(name="Time",labels=c("0h","0.5h","4h","24h","48h"))+
scale_y_continuous(name="CFU change",limits=c(-0.01,3))+
labs(tag="a")+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15,face="italic"),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      aspect.ratio=1)
fig.2.figure.supplement2a

```
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 2 - figure supplement 2b
fig.2.figure.supplement2b<-ggplot()+
geom_boxplot(data=growth.ecoli.midgut,aes(x=time2,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,alpha=0.3,coef=0,width=0.4)+
geom_point(data=growth.ecoli.midgut,aes(x=time2,y=cfu.change.relative),pch=21,fill="darkolivegreen",color="white",alpha=1,size=5,position=position_jitter(width=0.1))+
annotate("text",x=c(2,3,4,5),y=c(0.02,0.02,0.02,0.02),size=9,label=c("ab","a","a","b"),fontface=2)+
scale_x_discrete(name="Time",labels=c("0h","0.5h","4h","24h","48h"))+
scale_y_continuous(name="CFU change",limits=c(-0.01,0.05))+
labs(tag="b")+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15,face="italic"),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      aspect.ratio=1)
fig.2.figure.supplement2b

```

### Viability of _E. coli_ over time in the digestive tract of _C. floridanus_ over time.

Change in the number of colony forming units (CFUs) in the crop (**a**) and midgut (**b**) part of the digestive tract (yellow color in insert) relative to mean CFU-number at 0 hr in the crop (CFU change corresponds to single data CFU-value divided by the mean CFU-value at 0 hr in the crop), 0 hr, 0.5 hr, 4 hr, 24 hr, and 48 hr after feeding ants 10% honey water contaminated with _Escherichia coli_. (**a**), Change of _E. coli_ in the crop (GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,6],3)`, df = `r anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,7]`, p`r format_pval( myround(anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,8],3))`, same letters indicate p=`r myround(( output.m.growth.ecoli.crop1.glht$test)$pvalues[10],3)` and different letters indicate p&lt;`r myround(( output.m.growth.ecoli.crop1.glht$test)$pvalues[5],3)` in Westfall corrected post hoc comparisons). (**b**), Change of _E. coli_ in the midgut (GLMM, LR-test, χ^2^ = `r myround(anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)[2,6],3)`, df = `r anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)[2,7]`, p=`r  myround(anova(m.growth.ecoli.midgut,m.growth.ecoli.midgut0)[2,8],3)`, same letters indicate p≥`r myround(( output.m.growth.ecoli.midgut.glht$test)$pvalues[3],3)` and different letters indicate p≤`r myround(( output.m.growth.ecoli.midgut.glht$test)$pvalues[1],3)` in Westfall corrected post hoc comparisons). Note that timepoints with zero bacterial growth in the midgut (0 hr) were excluded from the statistical model.
:::
{#fig2s2}

figure: Figure 2—figure supplement 3.
:::
![](elife-60287.rmd.media/fig2-figsupp3.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 2 - figure supplement 3
fig.2.figure.supplement3<-ggplot()+
geom_boxplot(data=serratia.growth.invitro,aes(x=ph,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,position=position_dodge(0.6),alpha=0.6,coef=0,width=0.4)+
geom_point(data=serratia.growth.invitro,aes(x=ph,y=cfu.change.relative,colour=ph),position=position_jitterdodge(dodge=0.6),size=4,alpha=0.8)+
scale_colour_manual(values=c("deeppink1","deeppink1","deeppink1","deeppink1"),name="Raw data",guide=FALSE)+
scale_x_discrete(name="pH of honeywater",labels=c("2","3","4","5"))+
scale_y_continuous(name="CFU change",limits=c(0,1.7))+
annotate("text",x=c(3.5),y=c(1.5),size=16,label=c(expression(paste(italic("P")," < 0.001"))),fontface=2)+#statistical significance 
geom_segment(aes(x = 3, y = 1.4, xend = 4, yend = 1.4),lwd=2)+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=30),
      axis.text.y=element_text(colour="black",size=30),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      legend.position="bottom",
      aspect.ratio=1)
fig.2.figure.supplement3

```

### _S. marcescens_ growth in vitro.

Change in the number of CFUs relative to the mean at pH 5 (CFU change corresponds to single data CFU-value divided by the mean CFU-value at pH 5) after incubation of _Serratia marcescens_ in 10% honey water (pH = 5) or in 10% honey water acidified with commercial formic acid to a pH of 4, 3, or 2 for 2 hr (GLM, LR-test, χ^2^ = `r myround(anova(m.serratia.growth.invitro1,m.serratia.growth.invitro10)[2,7],3)`, df = `r anova(m.serratia.growth.invitro1,m.serratia.growth.invitro10)[2,6]`, p`r format_pval( myround(anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,8],3))`). Note that pH-values with zero bacterial growth (pH 2 and 3) were excluded from the statistical model.
:::
{#fig2s3}

Although in vivo the antimicrobial activity of the natural poison is likely higher than the antimicrobial activity of formic acid, the main component of the formicine poison gland secretion (@bib88; @bib110; @bib128) due to the presence of other components (@bib140), we then tested the ability of _S. marcescens_ to withstand acidic conditions created with formic acid in an in vitro experiment. We found that incubation of _S. marcescens_ for 2 hr in 10% honey water acidified with formic acid to pH 4 resulted in a significantly lower number of CFUs relative to pH 5 and in zero growth for incubations at pH-levels that were lower than 4 ([Figure 2—figure supplement 3](#fig2s3); GLM, LR-test, χ^2^ = `r myround(anova(m.serratia.growth.invitro1,m.serratia.growth.invitro10)[2,7],3)`, df = `r anova(m.serratia.growth.invitro1,m.serratia.growth.invitro10)[2,6]`, p`r format_pval( myround(anova(m.growth.ecoli.crop,m.growth.ecoli.crop0)[2,8],3))`). Our data thus indicate that poison acidified crops can indeed serve microbial control in formicine ants, likely inhibiting bacteria according to their ability to cope with acidic environments (@bib89).

## Access to the poison improves survival upon ingestion of pathogen contaminated food
```{r echo=FALSE,warning=FALSE,message=FALSE,results='hide',fig.show='hide'}
######################################################################################################
############################### Fig 3: Individual survival ###########################################
######################################################################################################


#############loading data for Fig.3
survival<-read.delim("https://datadryad.org/stash/downloads/file_stream/708519",header=T)#choose data file: Supplementary Data Fig.3.txt
str(survival)


#############statistcal analysis for Fig.3
m.survival<-coxme(Surv(time.death.hours,status)~treatment+(1|experiment.block)+(1|colony),data=survival)
print(m.survival)

#significance of predictor ant treatment (four levels: Serratia- FA-, Serratia- FA+, Serratia-+FA-, Serratia+ FA+)
m.survival0<-coxme(Surv(time.death.hours,status)~1+(1|experiment.block)+(1|colony),data=survival)
anova(m.survival,m.survival0)

#post-hoc comporisons of predictor-levels ant treatment
m.survival.glht<-glht(m.survival,linfct=mcp(treatment="Tukey"))
output.m.survival.glht<-summary(m.survival.glht,test=adjusted("Westfall"))
output.m.survival.glht
```

To test whether acidic crops also provide a fitness benefit upon ingestion of pathogen contaminated food, we prevented acidopore grooming through immobilization in _C. floridanus_ ants for 24 hr after feeding them once with 5 µL of either _S. marcescens_ contaminated honey water or non-contaminated honey water and monitored their survival thereafter without providing additional food. We found that acidopore access after pathogen ingestion significantly increased the survival probability of ants ([Figure 3](#fig3); COXME, LR-test, χ^2^ = `r myround(anova(m.survival,m.survival0)[2,2],3)`, df = `r anova(m.survival,m.survival0)[2,3]`, p=`r  myround(anova(m.survival,m.survival0)[2,4],4)`). The survival of ants prevented from acidopore grooming and fed once with the pathogen contaminated food was significantly lower than that of non-prevented ants fed the same food source (Westfall corrected post-hoc comparisons: FA - | _Serratia_ presence + versus. all other ant groups: p≤`r myround(( output.m.survival.glht$test)$pvalues[6],3)`). In contrast, non-prevented ants fed once with the pathogen contaminated food source did not differ in survival to prevented and non-prevented ants fed the non-contaminated food source (Westfall corrected post-hoc comparisons: FA + | _Serratia_ presence + versus. FA + | _Serratia_ presence – and FA + | _Serratia_ presence + versus. FA + | _Serratia_ presence –: p≥`r myround(( output.m.survival.glht$test)$pvalues[1],3)` for both comparisons). Although we observed an overall high mortality in this experimental setup, likely due to starvation following the one time feeding in combination with social isolation of individually kept ants (@bib81; @bib83; @bib135), this result indicates that poison acidified crop lumens provide a fitness benefit in terms of survival to formicine ants upon ingestion of pathogen contaminated food.

figure: Figure 3.
:::
![](elife-60287.rmd.media/fig3.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 3 
fig.3<-ggplot(survival,aes(time=time.death.hours,status=status,linetype=treatment,colour=treatment))+
geom_km(lwd=2)+
scale_colour_manual(values=c("grey","grey","black","black"),name="Animal treatment",label=c("Serratia- | FA-","Serratia- | FA+","Serratia+ | FA-","Serratia+ | FA+"))+
scale_linetype_manual(values=c("solid","dashed","solid","dashed"),name="Animal treatment",labels=c("Serratia- | FA-","Serratia- | FA+","Serratia+ | FA-","Serratia+ | FA+"))+
scale_x_continuous(name="Time after feeding [h]",limits=c(0,160),breaks=seq(0,120,24))+
scale_y_continuous(name="Proportion survival",limits=c(0,1))+
geom_segment(aes(x=140,y=0.12,xend=150,yend=0.12),lwd=1.5,col="grey",lty=2)+
geom_segment(aes(x=140,y=0.10,xend=150,yend=0.10),lwd=1.5,col="black",lty=2)+
geom_segment(aes(x=140,y=0.08,xend=150,yend=0.08),lwd=1.5,col="grey",lty=1)+
geom_segment(aes(x=140,y=0.00,xend=150,yend=0.00),lwd=1.5,col="black",lty=1)+
annotate("text",x=c(155,155),y=c(0.105,0.005),size=10,label=c("a","b"),fontface=2)+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.5,"cm"),
      legend.key=element_blank(),
      legend.position=c(0.8,0.8),
      aspect.ratio=1)
fig.3


```

### Survival after ingestion of pathogen contaminated food.

Survival of individual _C. floridanus_ ants that were either prevented to ingest the formic acid containing poison gland secretion (FA-; ant outlines with blue dot) or not (FA+) after feeding them once either honey water contaminated with _Serratia marcescens_ (_Serratia_+, yellow circle with pink dots and black ant outlines) or non-contaminated honey water (_Serratia_-) without providing food thereafter (COXME, LR-test, χ^2^ = `r myround(anova(m.survival,m.survival0)[2,2],3)`, df = `r anova(m.survival,m.survival0)[2,3]`, p=`r  myround(anova(m.survival,m.survival0)[2,4],4)`, same letters indicate p≥`r myround(( output.m.survival.glht$test)$pvalues[1],3)` and different letters indicate p≤`r myround(( output.m.survival.glht$test)$pvalues[6],3)` in Westfall corrected post hoc comparisons).
:::
{#fig3}

## Access to the poison in donor ants also benefits receiver ants without poison access after food exchange via trophallaxis
```{r echo=FALSE,warning=FALSE,message=FALSE,results='hide',fig.show='hide'}
######################################################################################################
#################################### Fig 4: Survival trophallaxis ####################################
######################################################################################################


#############loading data for Fig.4
survival.trophallaxis<-read.delim("https://datadryad.org/stash/downloads/file_stream/708520",header=T)#choose data file: Supplementary Data Fig.4.txt
str(survival)


#############statistical analysis for Fig. 4
m.survival.trophallaxis<-coxme(Surv(time.death,status.death)~treatment+(1|colony)+(1|experiment.block)+(1|petridish),data=survival.trophallaxis)
print(m.survival.trophallaxis)

#significance of predictor ant treatment (four levels: donor FA+, donor FA-, receiver FA+, receiver FA-)
m.survival.trophallaxis0<-coxme(Surv(time.death,status.death)~1+(1|colony)+(1|experiment.block)+(1|petridish),data=survival.trophallaxis)
anova(m.survival.trophallaxis,m.survival.trophallaxis0)

#post-hoc comparisons of predictor-levels ant treatment
m.survival.trophallaxis.glht<-glht(m.survival.trophallaxis,linfct=mcp(treatment="Tukey"))
output.m.survival.trophallaxis.glht<-summary(m.survival.trophallaxis.glht,test=adjusted("Westfall"))
output.m.survival.trophallaxis.glht

#hazard ratios between predictor-levels ant treatment through releveling of predictor
treatment1<-factor(survival.trophallaxis$treatment,levels=c("receiverFA+","receiverFA-","donorFA+","donorFA-"))
treatment2<-factor(survival.trophallaxis$treatment,levels=c("donorFA+","receiverFA+","receiverFA-","donorFA-"))
treatment3<-factor(survival.trophallaxis$treatment,levels=c("receiverFA-","receiverFA+","donorFA+","donorFA-"))
m.survival.trophallaxis1<-coxme(Surv(time.death,status.death)~treatment1+(1|colony)+(1|experiment.block)+(1|petridish),data=survival.trophallaxis)
print(m.survival.trophallaxis1)
m.survival.trophallaxis2<-coxme(Surv(time.death,status.death)~treatment2+(1|colony)+(1|experiment.block)+(1|petridish),data=survival.trophallaxis)
print(m.survival.trophallaxis2)
m.survival.trophallaxis3<-coxme(Surv(time.death,status.death)~treatment3+(1|colony)+(1|experiment.block)+(1|petridish),data=survival.trophallaxis)
print(m.survival.trophallaxis3)



#####################################################################################################
######################### Fig.4 - figure supplement 1: trophallaxis behavior ########################
#####################################################################################################


#############loading data for Fig.4 - figure supplement 1
trophallaxis<-read.delim("https://datadryad.org/stash/downloads/file_stream/708521",header=T)#choose file: Supplementary Data Fig.4 - figure supplement 1.txt
str(trophallaxis)


#############statistcal analysis for Fig.4 - figure supplement 1
m.duration.trophallaxis<-lmer(sqrt(sum.duration.trophallaxis)~ant.pair+(1|colony)+(1|experimental.block),data=trophallaxis)
summary(m.duration.trophallaxis)

#model validation
res.m.duration.trophallaxis<-simulateResiduals(fittedModel=m.duration.trophallaxis)
plot(res.m.duration.trophallaxis)

#significance of predictor food treatment (three levels: unfed, water, honey)
m.duration.trophallaxis0<-lmer(sqrt(sum.duration.trophallaxis)~1+(1|colony)+(1|experimental.block),data=trophallaxis)
anova(m.duration.trophallaxis,m.duration.trophallaxis0)
```

The ability to swallow the acidic poison may not only improve survival of formicine ants feeding directly on pathogen contaminated food but also of ants that share the contaminated food via trophallaxis. To test this, we created two types of donor-receiver ant pairs. Donor ants in both pairs were directly fed _S. marcescens_ contaminated food every other day, while receiver ants obtained food only through trophallaxis from their respective donor ants. Receiver ants in both pairs were precluded from swallowing of the poison through blockage of their acidopore opening, while donor ants were blocked in one pair but only sham blocked in the other pair. We found that the duration of trophallaxis between the two donor-receiver ant pairs during the first 30 min. of the first feeding bout did not significantly differ ([Figure 4—figure supplement 1](#fig4s1); LMM, LR-test, χ^2^ = `r myround(anova(m.duration.trophallaxis,m.duration.trophallaxis0)[2,6],3)`, df = `r anova(m.duration.trophallaxis,m.duration.trophallaxis0)[2,7]`, p=`r  myround(anova(m.duration.trophallaxis,m.duration.trophallaxis0)[2,8],3)`), indicating that trophallactic behavior was not influenced through acidopore blockage in donor ants at the beginning of the experiment. Over the next 12 d, we found that acidopore blockage per se had a significant negative effect on the survival of donor as well as receiver ants ([Figure 4](#fig4); COXME, LR-test, χ^2^ = `r myround(anova(m.survival.trophallaxis,m.survival.trophallaxis0)[2,2],3)`, df = `r anova(m.survival.trophallaxis,m.survival.trophallaxis0)[2,3]`, p`r format_pval( myround(anova(m.survival.trophallaxis,m.survival.trophallaxis0)[2,4],3))`). However, although receiver ants that obtained food every other day from donors with the ability to swallow the poison died at a higher rate than their respective donor counterparts (hazard ratio: `r round(exp(m.survival.trophallaxis2$coefficients)[1],2)`; Westfall corrected post-hoc comparison: p`r format_pval(myround((output.m.survival.trophallaxis.glht$test)$pvalues[5],3))`) they were only half as likely to die compared to receiver ants that obtained pathogen contaminated food from blocked donors unable to swallow their poison (hazard ratio: `r round(exp(m.survival.trophallaxis3$coefficients)[1],2)`; Westfall corrected post-hoc comparison: p`r format_pval(myround((output.m.survival.trophallaxis.glht$test)$pvalues[6],3))`). This indicates that swallowing of the poison and the ensuing crop acidity also provides a fitness benefit to other members of a formicine ant society.


figure: Figure 4.
:::
![](elife-60287.rmd.media/fig4.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 4
fig.4<-ggplot(survival.trophallaxis,aes(time=time.death,,status=status.death,linetype=treatment,colour=treatment))+
geom_km(lwd=2)+
scale_colour_manual(values=c("grey","grey","black","black"),name="Animal:",labels=c("donor FA-","donor FA+","receiver FA- with\ndonor FA-","receiver FA- with\ndonor FA+"))+
scale_linetype_manual(values=c("dashed","solid","dashed","solid"),name="Animal:",label=c("donor FA-","donor FA+","receiver FA- with\ndonor FA-","receiver FA- with\ndonor FA+"))+
scale_x_continuous(name="Time in days",breaks=seq(0,14,2))+
scale_y_continuous(name="Proportion survival",limits=c(0,1))+
annotate("text",x=c(12.5,12.5,12.5,12.5),y=c(0.26,0.17,0.1,0.06),size=10,label=c("a","b","c","c"),fontface=2)+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.5,"cm"),
      legend.key=element_blank(),
      legend.position=c(0.8,0.8),
      aspect.ratio=1)
fig.4

```

### Survival after sharing pathogen contaminated food via trophallaxis.

Survival of donor ants (light gray ant outlines) that were directly fed with pathogen contaminated food (yellow circle with pink dots in insert) every other day and were either prevented to ingest their formic acid containing poison gland secretion (FA-; ant outlines with blue dot) or not (FA+) and survival of receiver ants (black ant outlines) that received pathogen contaminated food only through trophallaxis with donor ants and were always prevented to ingest their formic acid containing poison gland secretion (FA-) (COXME, LR-test, χ^2^ = `r myround(anova(m.survival.trophallaxis,m.survival.trophallaxis0)[2,2],3)`, df = `r anova(m.survival.trophallaxis,m.survival.trophallaxis0)[2,3]`, p`r format_pval( myround(anova(m.survival.trophallaxis,m.survival.trophallaxis0)[2,4],3))`, same letters indicate p=`r myround((output.m.survival.trophallaxis.glht$test)$pvalues[2],3)`) and different letters indicate p≤`r myround((output.m.survival.trophallaxis.glht$test)$pvalues[3],3)`) in Westfall corrected post hoc comparisons).
:::
{#fig4}

figure: Figure 4—figure supplement 1.
:::
![](elife-60287.rmd.media/fig4-figsupp1.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
fig.4.figure.supplement1<-ggplot()+
geom_boxplot(data=trophallaxis,mapping=aes(x=ant.pair,y=sum.duration.trophallaxis,fill=ant.pair),outlier.shape=NA,lwd=1.5,width=0.4,coef=0)+
geom_point(data=trophallaxis,mapping=aes(x=ant.pair,y=sum.duration.trophallaxis,color=ant.pair),position=position_jitter(width=0.1),size=4,alpha=0.9)+
scale_fill_manual(values=c("white","white"),name="Animal pairing:",labels=c("donorFA- receiverFA-","donorFA+ receiverFA-"),guide=FALSE)+
scale_colour_manual(values=c("deeppink1","deeppink1"),name="Raw data:",labels=c("no","yes"),guide=FALSE)+
scale_x_discrete(name="Animal pairing",labels=c("donorFA- receiverFA-","donorFA+ receiverFA-"))+
scale_y_continuous(name="Duration trophallaxis [s]",limits=c(-5,1800),breaks=seq(0,1800,200))+
geom_segment(aes(x = 1, y = 1750, xend = 2, yend = 1750),lwd=2)+
annotate("text",x=c(1.5),y=c(1800),size=10,label=c(expression(paste(italic("P")," = 0.268"))),fontface=2)+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=20),
      axis.text.y=element_text(colour="black",size=20),
      axis.title.x=element_text(colour="black",size=25,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=25,margin=margin(0,22,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      legend.position="right")
fig.4.figure.supplement1
```

### Duration of trophallaxis in donor-receiver ant pairs.

Total duration of trophallaxis events within 30 min. of the first bout of food exchange between donor-receiver ant-pairs (LMM, LR-test, χ^2^ = `r myround(anova(m.duration.trophallaxis,m.duration.trophallaxis0)[2,6],3)`, df = `r anova(m.duration.trophallaxis,m.duration.trophallaxis0)[2,7]`, p=`r  myround(anova(m.duration.trophallaxis,m.duration.trophallaxis0)[2,8],3)`). Donor ants in both pairs were directly fed with _Serratia marcescens_ contaminated 10% honey water and were either prevented to ingest their formic acid containing poison gland secretion (FA-) or not (FA+), while receiver ants received pathogen contaminated food only through trophallaxis with the respective donor ants and were always prevented to ingest their formic acid containing poison gland secretion (FA-).
:::
{#fig4s1}

## Poison acidified crops allow members of the bacteria family Acetobacteraceae passage to the midgut
```{r echo=FALSE,warning=FALSE,message=FALSE,results='hide',fig.show='hide'}
######################################################################################################
################################ Fig 5 a,b: Asaia viability in vivo ##################################
######################################################################################################


#############loading data for Fig.5a,b
growth.asaia<-read.delim("https://datadryad.org/stash/downloads/file_stream/708522",header=T)#choose data file: Supplementary Data Fig.5a,b.txt
str(growth.asaia)

#create factor variable time2 from the continuous variable time
growth.asaia$time2<-as.factor(growth.asaia$time)

#subsetting the data frame into two groups (growth.asaia.crop, growth.asaia.midgut)
growth.asaia.crop<-subset(growth.asaia,gutregion=="crop")
growth.asaia.crop<-drop.levels(growth.asaia.crop)
growth.asaia.midgut<-subset(growth.asaia,gutregion=="midgut")
growth.asaia.midgut<-drop.levels(growth.asaia.midgut)

#calculation of median values and confidence intervals of change in CFUs relative to 0h in the crop
growth.asaia.summary<-ddply(growth.asaia,c("gutregion","time"),summarise,
N=length(cfu.change.relative),
median=quantile(cfu.change.relative,0.5),
lowerCI=quantile(cfu.change.relative,0.025),
upperCI=quantile(cfu.change.relative,0.975))
growth.asaia.summary

#removal of time factor levels 0h in the midgut of asaia fed ants, as this level consisted only of zeros and is not included in the statistical analysis
growth.asaia.midgut1<-subset(growth.asaia.midgut,time2!="0")
growth.asaia.midugt1<-drop.levels(growth.asaia.midgut1)


#############statistical analysis Fig. 5a
m.growth.asaia.crop<-glmmTMB(cfu~time2+(1|colony),data=growth.asaia.crop,ziformula=~1,family=nbinom2)
summary(m.growth.asaia.crop)

#model validation
res.m.growth.asaia.crop<-simulateResiduals(fittedModel=m.growth.asaia.crop)
plot(res.m.growth.asaia.crop)

#statistical significance of predictor time since feeding (five levels: 0h, 0.5h, 4h, 24h, 48h)
m.growth.asaia.crop0<-glmmTMB(cfu~1+(1|colony),data=growth.asaia.crop,ziformula=~1,family=nbinom2)
anova(m.growth.asaia.crop,m.growth.asaia.crop0)

#post-hoc comporisons of predictor-levels time since feeding
m.growth.asaia.crop.glht<-glht(m.growth.asaia.crop,linfct=mcp(time2="Tukey"))
output.m.growth.asaia.crop.glht<-summary(m.growth.asaia.crop.glht,test=adjusted("Westfall"))
output.m.growth.asaia.crop.glht


#############statistical analysis Fig. 5b
m.growth.asaia.midgut<-glmmTMB(cfu~time2+(1|colony),data=growth.asaia.midgut1,ziformula=~1,family=nbinom1)
summary(m.growth.asaia.midgut)

#model validation
res.m.growth.asaia.midgut<-simulateResiduals(fittedModel=m.growth.asaia.midgut)
plot(res.m.growth.asaia.midgut)

#statistical significance of predictor time since feeding (four levels: 0.5h, 4h, 24h, 48h)
m.growth.asaia.midgut0<-glmmTMB(cfu~1+(1|colony),data=growth.asaia.midgut1,ziformula=~1,family=nbinom1)
anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)

#post-hoc comporisons of predictor-levels time since feeding
m.growth.asaia.midgut.glht<-glht(m.growth.asaia.midgut,linfct=mcp(time2="Tukey"))
output.m.growth.asaia.midgut.glht<-summary(m.growth.asaia.midgut.glht,test=adjusted("Westfall"))
output.m.growth.asaia.midgut.glht



######################################################################################################
##################### Fig. 5 - figure supplement 1: Asaia growth in vitro ############################
######################################################################################################


#############loading data for Fig. 5 - figure supplement 1
asaia.growth.invitro<-read.delim("https://datadryad.org/stash/downloads/file_stream/708523",header=T)#choose file: Supplementary Data Fig. 5 - figure supplement 1.txt
str(asaia.growth.invitro)

#calculation of median values and confidence intervals of change in CFUs relative to pH 5
asaia.growth.invitro.summary<-ddply(asaia.growth.invitro,c("ph"),summarize,
median.cfu.change=quantile(cfu.change.relative,0.5),
lowerCI.cfu.change=quantile(cfu.change.relative,0.025),
upperCI.cfu.change=quantile(cfu.change.relative,0.975))
asaia.growth.invitro.summary

#removal of pH level 2 from asaia.growth.invitro, as this level consisted only of zeros
asaia.growth.invitro1<-subset(asaia.growth.invitro,ph!="pH2")
asaia.growth.invitro1<-drop.levels(asaia.growth.invitro1)
str(asaia.growth.invitro1)


#############statistical analysis Fig. 5 - figure supplement 1
m.asaia.growth.invitro1<-glm.nb(cfu~ph,data=asaia.growth.invitro1)
summary(m.asaia.growth.invitro1)

#model validation
res.m.asaia.growth.invitro1<-simulateResiduals(fittedModel=m.asaia.growth.invitro1)
plot(res.m.asaia.growth.invitro1)

#statistical significance of predictor pH-level (two levels: pH5, pH4)
m.asaia.growth.invitro10<-glm.nb(cfu~1,data=asaia.growth.invitro1)
anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)

#post-hoc comparison among predictor levels of pH (three levels: pH5, pH4, pH3)
m.asaia.growth.invitro1.glht<-glht(m.asaia.growth.invitro1,linfct=mcp(ph="Tukey"))
output.m.asaia.growth.invitro1.glht<-summary(m.asaia.growth.invitro1.glht,test=adjusted("Westfall"))
output.m.asaia.growth.invitro1.glht
```

In addition to microbial control, poison acidified formicine ant crops might act as a chemical filter for gut-associated microbial communities, similar to gut morphological structures that can act as mechanical filters in ants (@bib25; @bib51; @bib85; @bib87; @bib117) and other insects (@bib71; @bib107). To investigate the idea of a chemical filter, we tested the ability of the insect gut-associated bacterium _Asaia_ sp. (family Acetobacteraceae) (@bib34; @bib44) to withstand acidic environments in vitro and in vivo. In contrast to _S. marcescens_ ([Figure 2—figure supplement 2](#fig2s2)), _Asaia_ sp. was not affected by an incubation for 2 hr in 10% honey water acidified with formic acid to pH 4 and was still able to grow when incubated at pH 3 in in vitro tests ([Figure 5—figure supplement 1](#fig5s1); GLM, overall LR-test χ^2^ = `r myround(anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)[2,7],3)`, df = `r anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)[2,6]`, p`r format_pval( myround(anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)[2,8],3))`; Westfall corrected post hoc comparisons: pH = 5 versus. pH = 4: p=`r myround((output.m.asaia.growth.invitro1.glht$test)$pvalues[3],3)`, all other comparisons: p`r format_pval(myround((output.m.asaia.growth.invitro1.glht$test)$pvalues[1],3))`). Moreover, in in vivo tests, _Asaia_ sp. only gradually diminished over time in the crop ([Figure 5a](#fig5); GLMM; LR-test, χ^2^ = `r myround(anova(m.growth.asaia.crop,m.growth.asaia.crop0)[2,6],3)`, df = `r anova(m.growth.asaia.crop,m.growth.asaia.crop0)[2,7]`, p`r  format_pval(myround(anova(m.growth.asaia.crop,m.growth.asaia.crop0)[2,8],3))`) with the proportion of CFUs that we were able to retrieve from the crop relative to the mean at 0 hr in the crop diminishing to only `r round(growth.asaia.summary[3,4]*100)`% (median, CI: `r round(growth.asaia.summary[3,5]*100)`–`r round(growth.asaia.summary[3,6]*100)`%) and `r round(growth.asaia.summary[4,4]*100)`% (CI: `r round(growth.asaia.summary[4,5]*100)`–`r round(growth.asaia.summary[4,6]*100)`%) at 4 hr and 24 hr post-feeding, respectively. At the same time, relative to the mean at 0 hr in the crop, _Asaia_ sp. steadily increased in the midgut ([Figure 5b](#fig5); GLMM; LR-test, χ^2^ = `r myround(anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)[2,6],3)`, df = `r anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)[2,7]`, p`r  format_pval(myround(anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)[2,8],3))`) from its initial absence at 0 hr post-feeding to `r round(growth.asaia.summary[10,4]*100)`% (median, CI: `r round(growth.asaia.summary[10,5]*100)`–`r round(growth.asaia.summary[10,6]*100)`%) at 48 hr post-feeding. This suggests that in formicine ants, poison acidified crops might act as a chemical filter that works selectively against the establishment of opportunistic and potentially harmful bacteria but allows entry and establishment of members of the bacterial family Acetobacteraceae.


figure: Figure 5.
:::
![](elife-60287.rmd.media/fig5.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 5a
fig.5a<-ggplot()+
geom_boxplot(data=growth.asaia.crop,aes(x=time2,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,alpha=0.3,coef=0,width=0.4)+
geom_point(data=growth.asaia.crop,aes(x=time2,y=cfu.change.relative),pch=21,fill="grey70",color="white",alpha=1,size=5,position=position_jitter(width=0.1))+
annotate("text",x=c(1,2,3,4,5),y=c(3,3,1.7,0.8,0.5),size=9,label=c("a","a","b","c","d"),fontface=2)+#statistical significance 
scale_x_discrete(name="Time",labels=c("0h","0.5h","4h","24h","48h"))+
scale_y_continuous(name="CFU change",limits=c(-0.01,4))+
labs(tag="a")+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15,face="italic"),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      aspect.ratio=1)
fig.5a

```
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 5b
fig.5b<-ggplot()+
geom_boxplot(data=growth.asaia.midgut,aes(x=time2,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,alpha=0.3,coef=0,width=0.4)+
geom_point(data=growth.asaia.midgut,aes(x=time2,y=cfu.change.relative),pch=21,fill="grey70",color="white",alpha=1,size=5,position=position_jitter(width=0.1))+
annotate("text",x=c(2,3,4,5),y=c(0.02,0.02,0.03,0.065),size=9,label=c("a","a","b","c"),fontface=2)+
scale_x_discrete(name="Time",labels=c("0h","0.5h","4h","24h","48h"))+
scale_y_continuous(name="Change in CFU's",limits=c(-0.01,0.065))+
labs(tag="b")+
theme(axis.line = element_line(colour = "black",size=2),
      axis.ticks=element_line(colour="black",size=2),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=25),
      axis.text.y=element_text(colour="black",size=25),
      axis.title.x=element_text(colour="black",size=30,margin=margin(25,0,0,0)),
      axis.title.y=element_text(colour="black",size=30,margin=margin(0,25,0,0)),
      plot.tag=element_text(colour="black",size=60,face="bold"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15,face="italic"),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      aspect.ratio=1)
fig.5b

```

### Viability of _Asaia sp_. over time in the digestive tract of _C. floridanus_.

Change in the number of colony forming units (CFUs) in the crop (**a**) and midgut (**b**) part of the digestive tract (yellow color in insert) relative to the mean CFU-number at 0 hr in the crop (CFU change corresponds to single data CFU-values divided by mean CFU-value at 0 hr in the crop), 0 hr, 0.5 hr, 4 hr, 24 hr, and 48 hr after feeding ants 10% honey water contaminated with _Asaia_ sp. (**a**), Change of _Asaia_ sp. in the crop (GLMM; LR-test, χ^2^ = `r myround(anova(m.growth.asaia.crop,m.growth.asaia.crop0)[2,6],3)`, df = `r anova(m.growth.asaia.crop,m.growth.asaia.crop0)[2,7]`, p`r  format_pval(myround(anova(m.growth.asaia.crop,m.growth.asaia.crop0)[2,8],3))`, same letters indicate p=`r myround((output.m.growth.asaia.crop.glht$test)$pvalues[1],3)` and different letters indicate p≤`r myround((output.m.growth.asaia.crop.glht$test)$pvalues[5],3)` in Westfall corrected post hoc comparisons). (**b**), Change of _Asaia_ sp. in the midgut (GLMM; LR-test, χ^2^ =`r myround(anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)[2,6],3)`, df = `r anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)[2,7]`, p`r  format_pval(myround(anova(m.growth.asaia.midgut,m.growth.asaia.midgut0)[2,8],3))`, same letters indicate p=`r myround((output.m.growth.asaia.midgut.glht$test)$pvalues[1],3)` and different letters indicate p≤`r myround((output.m.growth.asaia.midgut.glht$test)$pvalues[4],3)` in Westfall corrected post hoc comparisons). Note that timepoints with zero bacterial growth in the midgut (0 hr) were excluded from the statistical model.
:::
{#fig5}

figure: Figure 5—figure supplement 1.
:::
![](elife-60287.rmd.media/fig5-figsupp1.jpg)
```{r echo=FALSE,warning=FALSE,message=FALSE,fig.height=10,fig.width=10,out.height=800,out.width=800}
#############plot Fig. 5 - figure supplement 1
fig.5.figure.supplement1<-ggplot()+
geom_boxplot(data=asaia.growth.invitro,aes(x=ph,y=cfu.change.relative),fill="white",outlier.shape=NA,lwd=1.5,position=position_dodge(0.6),alpha=0.6,coef=0,width=0.4)+
geom_point(data=asaia.growth.invitro,aes(x=ph,y=cfu.change.relative,colour=ph),position=position_jitterdodge(dodge=0.6),size=4,alpha=0.8)+
scale_colour_manual(values=c("grey40","grey40","grey40","grey40"),name="Raw data:",guide=FALSE)+
annotate("text",x=c(2,3,4),y=c(0.9,1.4,1.4),size=9,label=c("b","a","a"),fontface=2)+#statistical significance 
scale_x_discrete(name="pH of honeywater",labels=c("2","3","4","5"))+
scale_y_continuous(name="CFU change",limits=c(0,1.7))+
theme(axis.line = element_line(colour = "black",size=1.5),
      axis.ticks=element_line(colour="black",size=1.5),
      axis.ticks.length=unit(0.3,"cm"),
      axis.text.x=element_text(colour="black",size=30),
      axis.text.y=element_text(colour="black",size=30),
      axis.title.x=element_text(colour="black",size=40,margin=margin(20,0,0,0)),
      axis.title.y=element_text(colour="black",size=40,margin=margin(0,22,0,0)),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank(),
      legend.title=element_text(size=15),
      legend.text=element_text(size=15),
      legend.key.size=unit(1.2,"cm"),
      legend.key=element_blank(),
      legend.position="bottom",
      aspect.ratio=1)
fig.5.figure.supplement1

```

### _Asaia sp_. growth in vitro.

Change in the number of CFUs relative to the mean at pH 5 (CFU change corresponds to single data CFU-value divided by mean CFU-value at pH 5) after incubation of _Asaia_ sp. in 10% honey water (pH = 5) or in 10% honey water acidified with commercial formic acid to a pH of 4, 3, or 2 for 2 hr (GLM, LR-test χ^2^ = `r myround(anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)[2,7],3)`, df = `r anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)[2,6]`, p`r format_pval( myround(anova(m.asaia.growth.invitro1,m.asaia.growth.invitro10)[2,8],3))`, same letters indicate p=`r myround((output.m.asaia.growth.invitro1.glht$test)$pvalues[3],3)`, and different letters indicate p`r format_pval(myround((output.m.asaia.growth.invitro1.glht$test)$pvalues[1],3))` in Westfall corrected post hoc comparisons). Note that pH-values with zero bacterial growth (pH 2) were excluded from the statistical model.
:::
{#fig5s1}

# Discussion

In this study, we investigated how formicine ants solve the challenge to control harmful microbes in their food while at the same time allowing acquisition and transmission of beneficial microbes from and with their food. We found that formicine ants swallow their antimicrobial, highly acidic poison gland secretion during the behavior of acidopore grooming. The resulting acidic environment in their stomach, the crop, can protect formicine ants from food borne bacterial pathogens while at the same time allowing the acquisition and establishment of members of the bacterial family Acetobacteraceae, a recurring part of the gut microbiota of formicine ants.

Highly acidic stomach lumens are ubiquitous in higher vertebrates, including amphibians, reptiles, birds and mammals (@bib7; @bib80). In insects, highly acidic gut regions have so far only rarely been described from the midgut (@bib28; @bib66). The mechanisms responsible for the creation of a gut lumen compartment with a certain pH are often unknown in insects (@bib57), but in principle, highly acidic gut regions in insects may, similar to vertebrates (@bib60), be generated through physiological mechanisms (@bib93; @bib96; @bib109). Alternatively, acidic derivatives of gut-associated microbes (@bib122, @bib123, @bib149) or acidic gland secretions (@bib11; @bib100; @bib143) might contribute to the insect gut pH. In agreement with the latter, the results of our study show that formicine ants maintain a highly acidic baseline pH in their stomach, the crop, through swallowing of their poison gland secretion during acidopore grooming. Interestingly, although we found that a higher crop acidity was observed in all formicine ants in our comparative survey when they had access to their poison, we also found that crop acidity was highly variable in ants with and without access to their poison. While a variable crop acidity in ants without access to their poison could indicate the existence of additional internal or external sources that maintain crop acidity, a variable crop acidity in ants with access to their poison could indicate species specific differences in acidopore grooming, in the composition of the poison gland secretion or in optimal crop acidity. Future studies will need to explore these possibilities.

Sanitation of food through the addition of organic acids or through acidic fermentation is frequently practiced by humans (@bib29; @bib64; @bib139) and sanitation of food with antimicrobials from different sources is ubiquitous in animals that provision food to their offspring or that store, cultivate, develop or live in food (@bib35; @bib62; @bib63; @bib74; @bib102; @bib144). A microbial control function of poison acidified crops in formicine ants to sanitize ingested food is supported by our survival experiments and our in vivo and in vitro bacterial growth and viability experiments. There we found that access to the poison improved survival of formicine ants after feeding on pathogen contaminated food. We also found that pathogenic and opportunistic bacteria were quickly inhibited in the crop when ingested with food and could not establish in the midgut. Although our data suggests that this is likely due to the sensitivity of these bacteria to acidic environments, our evidence for this is only indirect. At present it is unclear whether the acidic environment in the crop is sufficient to protect formicine ants and to inhibit pathogenic and opportunistic microbes ingested with food or whether acidic conditions act in concert with other factors. Studies in vertebrates and the fruit fly _Drosophila melanogaster_ have shown that acidic gut regions together with immune system effectors serve microbial control and prevent infection by oral pathogens (@bib50; @bib68; @bib92; @bib113; @bib119; @bib133; @bib136; @bib147). Concordantly, previous studies investigating formicine ant trophallactic fluids @bib55; @bib86 found the presence of proteins related to cathepsin D, a lysosomal aspartic protease that can exhibit antibacterial effector activity and the proteolytic production of antimicrobial peptides (@bib105). Future studies will therefore need to disentangle the relative contributions of crop acidity and immune system effectors released into the gut lumen to the improved survival of formicine ants in the face of pathogen contaminated food and to the microbe inhibitory action of poison acidified crops in formicine ants.

In addition to improving their own survival, the ability of donor ants to access their poison also improved the survival of receiver ants without access to their poison following trophallactic exchange of pathogen-contaminated food. Acidic crop lumens might therefore act as a barrier to disease spread in formicine ant societies, alleviating the cost of sharing pathogen contaminated food (@bib108; @bib125) and counteracting the generally increased risk of pathogen exposure and transmission associated with group-living (@bib1; @bib13; @bib75). Although food distribution via trophallaxis is a dynamic process governed by many different factors (@bib22; @bib23; @bib52; @bib130), the technological advances in recent years to track multiple individuals of a group simultaneously over time (@bib49; @bib52; @bib69; @bib134), will make it possible to clarify the contribution of acidic crop lumens to disease spread prevention in formicine ant societies.

Acidic crop lumens might not only serve microbial control but might also act as a chemical filter for microbes, working selectively against pathogenic or opportunistic bacteria but allowing entry and establishment of species from the bacteria family Acetobacteraceae. We found that, compared to a bacterial pathogen, a bacterial member of the Acetobacteraceae was not only better able to withstand acidic conditions created with formic acid in vitro but was able to establish itself in the midgut of formicine ants in vivo. This suggests that host filtering of microbes (@bib94) via acidic crop lumens might explain at least part of the recurrent presence of Acetobacteraceae in the gut of formicine ants and the otherwise reduced microbial diversity and abundance of gut-associated microbes in formicine ants (@bib18; @bib19; @bib31; @bib32; @bib72; @bib124).

Though not formally established (see @bib103), recent studies indicate a mutualistic relationship between formicine ants, and their gut-associated Acetobacteraceae (@bib19; @bib32). Thus, the creation of an acidic crop environment in formicine ants that is easier to endure if colonizing microbes are mutualists agrees with the concept of screening as a mechanism to choose microbial partners out of a pool of environmental microbes (@bib3; @bib4; @bib9; @bib127). Contrary to signalling, where costly information is displayed to partners, in screening a costly environment is imposed on partners that excludes all but high-quality ones. Partner choice in a number of cross-kingdom mutualisms is readily explained by screening (see examples in @bib3; @bib4; @bib9; @bib127) but experimental evidence is so far limited in insect-microbe associations (@bib70; @bib71; @bib120). Although our experiments can only hint at screening as a means of partner choice in formicine ants, the results of our study would provide support for the prediction that screening is more likely to evolve from a host’s defense trait against parasites (@bib3; @bib4), that is, the highly acidic, antimicrobial poison that creates a selective environment for microbes. Our study might therefore not only provide evidence that the well-established cross talk between the immune system and gut-associated microbes in vertebrates and invertebrates (@bib30; @bib119; @bib133; @bib147; @bib150) can hold for a broader range of immune defense traits (sensu @bib112) but also that this cross talk can be realized through signals (@bib46; @bib101; @bib145) and through screening.

Overall, our study provides evidence that poison acidified crop lumens of formicine ants can act as a chemical filter for control and selection of microbes ingested with food. Poison acidified formicine crops might thus contribute to the ecological and evolutionary success of this group of insects by alleviating the increased risk of pathogen exposure and transmission associated with group living but allowing the acquisition and transmission of microbial mutualists. Similar microbial filters likely represent a widespread theme to manage harmful and beneficial host-associated microbes but have so far only partly been uncovered in a few animal systems (@bib26; @bib39; @bib126; @bib129; @bib131; @bib132; @bib146).

# Materials and methods

table: Key resources table
:::
| Reagent type  (species) or resource               | Designation                        | Source or reference                                                                                      | Identifiers     | Additional  information                                      |
| ------------------------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------ |
| Biological sample (_Camponotus floridanus)_       | _Camponotus floridanus_            | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Camponotus maculatus)_        | _Camponotus maculatus_             | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Lasius fuliginosus)_          | _Lasius fuliginosus_               | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Formica cinerea)_             | _Formica cinerea_                  | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Formica cunicularia)_         | _Formica cunicularia_              | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Formica fuscocinerea)_        | _Formica fuscocinerea_             | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Formica pratensis)_           | _Formica pratensis_                | other                                                                                                    |                 | See Materials and methods                                    |
| Biological sample (_Formica rufibarbis)_          | _Formica rufibarbis_               | other                                                                                                    |                 | See Materials and methods                                    |
| Strain, strain background (_Serratia marcescens)_ | _Serratia marcescens_              | Strain DSM12481, DSMZ-German Collection of Microorganisms and Cell Cultures GmbH, Braunschweig, Germany  |                 |                                                              |
| Strain, strain background (_Escherichia coli)_    | _Escherichia coli_                 | Strain DSM6897, DSMZ-German Collection of Microorganisms and  Cell Cultures GmbH,  Braunschweig, Germany |                 |                                                              |
| Strain, strain background (_Asaia_ sp.)           | _Asaia_ sp.                        | Strain SF2.1 @bib44                                                                                      |                 |                                                              |
| Other                                             | Blaubrand intraMARK micro pipettes | Brand, Wertheim, Germany                                                                                 | 708707          |                                                              |
| Other                                             | pH sensitive paper                 | Hartenstein, Würzburg, Germany                                                                           | PHIP            |                                                              |
| Other                                             | pH electrode                       | Unisense, Aarhus, Denmark                                                                                |                 |                                                              |
| Other                                             | Polymethylmethacrylate             |                                                                                                          |                 | University of Bayreuth, Animal Ecology I, group microplastic |
| Other                                             | Leica microscope DM 2000 LED       | Leica, Wetzlar, Germany                                                                                  |                 |                                                              |
| Other                                             | Leica stereomicroscope M 165 C     | Leica, Wetzlar, Germany                                                                                  |                 |                                                              |
| Other                                             | Commercial honey                   | Different brands                                                                                         |                 | 10% (w/v),  1:1 honey:water                                  |
| Other                                             | superglue                          | UHU brand                                                                                                |                 |                                                              |
| Chemical compound, drug                           | ≥95% Formic acid                   | Sigmaaldrich, Merck, Darmstadt, Germany                                                                  | Cat# F0507      |                                                              |
| Chemical compound, drug                           | Trypton                            | Sigmaaldrich, Merck, Darmstadt, Germany                                                                  | Cat# T7293-250G |                                                              |
| Chemical compound, drug                           | Yeast extract                      | Millipore, Merck, Darmstadt, Germany                                                                     | Cat# Y1625-250G |                                                              |
| Software,  algorithm                              | R version 3. 6.1                   |                                                                                                          |                 | @bib118                                                      |
:::
{#keyresource}

## Ant species and maintenance

Colonies of the carpenter ant _Camponotus floridanus_ were collected in 2001 and 2003 in Florida, USA, housed in Fluon (Whitford GmbH, Diez, Germany) coated plastic containers with plaster ground and maintained at a constant temperature of 25°C with 70% humidity and a 12 hr/12 hr light/dark cycle. They were given water ad libitum and were fed two times per week with honey water (1:1 tap water and commercial quality honey), cockroaches (_Blaptica dubia_) and an artificial diet (@bib8). For comparison, workers of one other _Camponotus_ species (_Camponotus maculatus_), collected close to Kibale Forest, Uganda, in 2003 and housed under identical conditions as _Camponotus floridanus_ were used. Additionally, six other formicine ant species, one _Lasius,_ and five _Formica_ species (_Lasius fuliginosus, Formica cinerea, Formica cunicularia, Formica fuscocinerea, Formica pratensis,_ and _Formica rufibarbis_) were collected in Bayreuth, Germany in 2012 and 2018 and kept for approximately 2 weeks prior experimental use at 20°C, 70% humidity and a 14 hr/10 hr light/dark cycle. Except otherwise noted only the small worker caste (‘minors’) of _Camponotus_ species was used.

## Acidity of the crop lumen and pH measurements

To determine whether formicine ants swallow their poison after feeding, we tracked changes in pH-levels of the crop lumen in _C. floridanus_ ants over time. Before use in experimental settings, cohorts of ~100 ants were taken out of their natal colony (n = 6 colonies) into small plastic containers lined with Fluon and starved for 24–48 hr. Thereafter, ants were put singly into small petri dishes (Ø 55 mm) with damp filter paper covered bottom, given access to a droplet of 10% honey water (w/v) for 2 hr before removing the food source and measuring the pH of the crop lumen after another 2 hr (group 0+4 hr: n = 60 workers), after 24 hr (group 0+24 hr: n = 59 workers) or 48 hr (group 0+48 hr: n = 52 workers). To assess the effect of renewed feeding, a separate group of _C. floridanus_ ants were given access to 10% honey water 48 hr after the first feeding for 2 hr prior to measuring the pH of their crop lumen after another 2 hr (group 48h+4 hr: n = 60 workers). To measure the pH, ants were first cold anesthetized on ice, then their gaster was cut off with a fine dissection scissor directly behind the petiole and leaking crop content (1–3 µL) collected with a capillary (5 µL Disposable Micro Pipettes, Blaubrand intraMARK, Brand, Wertheim). The collected crop content was then emptied on a pH sensitive paper to assess the pH (Hartenstein, Unitest pH 1–11). This method of collecting crop content will invariably result in some mixing of crop lumen content with haemolymph. As the pH of the insect haemolymph ranges from only slightly acidic (pH ≥6.5) to near-neutral or slightly alkaline (pH ≤8.2) (@bib57; @bib93), this might have biased the results of our pH measurements to slightly higher pH values. As a reference point for food pH, we also measured the pH of 10% honey water on pH sensitive paper, which gave invariably pH = 5.

In addition, we measured the pH in the crop lumen and at four points in the lumen along the midgut (1st measurement directly behind proventriculus to 4th measurement one mm apical from insertion point of the Malpighian tubules) of _C. floridanus_ workers that were fed 24 hr prior to measurements with 10% honey-water. For these measurements worker guts were dissected as a whole and pH was measured in the crop (n = 2 workers from two colonies) and along the midgut (all midgut points n = 10, except point four with n = 9 workers from four different colonies) with a needle-shaped microelectrode (UNISENSE pH-meter; microelectrode with needle tip of 20 µm diameter).

In formicine ants, oral uptake of the poison into the mouth is performed via acidopore grooming (@bib140). During this behavior ants bend their gaster forward between the legs and the head down to meet the acidopore, the opening of the poison gland, at the gaster tip (@bib5; @bib43). In an additional experiment we therefore compared the crop lumen pH of _C. floridanus_ workers from four different colonies that were either prevented to reach their acidopore (FA- ants) or could reach their acidopore freely (FA+ ants). To do this, we again allowed single ants access to 10% honey water for 2 hr after a starvation period, before cold anesthetizing them briefly on ice and immobilizing FA- ants (n = 22 workers) in a pipetting tip, while FA+ ants (n = 23 workers) remained un-manipulated. After 24 hr we measured the pH of the crop lumen as before.

To investigate whether swallowing of the acidic poison is widespread among formicine ants, the latter experiment was repeated for six additional formicine ant species (FA- ants: n = 10 workers except for _Formica pratensis_ with n = 21; FA+ ants: n = 10 workers except for _Formica pratensis_ with n = 20; all ants: n = 1 colony) in the same fashion as described before with the exception that apart from _Formica pratensis_ the crop lumen was collected through the mouth by gently pressing the ants’ gaster. Crop lumen of _Formica pratensis_ ants was collected in the same fashion as crop lumen of _C. floridanus_ ants.

To investigate whether the type of fluid and its nutritional value have an influence on the frequency of acidopore grooming in _C. floridanus_, the following experiment was performed. Cohorts of ~100 ants were taken out of their natal colony (n = 6 colonies) into small plastic containers and starved for 24–48 hr. Thereafter, ants were again put singly into small petri dishes (Ø 55 mm) and given access to either a 3 µL droplet of 10% honey water (w/v, n = 126 ants, treatment: honey-water fed), a 3 µL droplet of tap water (n = 128, water-fed) or to no fluid (n = 125, unfed). After acclimatization (unfed ants) or after swallowing of the fluid (honey-water and water-fed ants, both 1–2 min.), all ants were filmed for the next 30 min. (Logitech webcam c910). These videos were then analyzed for the frequency of acidopore grooming.

Finally, we measured the pH in the crop lumen of _C. floridanus_ ants (n = 3 colonies) under satiated and starved conditions to estimate a baseline level of acidity in the crop. For this, ants taken out of satiated, twice per week fed colonies on the day of feeding were compared to ants that were maintained in cohorts of ~100 individuals for 3 d with access to 10% honey-water and then starved for 24 hr before measuring the pH in their crop (n = 10 major and 10 minor workers per colony and condition). The pH in the crop lumen was measured as described before by briefly cold anesthetizing ants an ice, collecting the crop content through the mouth by gently pressing the ants’ gaster and then emptying it on a pH sensitive paper (Hartenstein, Unitest pH 1–11).

## Bacterial strains and culture

As model entomopathogenic bacterium _Serratia marcescens_ DSM12481 (DSMZ Braunschweig, Germany) was used. This bacterium is pathogenic in a range of insects (@bib54) and has been detected in formicine ants, that is _Anoplolepis gracilipes_ (@bib33) and _Camponotus floridanus_ (@bib121). While often non-lethal within the digestive tract, _S. marcescens_ can cross the insect gut wall (@bib97; @bib104) and is highly virulent upon entry into the hemocoel (@bib47), not least due to the production of bacterial toxins (@bib61). As a model bacterial gut-associate of ants _Asaia_ sp. strain SF2.1 (@bib44), was used. _Asaia_ sp. belongs to the family Acetobacteraceae, members of which often thrive in sugar-rich environments (@bib90), such as honeydew that ants like _C. floridanus_ predominantly feed on. _Asaia_ sp. is capable of cross-colonizing insects of phylogenetically distant genera and orders (@bib34; @bib44) and can be a component of the gut-associated microbial community of formicine and other ants (@bib31; @bib76; @bib77). In addition to _S. marcescens_ and _Asaia sp._, _Escherichia coli_ DSM6897 (DSMZ Braunschweig, Germany) was used as a model opportunistic bacterium that is not a gut-associate of insects. _E. coli_ bacteria are a principal constituent of mammalian gut-associated microbial communities but are commonly also found in the environment (@bib10).

Bacterial stocks of _S. marcescens, Asaia_ sp., and _E. coli_ were kept in 25% glycerol at −80°C until use. For use, bacteria were plated on agar plates (LB-medium: 10 g tryptone, 5 g yeast extract, 20 g agar in 1L MilliQ-water, and GLY-medium: 25 g gycerol, 10 g yeast extract, 20 g agar in 1L MilliQ-water with pH adjusted to 5.0, for _S. marcescens/E. coli_ and _Asaia_ sp. respectively), single colony forming units (CFUs) were picked after 24 hr (_S. marcescens/E. coli_) or 48 hr (_Asaia_ sp.) of growth at 30°C and transferred to 5 ml liquid medium (LB-medium and GLY-medium minus agar for _S. marcescens/E. coli_ and _Asaia_ sp. respectively) for an overnight culture (24 hr) at 30°C. The overnight culture was then pelleted by centrifugation at 3000 g, the medium discarded and resolved in 10% (w/v) honey water to the respective working concentration for the experiments. The concentration of a typical overnight culture was determined for _S. marcescens_ and _Asaia_ sp. by plating part of the overnight culture on agar plates and counting CFUs after 24 hr or 48 hr of growth at 30°C, for _S. marcescens_ and _Asaia_ sp. respectively. This yielded a concentration of 1.865 \* 10^9^ ± 5.63 \* 10^7^ (mean ± sd) bacteria per mL for _S. marcescens_ and 5.13 \* 10^8^ ± 8.48 \* 10^6^ (mean ± sd) bacteria for _Asaia_ sp.

## Survival experiments

In a first survival experiment we tested whether the ability to perform acidopore grooming within the first 24 hr after ingestion of pathogen contaminated food provides a survival benefit for individual _C. floridanus_ ants. Ants from eight colonies were starved for 24–48 hr before start of the experiment, as described before, and then workers put singly in small petri dishes were either given access to 5 µL of _S. marcescens_ contaminated 10% honey water (9.33 \* 10^9^ bacteria/mL; _Serratia+_ ants: n = 127) or uncontaminated 10% honey water (_Serratia-_ ants: n = 135) for 2 min. Afterward, all ants were cold anaesthetized and approximately half of the _Serratia+_ and the _Serratia-_ ants (n = 65 and n = 69, respectively) immobilized in a pipetting tip, thus preventing acidopore grooming (FA- ants: n = 134) while the other half remained fully mobile (FA+ ants: n = 128). After 24 hr, FA- ants were freed from the pipetting tip to minimize stress. Mortality of the ants was monitored over 5 d (120 hr) every 12 hr providing no additional food, except the one time feeding of 5 µL contaminated or uncontaminated honey water at the start of the experiment. We chose to provide no additional food after the one time feeding at the beginning of the experiment, as an altered feeding behavior, that is, illness induced anorexia with known positive or negative effects on survival (@bib65), might otherwise have influenced our results.

In an additional survival experiment, we investigated whether the ability to acidify the crop lumen has the potential to limit oral disease transmission during trophallactic food transfer. To this end, _C. floridanus_ ants from seven colonies were again starved, divided randomly in two groups (donor and receiver ants, each n = 322) and their gaster marked with one of two colors (Edding 751). Additionally, to prevent uptake of the poison, the acidopore opening of all receiver ants (receiver FA-) and half of the donor ants (donor FA-) was sealed with superglue, while the other half of the donor ants were sham treated (donor FA+) with a droplet of superglue on their gaster (@bib140). We then paired these ants into two different donor-receiver ant pairs. Pairs with both donor and receiver ants having their acidopore sealed (donor FA- | receiver FA-) and pairs with only receiver ants having their acidopore sealed (donor FA+ | receiver FA-). Six hours after pairing, donor ants from both pairs were isolated and given access to 5 µl of _S. marcescens_ contaminated 10% honey water (1.865 \* 10^9^ bacteria/mL) for 12 hr. Thereafter donor ants were again paired with the respective receiver ants for 12 hr and all pairs filmed for the first 30 min (Logitech webcam c910). These videos were then analyzed for the duration of trophallaxis events donor-receiver ant pairs engaged in during the first bout of trophallactic food exchange. After this first feeding round, donor ants were fed in the same fashion, that is, isolation for 12 hr with access to _S. marcescens_ contaminated 10% honey water, every 48 hr, while they were maintained with the respective receiver ants for the rest of the time. This experimental design ensured that receiver ants were fed only through the respective donor ants with pathogen contaminated food. Survival of both, donor and receiver ants, was monitored daily for a total of 12 d.

## Bacterial viability and growth assays

We tested the ability of _S. marcescens_ and _Asaia_ sp. to withstand acidic environments in vitro, as well as their ability and the ability of _E. coli_ to pass from the crop to the midgut in vivo when ingested together with food. In ants, gut morphological structures, that is, the infrabuccal pocket, an invagination of the hypopharynx in the oral cavity (@bib40), and the proventriculus, a valve that mechanically restricts passage of fluids from the crop to the midgut (@bib41), consecutively filter solid particles down to 2 µm (@bib85) which would allow _S. marcescens_ (Ø: 0.5–0.8 µm, length: 0.9–2 µm, @bib54), _Asaia_ sp. (Ø: 0.4–1 µm, length: 0.8–2.5 µm, @bib82), and _E. coli_ (length: 1 µm, width: 0.35 µm, @bib10) to pass. For the in vitro tests we incubated a diluted bacterial overnight culture (10^5^ and 10^4^ CFU/ml for _S. marcescens_ and _Asaia_ sp., respectively) in 10% honey water (pH = 5) and in 10% honey water acidified with commercial formic acid to a pH of 4, 3, or 2 for 2 hr at room temperature (_S. marcescens_: n = 15 for all pH-levels, except pH = 4 with n = 13; _Asaia_ sp.: n = 10). Then we plated 100 µl of the bacterial solutions on agar-medium (LB-medium and GLY-medium for _S. marcescens_ and _Asaia_ sp., respectively) and incubated them at 30°C for 24 hr (_S. marcescens_) or 48 hr (_Asaia_ sp.) before counting the number of formed CFUs. For the in vivo tests _C. floridanus_ ants from five (_Asaia_ sp.), four (_E. coli_) or from six colonies (_S. marcescens_) were starved as before and then individually given access to 5 µL of bacteria contaminated 10% honey water (_Asaia_ sp. and _E. coli_: 1 \* 10^7^ CFU/mL, _S. marcescens_: 1 \* 10^6^ CFU/mL) for 2 min. To assess the number of CFUs in the digestive tract, that is the crop and the midgut, ants were dissected either directly after feeding (0 hr; _S. marcescens_: n = 60 workers; _Asaia_ sp. and _E. coli_: n = 15 each), or at 0.5 hr (_S. marcescens_: n = 60; _Asaia_ sp. and _E. coli_: n = 15 each), 4 hr (_S. marcescens_: n = 60; _Asaia_ sp. and _E. coli_: n = 15 each), 24 hr (_S. marcescens_: n = 53; _Asaia_ sp. and _E. coli_: n = 15 each) or 48 hr (_S. marcescens_: n = 19; _Asaia_ sp. and _E. coli_: n = 15 each) after feeding. For dissection, ants were cold anesthetized, the gaster opened and the whole gut detached. The crop and the midgut were then separated from the digestive tract, placed in a reaction tube, mechanically crushed with a sterile pestle and dissolved in 100 µL (_Asaia_ sp. and _E. coli_) or 150 µL (_S. marcescens_) phosphate buffered saline (PBS-buffer: 8.74 g NaCl, 1.78 g Na~2~HPO~4~,2H~2~O in 1L MilliQ-water adjusted to a pH of 6.5). The resulting solutions were then thoroughly mixed, 100 µl streaked on agar-medium (LB-medium and GLY-medium for _S. marcescens_/_E.coli_ and _Asaia_ sp., respectively) and incubated at 30°C for 24 hr (_S. marcescens_ and _E. coli_) or 48 hr (_Asaia_ sp.), before counting the number of formed CFUs. No other bacteria (e.g. resident microbes) were apparent in terms of a different CFU morphology on the agar plates which agrees with the very low number of cultivable resident bacteria present in the midgut of _C. floridanus_ (Stoll and Gross, unpublished results). This methodology cannot completely exclude that resident _S. marcescens_ or species of Acetobacteraceae might have biased our count data by adding a background level of CFUs at all timepoints or by adding random outlier CFUs at specific timepoints. Both, background level CFU numbers and random outlier CFUs should however not influence observed patterns over time. The timepoints of 0 hr, 0.5 hr, 4 hr, 24 hr, and 48 hr in in vivo bacterial growth assays were chosen according to literature describing passage of food from the crop to the midgut within 3–6 hr after food consumption in ants (@bib25; @bib79; @bib78; @bib67; @bib91). They should thus be representative of two time points before food passage from the crop to the midgut (0.5 hr and 4 hr) and two time points after food passage from the crop to the midgut (24 hr and 48 hr) together with the reference timepoint (0 hr).

## Food passage experiment

To estimate food passage from the crop to the midgut and hindgut of _C. floridanus_ after feeding we performed the following experiment. We again took a cohort of ~100 workers out of one natal colony of _C. floridanus_, starved them for 24 hr and then offered them 200 µL of a 1:1 honey-water mix with 50 mg of polymethylmethacrylate (PMMA, aka acrylic glass) particles (size ≤40 µm). Afterward, we dissected the digestive tract of three major and three minor workers at each of the timepoints 2 hr, 4 hr, 6 hr, 8 hr, 12 hr, 14 hr, 16 hr, 18 hr, 24 hr, and 48 hr after feeding and placed each under a microscope (Leica DM 2000 LED) to detect and count the number of particles via fluorescence in the crop, the midgut, and the hindgut.

## Statistical analyses

All statistical analyses were performed with the R statistical programming language (version 3.6.1, @bib118). All (zero-inflated) General(ized) linear and mixed models and Cox mixed-effects models were compared to null (intercept only) or reduced models (for those with multiple predictors) using Likelihood Ratio (LR) tests to assess the significance of predictors. Pairwise comparisons between factor levels of a significant predictor were performed using pairwise post-hoc tests adjusting the family-wise error rate according to the method of Westfall (package ‘multcomp’, @bib14). We checked necessary model assumptions of (zero-inflated) General(ised) linear and mixed models using model diagnostic tests and plots implemented in the package ‘DHARMa’ (@bib58). Acidity of the crop lumen (log transformed pH to normalize data) and midgut lumen in _C. floridanus_ was analyzed using linear mixed models (LMM, package”lme4’, @bib6) including time since feeding (four levels: 0+4 hr, 0+24 hr, 0+48 hr, 48h+4 hr; [Figure 1a](#fig1)), ant manipulation (two levels: FA+ and FA-, that is ants with and without acidopore access; [Figure 1b](#fig1)) or digestive tract part (four levels: crop, midgut position 1, midgut position 2, midgut position 3, midgut position 4; [Figure 1—figure supplement 1](#fig1s1)) as predictors and natal colony as a random effect. Due to non-normality and heteroscedasticity, the acidity of the crop lumen in the seven formicine ant species other than _C. floridanus_ ([Figure 1c](#fig1)) was analysed using per species Wilcoxon rank-sum tests with ant manipulation (FA+ and FA-) as predictor. The frequency of acidopore grooming in _C. floridanus_ upon feeding different types of fluids was analyzed using Generalized linear mixed models (GLMM, package”lme4’, @bib6) with negative binomial errors and type of fluid (three levels: unfed, water-fed, or 10% honey water fed) as predictor and natal colony as random effect ([Figure 1—figure supplement 2](#fig1s2)).

Survival data were analysed with Cox mixed effects models (COXME, package ‘coxme’, @bib138). For the survival of individual ants ([Figure 3](#fig3)), ant treatment (four levels: _Serratia-_ | FA-, _Serratia-_ | FA+, _Serratia_+ | FA-, _Serratia+_ | FA+) was added as a predictor and the three ‘blocks’ in which the experiment was run and the colony ants originated from, were included as two random intercept effects. For the survival of donor-receiver ant pairs ([Figure 4](#fig4)), ant treatment (four levels: donor FA+, donor FA-, receiver FA+, receiver FA-) was included as a predictor and the three ‘blocks’ in which the experiment was run, the colony ants originated from, and petri dish in which donor and receiver ants were paired, were included as three random intercept effects. Survival of receiver ants was right censored if the corresponding donor ant died at the next feeding bout (right censoring of both donor and receiver ants in one pair upon death of one of the ants yielded statistically the same result: COXME, overall LR χ^2^ = 60.202, df = 3, p&lt;0.001; post-hoc comparisons: receiver FA- versus donor FA-: p=0.388, all other comparisons: p&lt;0.001). The duration of trophallaxis events (square-root transformed to normalize data) between donor-receiver ant pairs was analysed using a linear mixed model with ant pair type (two levels: donor FA+ | receiver FA- and donor FA- | receiver FA-) as predictor and the three ‘blocks’, in which the experiment was run and the colony ants originated from as random effect ([Figure 4—figure supplement 1](#fig4s1)).

Bacterial growth in vitro was analysed separately for _S. marcescens_ and _Asaia_ sp. using Generalized linear models (GLM) with negative binomial errors and pH as predictor, excluding pH levels with zero bacterial growth due to complete data separation ([Figure 2—figure supplement 2](#fig2s2) and [Figure 5—figure supplement 1](#fig5s1)). Relative values shown in [Figure 2—figure supplement 2](#fig2s2) and [Figure 5—figure supplement 1](#fig5s1) were calculated by dividing each single number of formed CFUs at the different pH-values through the mean of formed CFUs at pH 5. Bacterial viability in vivo within the digestive tract of _C. floridanus_ over time was analysed separately for the crop and midgut for _S. marcescens_ and _Asaia_ sp. ([Figure 2](#fig2) and [Figure 5](#fig5), respectively) and for _E. coli_ ([Figure 2—figure supplement 2](#fig2s2)). Zero-inflated generalized linear mixed models with negative binomial errors (package ‘glmmTMB’, @bib17) were used to model CFU number, with time after feeding as fixed predictor and ant colony as random effect, except for the _E. coli_ model in the crop where colony was included as fixed factor as the model did not converge with colony as a random factor. Timepoints with zero bacterial growth were again excluded in the models. Relative CFU values shown in [Figure 2](#fig2), [Figure 5](#fig5), and [Figure 2—figure supplement 2](#fig2s2) were calculated by dividing single CFU-values through the mean of CFU-values at timepoint 0 hr in the crop. Proportions and percentages of relative CFU change in the text are based on these relative CFU values.
