Supplementary Information 2 Table S1. Results of quasibinomial GLMs testing for microbial OTU relationships with host diet. This table is provided in a separate .xls file, due to its size. The table lists OTU 4 taxonomic identity, to the highest available resolution, OTU mean relative abundance, OTU incidence (proportion of hosts carrying the OTU), and P-values for monotonic 6 quasibinomial general linear models testing for diet effects on OTU relative abundance (diet effects including carbon and nitrogen signatures converted into proportion littoral 8 carbon and trophic position, respectively). Separate models were run for perch, and for stickleback. No model results are provided for OTUs that are absent in a given host species. 10 Results are sorted by mean abundance. Here we focus only on OTUs exhibiting at least 0.01% mean relative abundance and found in multiple hosts. 12 1 14 Table S2. Results of a linear model in which stickleback phylodiversity (PD) depends 16 on linear and quadratic effects of diet as measured by the proportion littoral carbon α, trophic position (tpos), and sex and size. This is a reduced version of a model that 18 originally included effects of sex, length, linear and quadratic diet effects, and pairwise and 3-way interactions. AIC model selection criteria were used to identify a simpler model that 20 contains essential effects but removes effects that contribute little explanatory power. The overall model is significant (p=0.014). 22 Effect Estimate Std. Error t P Intercept 183.8046 56.6672 Sex 20.8342 9.4092 2.2143 0.0281 Length -4.1454 1.2036 -3.4442 0.0007 α2 55.9113 24.0147 2.3282 0.0211 tpos2 14.4968 4.8526 2.9874 0.0032 Sex * Length -0.4613 0.2034 -2.2683 0.0246 α2 * tpos2 -4.6964 2.0372 -2.3054 0.0224 0.3573 0.1031 3.4643 0.0007 Length * tpos2 2 24 Table S3. Results of a linear model in which perch phylodiversity (PD) depends on linear and quadratic effects of diet as measured by the proportion littoral carbon α, 26 trophic position (tpos), and sex and size. This is a reduced version of a model that originally included effects of sex, length, linear and quadratic diet effects, and pairwise and 28 3-way interactions. AIC model selection criteria were used to identify a simpler model that contains essential effects but removes effects that contribute little explanatory power. The 30 overall model is significant (p=0.0268). Effect Estimate Std. Error t P Intercept -130.0632 129.1471 Sex -545.5272 224.0753 -2.4346 0.0160 1.4479 0.3671 3.9444 0.0001 α 483.5506 166.0533 2.9120 0.0041 tpos -20.5669 64.5291 -0.3187 0.7503 α2 481.8605 311.3499 1.5476 0.1236 13.9263 9.2240 1.5098 0.1330 0.0782 0.0390 2.0026 0.0469 -126.7562 49.0069 -2.5865 0.0106 Sex * α -18.3193 37.3461 -0.4905 0.6244 Sex * tpos 302.9908 128.1194 2.3649 0.0192 71.9325 72.0933 0.9978 0.3199 Sex * tpos2 -42.7618 18.1530 -2.3556 0.0197 Length * α -3.9310 1.3345 -2.9456 0.0037 Length * α2 -3.8125 2.3211 -1.6426 0.1024 Length * tpos2 -0.0882 0.0216 -4.0884 0.0001 1.0175 0.3688 2.7588 0.0065 Length tpos2 Sex * Length α2 * tpos2 Sex * α2 Length * α2 * tpos2 32 3 Table S4. Results of quadratic quasibinomial GLMs testing for microbial OTU 34 relationships with host diet in the captive stickleback diet-manipulation experiment. This table is provided in a separate .xls file, due to its size. The table provides taxonomic 36 information for the common OTUs in the laboratory feeding experiment with males and females fed Daphnia (0% littoral prey), mixed diet (50%), or chironomids (100%), mean 38 relative abundance of each OTU, and the results of the quadratic quasibinomial GLM including slope, standard error of slope, and P-value of the linear and quadratic effects of 40 the proportion littoral carbon. Entries are sorted by a t-statistic measure of effect size and direction for the quadratic effect. Negative values denote OTUs that are less common in 42 mixed-diet fish, positive values denote OTUs that are more common in mixed-diet fish. 44 46 Table S5. Results of a general linear model testing whether microbial diversity (PD) depends on diet generalization (G) in perch. 48 Effect t P 12.67 -2.58 0.0104 -151.94 51.05 -2.97 0.0033 -0.27 0.079 -3.50 0.0005 140.47 67.04 2.09 0.0375 Sex * Length 0.25 0.106 2.42 0.0162 G * Length 1.23 0.40 3.04 0.0027 Sex * Length * G 1.11 0.55 -2.02 0.0449 Intercept Sex Length G Sex * G Estimate Std. Error 48.06 9.93 -32.82 4 50 52 Table S6. Results of quadratic quasibinomial GLMs testing for non-linear microbial 54 class relationships with host diet in the two wild species (separate statistical models). This table is provided in a separate .xls file, due to its size. We present taxonomic 56 details for each common OTU, relative abundance, and incidence (as in Table S1), sorted by incidence. This table differs from Table S1 in that we present quadratic GLMs testing for 58 non-linear diet effects, including linear and quadratic effects of the proportion littoral carbon and trophic position, an interaction between littoral carbon and trophic position, 60 and an interaction between their squared effects. 5 2 Bloodworms Mixed Daphnia 0 -2 -1 LD2 1 MANOVA p = 0.036 -2 -1 0 1 2 3 4 LD1 62 Figure S1. Effect of experimental diet manipulation on gut microbial composition, 64 measured here by linear discriminant function axes 1 and 2 (LD1 and LD2). Weighted PCoA axes 1-10 were used to generate LD axes. Individual fish are plotted as small circles color- 66 coded by diet treatment. Larger triangles indicate treatment centroids, with 95% (2 standard error) confidence intervals plotted around each centroid. A MANOVA confirmed that the 68 between-treatment differences are significant. Similar results are obtained for weighted and unweighted PCoA scores, as well as combinations of additional higher-order PCoA axes, eg. 70 PCoA 2 versus 3.. This figure presents results from diet manipulation of pre-reproductive male and female stickleback; similar results are obtained for reproductive males only. 6 60 40 Microbial diversity, PD 50 B 10 20 30 60 40 30 10 20 Microbial diversity, PD 50 A 0.2 0.4 0.6 0.8 Proportion littoral carbon 1.0 3.2 3.4 3.6 3.8 Trophic position, tpos 72 74 Figure S2. Null versus observed values of microbial diversity (PD) in stickleback. We evaluated the extent to which individuals’ observed microbial diversity differs from null 76 expectations under two null models of community assembly: (M1) random colonization by a well mixed metacommunity of microbes to which all individuals are exposed, or (M2) random 78 colonization by a diet-dependent metacommunity of microbes. If individuals exhibit less phylogenetic diversity than null expectations, it suggests a tendency for phylogenetically related 80 microbes to coexist within an individual more frequently than expected by chance. In this legend, we first present the methods used, then explain the results plotted in Figure S2. 82 Methods For model M1, we determined the mean relative abundance of each microbe OTU across all wild-caught stickleback to obtain an average metacommunity composition, after 84 rarefying to 10,000 sequence reads per individual. We drew randomly from this multinomial probability distribution to resample 10,000 reads per individual, and recalculate PD (and OTU 7 86 richness) for each individual. This was done 1,000 times (Figure S2 shows one typical realization of this resampling) to generate a mean population-wide null PD that ignores individual diet (null 88 PDpop). For model M2, we examined each individual stickleback in turn and found the 20 closest neighboring fish in bivariate isotopic space. These neighboring fish approximate that focal 90 individuals’ diet, and so can be used to represent the microbial community expected for the focal individuals’ diet. We calculated the mean relative abundance of each microbe OTU across those 92 20 neighbors (excluding the focal fish). This represents a null meta-community given the individual’s diet. We then randomly sampled 10,000 OTUs from this null meta-community to 94 generate a null community for the individual (repeated 1,000 times). For each null community for the individual, we obtained PD (and OTU richness), yielding a diet-based null diversity (null 96 PDdiet). Whereas null community diversity under model M1 is shared by all fish, the null community diversity under M2 is unique for each individual, being defined by the microbes of 98 its dietary neighbors. We then used t-tests to check for differences between the observed PD, null PDdiet, and null PDpop to determine whether individuals’ microbiota are more 100 phylogenetically similar and less diverse than expected if individuals sampled from a shared microbial metacommunity, either population-wide or diet-based (M1 and M2, respectively). 102 Results. In Figure S2, individuals’ observed PD values are plotted as solid dots, and connected by vertical light grey lines to their corresponding average null PDdiet that is based on 104 fish with similar diets. The population-wide null PD (ignoring individual diet) is indicated by a thick dotted horizontal line. Three main trends emerge from this analysis. 106 First, individuals’ observed PD (solid dot) is always less than PD expected under random community assembly (less than the dotted horizontal line), and less than PD expected under diet- 108 dependent random community assembly (open circles). The same is true for microbial species 8 richness (number of OTUs, not plotted). The null expectation, assuming random sampling and 110 10,000 reads per host, is that individuals should have PDpop = 61.97, with an average species richness of 903 microbial OTUs observed per host. Instead, we observed an average PD = 16.65 112 (sd = 6.01) and 166.3 microbial OTUs per host (sd= 78.08), significantly lower than null expectations (p<0.0001; this figure). This implies that individuals’ microbiota are a non-random 114 sample of the microbiota available to colonize, even when accounting for diet’s likely influence microbial colonization. This inference suggests a substantial role either of stochastic community 116 assembly (e.g., priority effects, or multiple stable community states), or unaccounted-for sources of among-individual variation (e.g., immune genotype). 118 Second, the null PD based on individuals with similar diets is less than the null PD based on the whole metacommunity of microbes (open circles are below the horizontal dotted lines). 120 The resulting null diversity, PDdiet = 50.02, is 19.3% smaller than the population-wide null PDpop (p<0.0001), suggesting that diet contributes to but does not fully explain the observed low 122 within-individual microbial diversity, which is 73% smaller than population-wide null. This implies that diet does explain some of the reduced diversity within individuals, but much of the 124 low individual microbial diversity is due to factors other than diet. Finally, the quadratic effect of diet on microbial diversity can be seen for null PDdiet as a 126 function of proportion littoral carbon (panel A), and observed PD as a function of trophic position, tpos (panel B). Focusing on the diet-based null PD, expected diversity is lower for 128 generalists (intermediate diets) than either specialist (this figure), as indicated by significant diet effects on PDdiet (α p<0.0001, α2 p<0.0001, tpos p=0.0261, tpos2 p=0.0310). In contrast, only 130 tpos has a significant quadratic effect on the observed PD. Note that because observed PD depends on a quadratic interaction between and tpos, the trend plotted in Fig. S2B (which 9 132 focuses only on tpos) is not as strong as the trend in Fig. 2. Based on this result, we infer that among-individual variation in the microbiota adds noise that partially obscures an otherwise 134 strong tendency (more clearly revealed by calculating PDdiet) for intermediate diets to have lower PD. 136 138 10 140 A 25 20 15 10 Microbial phylogenetic diversity (PD) 30 p = 0.0271 0.00 0.05 0.10 0.15 0.20 0.25 Diet diversity 142 Figure S3. Microbial diversity (PD) is negatively correlated with a metric of diet diversity (G) in male stickleback. Dashed lines represent the 95% confidence interval around the 144 regression line. To calculate a measure of diet generalization, we acquired individual scores along the first principal component in bivariate isotope space (α and tpos), rescaled these to 146 range from b=0 to b=1 (min to max PC score). We measure diet generalization as G = b (1- b), which is maximized when b = 0.5 (generalists). We then used linear regression to test whether 148 PD varies as a function of G. An important caveat is that our measure of diet diversity reflects even use of littoral vs pelagic prey, but is not synonymous with prey species richness. An 11 150 individual forager might use exclusive pelagic prey but still consume diverse species of cladocera. However, because littoral prey are predominantly insect larvae while pelagic 152 zooplankton are predominantly crustaceans, littoral/pelagic generalists use a more diverse combination of prey at a deep taxonomic level (different ratios of Subphyla). In stickleback, 154 regression of PD on G confirms that microbial diversity declines with diet diversity (Fig. 2C; t = -2.29, df = 175, p = 0.0271). Note that although the effects of diet or G are statistically 156 significant, there remains substantial unexplained residual variation in PD: the correlation between G and PD is only -0.166. Adding in effects of sex and standard length and their 158 interactions explains some of the residual variation. In perch, regression of PD on G also confirmed trends found with quadratic diet effects (Table S5). There was an overall negative 160 effect of diet generalization G on microbial diversity (p=0.0033), as in stickleback, that is revealed after accounting for significant effects of size, sex, and all interactions (all p<0.05; 162 Table S5). The interaction effects are consistent with quadratic regression results: the negative correlation between G and PD is more negative in females than males (sex*G p=0.016), in 164 smaller individuals (size*G p=0.0027). Note that the range of PD plotted here differs from Fig. 2, because in the latter figure we plot quadratic regression estimates of the surface of PD, rather 166 than individual data point values. 12 0.6 0.8 0.4 Y 0.6 0.2 0.4 0.0 0.2 0.0 -1 0 1 -3 -2 D. Clostridia -1 0 1 xdata 0.4 0.2 0.4 Y 0.6 0.6 0.8 0.8 1.0 -2 C. Gammaproteobacteria xdata 0.0 0.0 0.2 Microbial Y class relative abundance Y -3 -3 168 B. Bacilli 0.8 1.0 1.0 A. Gammaproteobacteria -2 -1 0 1 2 -3 -2 -1 0 1 2 Isotopic xdata principal component axis xdata 1 Figure S4. Non-monotonic relationships between diet and the relative abundance of some 170 common microbial classes. Curves and shaded 95% confidence intervals are calculated from quadratic quasibinomial general linear models whose predictions and confidence intervals are 172 back-calculated into response variable scales. Significance for quadratic effects are (A) p = 0.007 for Gammaproteobacteria in stickleback; (B) p = 0.040 for Bacilli in stickleback ; (C) p = 0.046 174 for Gammaproteobacteria in perch, and (D) p = 0.010 for Clostridia in perch. Although these significance levels are not extremely low, there are too many such quadratic effects (>19% of 176 classes) to be explained by false positives alone (5% expected). We focus here not on the most significant models, but on the microbial classes that are found in most individuals and show a 178 wide range of relative abundances. The full set of quadratic quasibinomial GLM results are provided in Table S6. 13 50% (mixed) 100% (Chironomids) Percent littoral diet 60 40 50 C 10 20 30 Frequency 0.008 6.1% 11.4% 0 0.000 0% (Daphnia) 182 B 0.004 OTU relative abundance 0.015 0.010 0.005 0.000 OTU relative abundance A 0.012 70 180 0% (Daphnia) 50% (mixed) 100% (Chironomids) Percent littoral diet -4 -2 0 2 4 Quadratic effect of diet (t) Figure S5. Non-monotonic relationships between experimental diet and the relative abundance of some common microbial OTUs. We used quadratic quasibinomial general linear 184 models to test whether the relative abundance of gut microbial OTUs exhibit non-linear effects of diet mixing. We focus on OTUs here merely to illustrate the point that the quadratic effects in 186 Fig. S4 are not unique to any single taxonomic rank; analogous results are obtained at other taxonomic ranks. (A) The relative abundance of Pseudomonas sp (Gammaproteobacteria) is 188 significantly lower in mixed-diet than in single-diet fish (quadratic P = 0.0002), yielding a positive quadratic effect. Slight jitter is added to the horizontal axis values to distinguish 190 overlapping points. The line and shaded confidence interval are from GLM predictions; because these are back-calculated into proportions for graphical purposes, the estimated curve may not 192 match curves fit by eye. (B) The relative abundance of an OTU in the Rhodobacteraceae (Alphaproteobacteria) is more common in mixed-diet fish than in either extreme diet (quadratic 194 P < 0.0001) yielding a negative quadratic. (C) the distribution of quadratic effects from 263 OTUs. 11.4% of OTUs exhibited significant positive quadratic effects (as in A), and 6.1% 196 exhibited significant negative effects (as in B). The bias towards positive quadratic results is itself significant (proportion test, P = 0.038) and may help explain the lower microbial diversity 198 in intermediate diets. 14 Figure S6. 200 15 202 Figure S6. Overlap in the presence of microbial OTUs among food sources (Daphnia or chironomids) and stickleback fed either (A) Daphnia, (B) a mixed diet, or (C) chironomids. 204 The numbers in each area represent the number of microbial OTUs that are observed in one sample alone (non-overlapping regions) or in each of two or more samples (overlapping regions). 206 Microbial OTUs found in only one individual in the entire study were excluded. Significance of overlap between fish and diets was evaluated by a χ2 test contrasting the number of OTUs that a 208 fish sample uniquely shares with each food source, relative to expectations derived from the numbers of OTUs exclusive to each food (discounting fish). 210 212 16 Figure S7. 214 17 216 Figure S7. Effects of microbial diversity on male body condition. Host body condition was 218 calculated as the residuals of log body mass regressed on log standard length, separately for males from the lab and wild stickleback, and perch. We used path analysis to estimate the partial 220 correlations between diet (α and tpos), diet disparity (squared distance of individuals’ α or tpos values from the mean α or tpos), PD, and condition. These analyses focused exclusively on male 222 fish, as their body condition is insensitive to reproductive condition whereas female condition is highly dependent on egg mass. The resulting partial correlations are presented for (A) male 224 stickleback from Cedar Lake and (B) male perch from Lake Erken. Significant positive partial correlations are represented as blue arrows, negative correlations are red arrows, and non- 226 significant partial correlations tested in the model are grey arrows. Partial correlations are provided alongside significant effects. Asterisks indicate statistical significance: * p<0.05; ** 228 p<0.01, *** p<0.001. In wild stickleback (A) body condition was positively correlated with both the proportional littoral carbon, α, and α2, consistent with previous evidence that individuals with 230 specialized diets experience less resource competition and so have higher fitness. We also found that individuals with far-from-average tpos had higher PD, consistent with the quadratic effects 232 of diet on PD. However, we found no direct effect of PD on host condition after controlling for their joint association with diet. In perch (B) we found significant direct positive effects of a 234 littoral diet on body condition but no direct effects of diet disparity on body condition (all p>0.1). However, diet disparity had indirect effects on body condition via microbial diversity. 236 Male perch with extreme α values tend to have higher microbial diversity, whereas individuals with extreme tpos tend to have lower microbial diversity, again consistent with our quadratic 238 regression analyses. The higher microbial diversity (PD) in specialist fish, in turn, was associated 18 with lower body condition (p=0.0049). Thus, controlling for diet we find that individuals with 240 higher microbial diversity tend to have lower body mass for a given size. The opposite trend was found in laboratory-reared male stickleback (C) fed either littoral or pelagic prey. We carried out 242 an additional laboratory diet manipulation using only reproductive male stickleback (N = 50) equally split into chironomid- and Daphnia-fed treatments. The focus on males only was 244 intended to mitigate body condition variation due to reproductive status in females, whose shortterm changes in ovary mass generate substantial residual variation in condition. Each treatment 246 was applied to 4 aquaria (no significant effect) for two months, and males microbiota were identified as explained in the Methods. Green and blue points indicate chironomid (littoral) and 248 Daphnia (pelagic) diets, respectively. The black regression line represents the overall effect of PD on condition, green and blue lines for each diet treatment separately (dashed line indicates a 250 non-significant effect). We found higher body condition in chironomid-fed (littoral) males than in Daphnia -fed (pelagic) males. Chironomid-fed males also exhibited higher microbial diversity 252 (PD) than Daphnia -fed males (p=0.0001). Focusing on PD variation within diet treatments we found a significant positive association between microbial diversity and host condition 254 (ANCOVA, PD effect p=0.0019; no diet*PD interaction p=0.488). 19