Supplementary Methods Assessing microbiota similarity across Megalomyrmex and attine ants We investigated clustering patterns of ant microbiotas using both network and phylogenybased approaches. In the first type of analysis, samples and OTUs (or unique sequences) were represented as two types of nodes in a bipartite network in which OTU-nodes were connected via edges to the sample-nodes where OTUs were found. To cluster the samples in a network, we used a stochastic spring-embedded algorithm in Cytoscape 2.8.3 (Shannon et al. 2003), where nodes act as physical objects that repel each other, and connections are springs with specific constants and resting lengths. The resulting nodes minimize the forces in the network and cluster samples based on the number of shared OTUs, weighted according to the number of sequences within each shared OTU. The second type of analysis was complementary to the network approach, but phylogenetically informed after we constructed distance matrices based on weighted and unweighted UniFrac metrics (Lozupone & Knight 2005). In pairwise comparisons between all ant samples, we calculated the fraction of branch lengths shared between communities within the phylogenetic tree built from all the 97% OTUs and from all the unique sequences identified in ant samples. To assess the robustness of sample clustering we used jackknifing to construct 100 reduced trees in each simulation after picking 3,000 random sequences from each sample (this accounted for ca. 75% of the sequences in the sample that had the lowest sequencing depth). Mean matrices of all jackknifed replicate matrices from weighted and unweighted UniFrac analyses were then calculated and clustering results were further visualized by Principal Coordinates Analysis (PCoA). To assess clustering patterns of Megalomyrmex and attine ants microbiotas, we divided our samples in different combinations: (i) all Megalomyrmex vs. all attine ants, (ii) the five 1 sampled pairs of attine hosts and their specific Megalomyrmex parasites (S. amabilis – M. symmetochus; T. zeteki – M. adamsae; C. longiscapus – M. wettereri; C. costatus – M. mondaboroides and M. silvestrii; C. cornutus – M. mondabora) and all the free-living Megalomyrmex as a sixth category, (iii) social parasites, attine hosts and free-living Megalomyrmex as three categories. We then tested whether the overall variation between categories was significantly higher than the variation within, using network-based analyses and UniFrac analyses at both the 97% OTUs and the unique sequences levels. For the network analyses we computed all pair-wise χ² values between ant samples from the two tables containing the number of sequences belonging to each 97% OTU and each unique sequence found in each sample (Table S2, Supporting information). We then separately computed the average χ² values obtained from sample pairs belonging to different categories (variation between categories) and from pairs belonging to the same categories (variation within categories), and calculated the difference between these values. Similarly, we calculated all the average within-category and between-category UniFrac distances from the mean weighted and unweighted UniFrac matrices at both 97% OTUs and unique sequences levels, and used the between-within differences as “observed” results. The same values were then recalculated after 10,000 Monte Carlo permutations of the tables and the UniFrac distance matrices, and P values were calculated as the fraction of times a permutation resulted in a value more extreme than the “observed” one in a one-tailed t test. P values of the UniFrac analyses were corrected for multiple hypotheses testing via the false discovery rate (FDR) procedure (Benjamini & Hochberg 1995), as these analyses also allowed testing for significant differences between all possible combinations of the different categories. 2 Library preparation of the MiSeq Illumina diet experiment samples Bacterial DNA from the ant and fungus garden samples taken from the subcolonies in the diet manipulation experiment was amplified using primers 341F/806R. PCR was performed in a total volume of 20 μL with 4 μL 5X Phusion HF buffer, 0.4 μL 10 mM dNTPs, 0.2 μL Phusion Hot Start DNA Polymerase (2 units/μL, Finnzymes), 1 μL of each primer (10 μM), 1 μL of template DNA (diluted when needed) and MilliQ water with thermal cycle conditions: 98 °C for 30 s, followed by 35 cycles of 98 °C for 5 s, 56 °C for 20 s and 72 °C for 20 s, and a final extension at 72 °C for 5 min. Samples were visualized on a 1.3% agarose gel containing GelRed (Biotium) for 45 min. The specific bands were cut and purified using the Montage DNA gel extraction kit (Millipore). Concentrations were measured with PicoGreen and adjusted with MilliQ water to be equal across samples. Two µL of the diluted PCR products were added to a PCR mix containing: 2 µL 10X AccuPrime PCR Buffer II (15 mM MgCl2, Invitrogen), 0.12 µL AccuPrime Taq DNA Polymerase (2 units/µL, Invitrogen), 1 µL of MS_341f_F IndexNo (12) and MS_806r_R IndexNo (20) primers (10 µM; Sundberg et al. 2013), 13.88 µL MilliQ water to a total of 20 µL. The PCR incubation conditions were: an initial activation of the Hot Start Polymerase at 94 °C for 2 min, followed by 15 cycles of 94 °C for 20 s, 56 °C for 20 s and 68 °C for 30 s, and final extension at 68 °C for 5 min. PCR products were incubated at 70 °C for 3 min and moved directly to ice, then purified by Agencourt AMPure XP (Beckman Coulter). Concentrations were measured with PicoGreen and samples were pooled in one tube adding the same amount of DNA from each sample. Pooled samples were concentrated using the DNA clean and concentrator-5 kit (Zymo Research) and sequencing was performed on a MiSeq Illumina sequencing platform. 3 References Benjamini Y, Hochberg Y (1995) Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society, Series B, 57, 289–300. Lozupone C, Knight R (2005) UniFrac: a new phylogenetic method for comparing microbial communities. Applied and Environmental Microbiology, 71, 8228–8235. Shannon P, Markiel A, Ozier O et al. (2003) Cytoscape: a software environment for integrated models of biomolecular interaction networks. Genome Research, 13, 2498– 2504. Sundberg C, Al‐Soud WA, Larsson M, Alm E, Yekta SS, Svensson BH, Sørensen SJ, Karlsson A (2013) 454 pyrosequencing analyses of bacterial and archaeal richness in 21 full‐scale biogas digesters. FEMS Microbiology Ecology, 85, 612–626. List of GenBank accessions used to build bacterial phylogenies Entomoplasmatales (Fig. 5C) Accession # Organism JQ914111.1 Uncultured Spiroplasma sp. clone V4-9 from Eurygaster integriceps (shield bug) DQ360069.1 Spiroplasma sp. SHRIMP from Penaeus vannamei (shrimp) DQ917753.1 Spiroplasma sp. CRAB from Eriocheir sinensis (crab) GU129148.1 Uncultured Spiroplasma sp. clone HS4C1 form Kerria lacca (scale insect) AJ006775.1 Spiroplasma sp. from Adalia bipunctata (beetle) EU344953.1 Uncultured Spiroplasma sp. clone Hg5-43 from Hepialus gonggaensis (moth) AB548143.1 Secondary endosymbiont of Curculio sikkimensis (beetle) JN100091.1 Spiroplasma endosymbiont strain J73E from Curculio elephas (beetle) JF266585.1 Uncultured Spiroplasma sp. clone EDB516_spider2 from unidentified spider GU815121.1 Uncultured bacterium clone P(s)9 from Harpalus pennsylvanicus (beetle) AJ245996.1 Spiroplasma sp. from Danaus chrysippus (butterfly) NR_104852.1 Spiroplasma ixodetis strain Y32 from Ixodes pacificus (tick) AB553862.1 Spiroplasma symbiont of Laodelphax striatellus (planthopper) AJ132412.1 Spiroplasma sp. from Harmonia axyridis (ladybird) KC424775.1 Uncultured bacterium clone 2-43 from Meimuna mongolica (cicada) HM449988.1 Uncultured bacterium clone PG48 from Puto albicans (mealybug) AB048263.1 Spiroplasma sp. from Acyrthosiphon pisum (pea aphid) JF266577.1 Uncultured Spiroplasma sp. clone Aga33Gut from Agathemera claraziana (phasmid) AB030022.1 Spiroplasma symbiont of Antonina crawii (pseudococcid) AY837733.1 Uncultured Spiroplasma sp. clone D2.2.14 from Anopheles sp. (mosquito) EF121346.1 Uncultured bacterium isolate RFLP pattern 10 from Ctenocephalides felis (cat flea) AM087471.1 Spiroplasma sp. from Anisosticta novemdecimpunctata (ladybird) FJ657247.1 Spiroplasma endosymbiont isolate MW09 from Drosophila ananassae (fruit fly) AY569829.1 Spiroplasma sp. 'Gent' from Fannia manicata (little housefly) JF266581.1 Uncultured Spiroplasma sp. clone Agami18 from Agathemera claraziana (phasmid) HM996767.1 Uncultured Entomoplasmatales bacterium clone UncEnto-#24 from Dorylus molestus (ant) HM996747.1 Uncultured Entomoplasmatales bacterium clone UncEnto-#4 from Pheidole sp. (ant) 4 JQ768460.1 Spiroplasma sp. crk from Gryllus bimaculatus (cricket) DQ860101.1 Spiroplasma platyhelix strain PALS-1 from Pachydiplax longipennis (dragonfly) HM996776.1 Uncultured Entomoplasmatales bacterium clone UncEnto-#33 from Neivamyrmex gibbatus (ant) HM996770.1 Uncultured Entomoplasmatales bacterium clone UncEnto-#27 from Neivamyrmex carolinensis (ant) GQ275136.1 Uncultured bacterium clone #160 from Vollenhovia sp. (ant) HM996753.1 Uncultured Entomoplasmatales bacterium clone UncEnto-#10 from Vollenhovia sp. (ant) GQ275127.1 Uncultured Entomoplasmatales bacterium clone #151 from Trachymyrmex jamaicensis (ant) Bartonellaceae (Fig. 5D) Accession # Organism HM108369.1 Uncultured Rhizobiales bacterium clone SHAI010 from Apis andreniformis FJ477639.1 DQ113413.1 Uncultured Rhizobiales bacterium clone UAB-90 from Dolichoderus sp. voucher KC-A011-07 Uncultured Bartonella sp. from Dolichoderus coniger RE2 FJ477662.1 Uncultured Rhizobiales bacterium clone UAB-113 from Terataner sp. voucher CASENT0500172 DQ113412.1 Uncultured Bartonella sp. from Tetraponera binghami HF3 DQ113409.1 Uncultured Bartonella sp. from Tetraponera attenuata RT3 KF249673.1 FJ477551.1 Uncultured Rhizobiales bacterium clone TWC2P from Trachymyrmex urichii (ant) Uncultured Rhizobiales bacterium clone 83f from Cardiocondyla emeryi voucher RA0330 FJ477647.1 Uncultured Rhizobiales bacterium clone 116m from Pheidole sp. BCA-01 voucher RA0206 FJ477645.1 Uncultured Phyllobacteriaceae bacterium clone UAB-96 from Pheidole sp. BCA-01 voucher RA0206 KF730289.1 Uncultured Rhizobiales bacterium clone cv1-B-04 from Cephalotes varians (ant) KF730312.1 Uncultured Rhizobiales bacterium clone Queen-09 from Cephalotes varians (ant) KF249674.1 Uncultured Rhizobiales bacterium clone TWC4P from Trachymyrmex urichii (ant) KF250072.1 Uncultured Rhizobiales bacterium clone TNWB4I from Trachymyrmex urichii (ant) KF250075.1 Uncultured Rhizobiales bacterium clone TNWC10G from Trachymyrmex urichii (ant) KF248299.1 Uncultured Rhizobiales bacterium clone AWE11F from Atta laevigata (ant) KF248243.1 Uncultured Rhizobiales bacterium clone AWG5F from Atta laevigata (ant) KF248407.1 Uncultured Rhizobiales bacterium clone AWB5E from Atta laevigata (ant) Wolbachia wsp (Fig. S8, Supporting information) Accession # Organism AF472564.1 Wolbachia endosymbiont of Acromyrmex echinatior (ant) KC137169.1 Wolbachia endosymbiont of Heteroponera microps (ant) clone 50d KC137194.1 Wolbachia endosymbiont of Megalomyrmex latreillei (ant) clone 9-10 EF612772.1 Wolbachia endosymbiont of Nephila clavata (Joro spider) AY878106.1 Wolbachia endosymbiont of Solenopsis daguerrei (ant) strain wSdagB4 JQ414027.1 Wolbachia endosymbiont of Acromyrmex octospinosus (ant) isolate colony Ao483 AF020084.1 Wolbachia sp. Wdei from Trichogramma deion (parasitoid wasp) Texas 223 AF071924.1 Wolbachia sp. wKayB from Trichogramma kaykai (parasitoid wasp) JT6-3 AF020080.1 Wolbachia sp. Wstri from Laodelphax striatellus (small brown planthopper) AF020083.1 Wolbachia sp. Wcon from Tribolium confusum (confused flour beetle) AJ130715.1 Wolbachia sp. from Adalia bipunctata strain Z (two-spot ladybird) AJ130714.1 Wolbachia sp. from Adalia bipunctata strain Y (two-spot ladybird) 5 AB588928.1 Wolbachia endosymbiont of Xyleborus schaufussi (bark beetle) strain wXsc HM747157.1 Wolbachia endosymbiont of Solenopsis invicta (ant) haplotype H37 HM747161.1 Wolbachia endosymbiont of Solenopsis megergates (ant) haplotype H42 AF472560.1 Wolbachia endosymbiont of Acromyrmex insinuator (ant) H2 AF020085.1 Wolbachia sp. Wori from Tagosedes orizicolus (Delphacid planthopper) AF020076.1 Wolbachia sp. WcauB from Cadra cautella (almond moth) AF020069.1 Wolbachia sp. Wma from Drosophila mauritiana (fruit fly) strain Watsonville AF020060.1 Wolbachia sp. Wpip from Culex quinquefasciatus (southern house mosquito) AF020079.1 Wolbachia sp. Wmors from Glossina morsitans morsitans (savannah tsetse fly) AF020081.1 Wolbachia sp. WvitA from Nasonia vitripennis (parasitoid wasp) AF020078.1 Wolbachia sp. Wcen from Glossina morsitans centralis (tsetse fly) AJ271121.1 Wolbachia sp. from Drosophila bifasciata (fruit fly) AF288986.1 Wolbachia sp. wKue from Spalangia cameroni (filth fly parasitoid) AF452645.1 Wolbachia endosymbiont of Trichogramma brassicae (parasitoid wasp) strain Wbra12 AY462855.1 Wolbachia endosymbiont of Tripteroides bambusa (mosquito) AF020071.1 Wolbachia sp. Wuni from Muscidifurax uniraptor (parasitoid wasp) AF020063.2 Wolbachia sp. Wmel from Drosophila melanogaster (fruit fly) strain Aubiry 253 AF020066.1 Wolbachia sp. WmelH from Drosophila melanogaster (fruit fly) strain Harwich AF020067.1 Wolbachia sp. Wcof from Drosophila simulans (fruit fly) strain Coffs Harbour AF020058.1 Wolbachia sp. WalbA from Aedes albopictus (asian tiger mosquito) strain Houston AF020062.1 Wolbachia sp. Wri from Drosophila auraria (fruit fly) strain 17.8 AF020070.1 Wolbachia sp. Wri from Drosophila simulans (fruit fly) strain Riverside AF243437.1 Wolbachia sp. wrichteriA from Solenopsis richteri (ant) AF020075.1 Wolbachia sp. WcauA from Cadra cautella (almond moth) AF020068.1 Wolbachia sp. Wha from Drosophila simulans (fruit fly) strain Hawaii AF020082.1 Wolbachia sp. Wpap from Phlebotomus papatasi (sand fly) strain Israel AY486091.1 Wolbachia endosymbiont of Diaea circumlita (flower spider) strain wDiacir3 AJ276615.1 Wolbachia endosymbiont of Dysdera erythrina (woodlouse spider) AJ252062.1 Wolbachia endosymbiont of Dirofilaria immitis (filarial nematode) AJ276497.1 Wolbachia endosymbiont of Onchocerca gutturosa (filarial nematode) AJ252180.1 Wolbachia endosymbiont of Wuchereria bancrofti (filarial nematode) 6