Evolution of symbiont transmission in conditional mutualisms in spatially and temporally variable environments

Symbiotic relationships affect the fitness and organismal function of virtually all organisms. In many cases, the fitness effects of symbiosis may be beneficial or harmful depending on the environment. The hosts of such symbionts are favored to acquire them only when the symbiont is beneficial. However, it is not clear whether such selection favors vertical or horizontal transmission, both, or neither. To address this question, we model the evolution of transmission mode in a conditional mutualism experiencing spatial and temporal environmental variation. We find that when symbionts affect host lifespan, but not fecundity, horizontal transmission can contain them to beneficial environments. Vertical transmission can produce symbiont containment when the environmental state is synchronized across locations. We also find an emergent trade-off between horizontal and vertical transmission, suggesting that physiological constraints are not required for the evolution of limits on the total amount of transmission.

cost and benefits of symbiosis. Theory in this set has investigated the effects of contextdependent transmission (Gundel et al., 2008), host birth rates (Ferris and Best, 2018), environmental productivity (Harrison et al., 2013;Poisot et al., 2012;Hochberg et al., 2000), and the specificity of selection (Mostowy and Engelstadter, 2011). The second category of models deals with context-dependence in the costs and benefits of symbiosis itself, more similar to the setting that we are considering.  (Gomulkiewicz et al., 2003) and along abiotic gradients (O'Brien et al., 2018). Context-dependent costs and benefits and context-dependent transmission have also been studied in the context of cultural transmission of traits (Ram et al., 2018(Ram et al., , 2019. One of the most important aspects of any symbiosis is how the partners come (or stay) together, i.e., the mode of transmission of the symbiont (Antonovics et al., 2017).
For non-context-dependent interactions, the mode of transmission of symbionts is already known to have a strong impact on the distribution and evolution of the symbiosis. In the absence of other feedbacks, symbionts that are transmitted vertically (from parent to offspring) have been found experimentally and theoretically to evolve toward reduce virulence and even mutualism, while symbionts that are transmitted horizontally have been found to evolve intermediate levels of virulence that maximize their transmission (Ewald, 1987;Yamamura, 1993;Ferdy and Godelle, 2005;Stewart et al., 2005;Alizon et al., 2009;Akçay, 2015;Werren et al., 2008;Shapiro and Turner, 2014).
Transmission is likely to be important in the evolution of context-dependent symbioses as well, but much less is known about transmission evolution in this context.
Previously, we modeled how the transmission mode evolves in a symbiosis in an environment where the costs and benefits vary in space so that the symbiosis is beneficial to the host in some patches but detrimental in others (Brown and Akçay, 2019).
In this setting, the hosts might be expected to evolve a transmission mode that allows them to acquire the symbiont only where it is beneficial and not otherwise. Specifically, one might imagine horizontal transmission to do the trick. However, we showed that achieving such "containment" of the symbiont where it is beneficial non-trivially depends on the eco-evolutionary dynamics of the infection. In particular, containment depends on both the newborn dispersal rate and which component of host fitness the symbiont affects. We showed that populations might evolve fully vertical transmission when the dispersal rate was low and parents' and offsprings' environments were highly correlated. Conversely, when the dispersal rate was high, hosts evolved to acquire the symbiont horizontally from neighbors, but only when it affected their lifespan and not when it affected their fecundity. This was because only lifespan effects led to clearing of the infection in patches where it was detrimental so that infection would tend to spread horizontally only where it was beneficial.
In this paper we turn to the question of how temporal in addition to spatial variability in costs and benefits of symbiosis affects transmission mode evolution. Temporally variable environments pose distinct challenges and potential opportunities to hosts. In particular, hosts in a temporally variable environment cannot permanently contain the symbiont to the location where it is beneficial, as this location will change over time.
Hosts must now adapt their transmission to allow for fast lost or gain of the symbiont in response to changes in environmental conditions. Another challenge arises in temporally varying environments when environmental conditions are synchronous between locations. In this case, the correlation between parent and offspring environments may be high even with high dispersal rates, potentially increasing the viability of vertical transmission, but also posing a problem by removing a reservoir of hosts with the appropriate infection status for different environmental conditions.
To understand how selection on host transmission strategies may solve these challenges, we model a spatially and temporally variable environment composed of two patches with varying degrees of synchronicity in environmental state. We find that, as in the purely spatial case, hosts can only evolve horizontal transmission when the symbiont affects their lifespan. However, increasing synchronicity allows hosts whose

Symbiont effects on host fitness
We consider two possible ways the symbiont may affect its host. First, the symbiont may affect its host's lifespan, increasing infected hosts' lifespan relative to uninfected hosts in State M, and decreasing it in State P. In the main text, we model effects on lifespan through adult host mortality. Hosts with the beneficial infection status for the current environmental state have a lower chance of dying when a newborn host settles in their patch. This is similar to the case where the symbiont affects lifespan through newborn host survival, which we show in the supplement ( Figures S1 and S2). The other possibility is that the symbiont affects host fecundity. We model this as increasing the chances that a host with a beneficial infection status for its environmental state will be chosen to reproduce in any given time step.
We model base fecundity, F , and mortality, M , for each host as variables that depend on their infection status and the environmental state. The chance a particular host gives birth or dies is determined by its base fecundity or mortality compared to the rest of the population (fecundity) or patch (mortality). For a single time step, the probabilities are

Transmission and dispersal
Symbionts in our model can be transmitted between hosts vertically or horizontally.
Each host has genetically determined horizontal and vertical transmission probabilities that give their probability of acquiring the symbiont via each mode of transmission. To understand the optimal transmission combination in the absence of biological constraints on transmission, we allow the transmission probabilities to mutate independently and to be any combination of values in the region [0, 1] 2 .
After a newborn is born and has possibly mutated, if its parent is infected, it has a chance to acquire the symbiont via vertical transmission from its parent. After this, the newborn has a chance to disperse to the other patch. We model the dispersal rate as the probability that the newborn leaves its natal patch. At a dispersal rate of 0 the patches behave as separate populations, and at 0.5, the newborn has an equal chance of being in either patch.
If the newborn is still uninfected after it arrives in its final patch, it has a chance to become infected via horizontal transmission. We select a random neighbor in the patch, who, if infected, has a chance to infect the newborn. To prevent the symbiont from being permanently lost from the population, newborns also have a small chance (0.5%) of becoming spontaneously infected if they fail to get infected horizontally. We assume infection can only happen when individuals are newborns and do not allow the newborn to infect adults or adults to infect each other.

Measures of ecological and evolutionary outcomes
We are interested in the transmission mode hosts evolve and how this relates to the ecological dynamics of infection. To understand evolutionary dynamics, we calculate the average horizontal and vertical transmission probabilities after the population has been allowed to evolve for a long period of time (10 6 generations).
To understand the ecological dynamics, we find the average fraction of infected hosts in each environmental state over a whole number of cycles of environmental

Simulations and numerical analysis
We simulated a context-dependent symbiosis in Julia version 0.6.2 and 0.7.0 (Bezanson et al., 2017). Code for the simulations was adapted from Brown and Akçay (2019) and is available on Github (https://github.com/brownal/ConditionalMutualistsSpaceTime).
We simulated a population of 200 hosts, initiated with 50% infection in each patch. To understand transmission evolution, we ran simulations for 2 · 10 7 time steps (10 6 generations). We started simulations at a grid of 9 initial transmission probabilities, with the horizontal and vertical transmission probabilities each either 0, 0.5, or 1. We ran 3 replicate simulations for each set of initial conditions, and calculated the average horizontal and vertical transmission probabilities at the end of each simulation.
We also simulated the ecological dynamics of infection without transmission evolution using a similar procedure. In this case, we ran simulations for 5 cycles of environmental change and found the average infection over the last cycle. We started simulations from a grid of 121 evenly spaced initial transmission probabilities, spaced 0.1 apart. We ran 5 replicate simulations for each set of initial conditions.
We analyzed all simulations using the package pandas ( We also numerically calculated symbiont infection dynamics for fixed transmission probabilities using Mathematica v 11. Code for this is also available on Github. In this case, we assumed an continuous time and calculated the expected fraction of infected hosts in each state. We did not allow recurrent infection in the numerical analysis, as the infection cannot be lost by chance in this case.

Symbiont containment Symbiont affects host lifespan
We containment. At lower levels of synchronicity, the pattern is similar when the dispersal rate is low. As the dispersal rate increases, containment decreases at high vertical transmission probabilities. Containment is then highest when vertical transmission is low, but not absent, and the horizontal transmission probability is high, but still less than 1. These results are counter to the case with purely spatial heterogeneity, where complete vertical or horizontal transmission by itself can generate containment.

Symbiont affects host fecundity
When the symbiont affects fecundity, containment decreases at high horizontal transmission probabilities (Figure 3). Containment is generally highest at high vertical transmission probabilities and low or moderately low horizontal transmission probabilities. However, 100% vertical transmission generally leads to low containment, as does 0% horizontal transmission. When the patches are synchronized, the maximum containment is similar to when the symbiont affects lifespan. On the other hand, when patches are asynchronous, containment decreases for all transmission probabilities with increasing dispersal. At complete asynchronicity and a dispersal rate of 0.5 (parent and offspring environments are completely uncorrelated), containment is essentially 0 for all transmission probabilities.

Analytical model
Our analytical model of containment, evaluated numerically, confirms these results.
One exception is that because the analytical model allows for the loss of the symbiont in a finite population, some containment is possible when the horizontal or vertical transmission probability is 1 ( Figure S7). Also, due to the lack of spontaneous infection, the infection can be lost in some cases where it remained in the simulations. This largely affects the case where the two patches experience synchronized environments and the symbiont affects host lifespan. In this case, while the region where infection can be maintained is much smaller, a curve representing a trade-off between horizontal and vertical transmission still produces the highest containment.

Transmission mode evolution
The vertical and horizontal transmission rates evolve toward values that result in high containment ( Figure 4).

Symbiont affects host fecundity
When the symbiont affects host fecundity and patches are synchronized, hosts evolve high vertical transmission and low levels of horizontal transmission. The same is true when patches are asynchronous and the dispersal rate is low. As the dispersal rate increases in asynchronous environments and neither vertical nor horizontal transmission can contain the symbiont, more horizontal transmission appears possible, likely because transmission appears to be evolving neutrally.

Effect of time scale of environmental change
The time scale over which environmental change occurs also affects both symbiont containment and transmission evolution. In particular, the results highlighted above where containment was generally low, spontaneous infection occasionally produced negative containment; shown here as zero containment (see SI for further discussion).

Average transmission probabilities
Disp. rate = 0.005 0.05 0.5 Vertical transmission probability   Complete synchronicity   fecundity, hosts are able to evolve horizontal transmission and contain symbionts to environments where they were beneficial. When the symbiont affects host fecundity, hosts with the "wrong" infection status tend to remain in the population, as they are no more likely to die than hosts with the beneficial infection status. Under this scenario, horizontal transmission causes newborns to acquire this harmful infection status from their neighbors, and thus is selected against.
In contrast, we find that vertical transmission can always evolve at low newborn dispersal rates. At high dispersal rates, correlation between parent and offspring location is reduced, and vertical transmission does not evolve in asynchronous environments. Synchronicity in environmental state across space "rescues" vertical transmission by creating a correlation in environmental conditions regardless of location.
When the symbiont affects host lifespan, in many cases, hosts can use either horizontal or vertical transmission to achieve symbiont containment. In these cases, containment can also be achieved with a range of mixtures of the two transmission modes.
Strikingly, the range of mixtures of horizontal and vertical transmission embodies an apparent trade-off between the two transmission modes even though we do not impose any direct costs or enforce any constraints. This trade-off arises in our model purely due to the eco-evolutionary feedback with infection dynamics that results from each combination of transmission probabilities. Specifically, increasing both transmission modes together beyond a certain level precludes hosts from losing the symbiont when it becomes harmful. Thus, adaptive evolution tends to lower one transmission probability if the other one increases. Within this "adaptive band" of mixed mode transmission probabilities, fitness is nearly neutral. This emergent tradeoff due to ecoevolutionary feedbacks has potential implications for local adaptation and differentiation of populations. It suggests that populations that independently evolve under similar environmental conditions and with the exact same symbiont may still experience reproductive isolation if they converge on different points in the band of adaptive transmission probabilities. In that case, hybrid lineages between the populations could end up with transmission probabilities outside the adaptive band and thus with lower fitness than their parent lineages, leading to reproductive isolation.
Another potential outcome for hosts in the long term is that physiological or developmental mechanisms that canalize the trade-off between horizontal and vertical transmission might be selected for to increase hosts' chances of remaining along the trade-off line in the face of mutations in transmission (Rice, 2008;Watson et al., 2014;Pavličev and Cheverud, 2015). Many symbioses do exhibit some physiological constraints on transmission, and it would be interesting if, in some cases, this were a consequence of evolutionary trade-offs, rather than a cause of them.
Our results stand in interesting contrast to the pure spatial heterogeneity case we analyzed before (Brown and Akçay, 2019). With temporal heterogeneity, we find that purely vertical or purely horizontal transmission mode does not lead to high containment, whereas in the pure spatial heterogeneity case only pure horizontal or pure vertical transmission could achieve maximum containment (Brown and Akçay, 2019). This is in part because under temporal heterogeneity, hosts are periodically selected to quickly lose the symbiont, which cannot happen if either transmission probability is very close to one. Conversely, having both types of transmission but at less than maximum probability, on the other hand, allows the symbiont to spread between lineages (horizontal transmission) and locations (vertical transmission) when it becomes beneficial. Temporal variability therefore increases the benefits of mixed-mode transmission for hosts and even produce an emergent trade-off between horizontal and vertical transmission.
Our results apply to the case where temporal variation happens on intermediate time scales. If the environment changes much more quickly than the ecological dynamics of infection, neither parents' nor neighbors' infection status can predict whether the symbiont is beneficial. In this case, transmission evolves neutrally. When the environment changes more slowly than host evolution, hosts can evolve as if the symbiont's effects purely varied in space. Our results only apply when the environment changes more slowly than ecological dynamics but more quickly than evolutionary ones.
There are several examples of symbioses that likely fall within this regime. The fungus Epichloë amarillans increases the fecundity of its hosts, the grass Agrostis hye-malis under dry conditions, while decreasing host biomass, which may affect lifespan or future fecundity, in the presence of soil microbes (Davitt et al., 2011). The fungus is both vertically and horizontally transmitted in this host, though transmission in the studied population is predominantly vertical (Davitt et al., 2011). As the authors find no environmental effects on transmission, they suggest that the differences in endophyte prevalence in natural populations may be due to the environmental context. As water availability likely varies asynchronously (as both wet and dry locations exist simultaneously), our model would suggest symbiont containment if host dispersal is low. The fact that high, but not complete, vertical transmission evolves in response to effects on fecundity also matches with the predictions of our model. As some aphids were specialized on their alfalfa food source in the absence of infection, there is some evidence for prolonged association of a lineage with a specific type of host plant.
Another context-dependent interaction with aphids is that of pea aphids, Acyrthosiphon pisum, with their bacterial symbiont Hamiltonella defensa, which protects them from parasitoid wasps but increases their predation by ladybugs (Polin et al., 2014). Since the presence of predators and parasitoids should vary in time, this makes H. defensa a conditional mutualist whose effects vary over time. If this is the case, we would expect to observe imperfect transmission. Because this symbiosis has a lifespan cost, at least some horizontal transmission would seem likely, with horizontal transmission becoming more likely as the correlation between the predators/parasitoids around parents and offspring decreases. Interestingly, vertical transmission of H. defensa has been found in this symbiosis, with extremely consistent vertical transmission when A. defensa-infected hosts paying an induced cost when attacked by a parasitoid). Our results suggest a mechanism by which hosts might evolve to maintain this type of transmission, which also leads to symbionts at intermediate frequencies in a spatially heterogeneous population.
Our model makes predictions for the outcome of context-dependent symbioses in environments that vary in both space and time, but there are still questions that remain. In particular, it is not clear how symbionts will evolve in a context-dependent symbiosis when the environment varies over time. Understanding symbiont evolution in such symbioses and in response to selection for transmission trade-offs in hosts may give more insight into the host-symbiont coevolution and the eventual fate of these symbioses. Furthermore, some hosts, such as aphids, have been found to engage in multiple context-dependent interactions, and many other context-dependent interactions have effects that changed based on the presence of a third symbiont. Understanding how multiple symbionts affect host evolution, and how host response to infection feeds back on symbiont dynamics, will help us understand the effects of context-dependence on larger ecological dynamics.
Our results also suggest that understanding the temporal synchronicity of environmental conditions across space is needed to predict transmission evolution. Measuring this in natural populations of hosts in context-dependent interactions could allow for predictions of transmission evolution in these symbioses. Along with that, as natural environments likely change stochastically over time, extending the model to different types of environmental change over time will be helpful for making accurate predictions for existing symbioses.
Our model predicts that temporal environmental variation can strongly affect transmission evolution in context-dependent symbioses. In particular, synchronicity in environmental conditions across space can rescue vertical transmission as a method of symbiont containment, when symbiont effects on fecundity make horizontal transmission impossible. Our model also suggests an emergent trade-off between horizontal and vertical transmission, suggesting that physiological constraints on transmission are not necessary for a trade-off between transmission modes to evolve. Furthermore, our model also suggests that mixed-mode and imperfect transmission could benefit hosts, by allowing them to respond to environmental changes.