Introduction

Temperature modulates many physiological processes and has direct effects on development, survival and reproduction of any organism1,2. Ectotherms lack the ability to regulate their body temperature by physiological means and are particularly affected by temperature variation3. Their thermoregulation is thus often mediated through behavior4 (Stevenson, 1985) so ectotherms tend to occupy environmental niches close to their optimal thermal conditions to survive and propagate. Every organism exhibits a thermal preference (Tp), which is the preferred body temperature or temperature range that is chosen in the absence of other ecological constraints5. However, estimates of Tp are by no means absolute, but may be strongly influenced by interactions with ecological factors and even with symbionts. Endotherms, for example, combat bacterial and viral infections with fever by physiologically increasing their body temperature outside the thermal optimum of their infectious agents. Several studies show that also ectotherms employ similar behavioral strategies by changing their Tp6,7,8,9,10,11. For example, crickets actively seek higher temperatures when infected with the pathogenic bacterium Serratia marcescens, which may have physiological effects similar to fever in response to pathogenic infections12. However, also the opposite behavior, i.e., behavioral chill, has been reported for poikilotherm organism as a mechanism to fight pathogens, for example, in Drosophila13.

In particular, three recent studies investigated changes of thermal behavior in Drosophila melanogaster infected with the bacterial endosymbiont Wolbachia14,15,16. Two of these studies found that, depending on the Wolbachia variant, infected flies chose colder temperatures than uninfected individuals14,15. While such a behavioral response is probably strongly influenced by environmental and experimental conditions and not a general pattern16, these findings may suggest that the hosts can alleviate detrimental effects of high titer infections by choosing ambient temperatures outside the optimal physiological range of the symbiont. It, however, remains uncertain if such behavioral patterns are restricted to adults or are also found at juvenile life stages. Finding the optimal temperature for development is pivotal since any major disturbance during juvenile stages might severely decrease survival and reproduction chances of the imago17. Manipulating thermal preference at this life stage of the host might thus be risky yet beneficial for the microbial symbiont, by “setting up” its thermal environment early in the host development. However, to the best of our knowledge, no study has yet investigated the effects of Wolbachia on Drosophila Tp at juvenile life stages.

Measuring thermal behaviour in Drosophila is complex, and many environmental factors and experimental noise that potentially influence the Tp have to be accounted for. These can include, for example, environmental factors such as humidity, light, olfactory and acoustic cues, but also properties of the experimental design, such as age of the flies, developmental temperature, number of specimens and the design of the apparatus that measures thermal preference, as comprehensively reviewed in Dillon et al.18. This issue becomes evident when comparing the divergent results of the three aforementioned studies that specifically assessed the Tp of D. melanogaster in the presence of Wolbachia infections14,15,16. The absolute Tp values for the same Wolbachia strain vary strongly among the studies (up to 5–6 °C), which is potentially influenced by different host genetic backgrounds, experimental conditions or temperature ranges used in these studies. Assessing the effects of different environmental factors on thermal preference in the Wolbachia-Drosophila system is therefore crucial for an informed analysis and interpretation of behavioral measurements.

Here, we demonstrate that several environmental factors, such as humidity, food, and the structure of the thermal gradient device have a major impact on Tp in adult D. melanogaster flies in the context of strain-specific Wolbachia infections. Additionally, we investigate—for the first time—the effect of Wolbachia on juvenile Tp and find that it is not affected by infection in early and late fly larvae and at pupariation.

Materials and methods

Fly lines

In our experiments, we used four highly inbred, long-term laboratory strains of D. melanogaster which were uninfected (w-) or infected with either two of the most common natural Wolbachia variants (wMel and wMelCS) or with the wMelPop lab-variant that were previously investigated by Truitt et al.14 for thermal preference. All fly lines were initially established by Luis Teixeira19 in a DrosDel w1118 isogenic background. Flies were maintained on a custom fly medium based on agar–agar, molasses, and yeast at 24 °C with 12 h:12 h light:dark cycle and an average humidity of 50%. Prior to experiments, the infection status was confirmed by PCR using Wolbachia-specific primers amplifying parts of the wsp gene: forward-tggtccaataagtgatgaagaaactagcta and reverse-aaaaattaaacgctactccagcttctgcac20. Wolbachia variants infecting the fly strains were distinguished with diagnostic VNTR-141 PCR primers: forward-ggagtattattgatatgcg and reverse-gactaaaggttattgcat. PCR products vary in length among Wolbachia strains21.

Thermal gradient machine

To carry out Tp measurements in D. melanogaster larvae, during pupariation and in adult flies, we designed and built a new thermal gradient apparatus with two narrow arenas for precise temperature measurements and with limited space for movement along the thermal gradient. The “plate” device consisted of an elongated aluminum plate as the bottom piece resting on two peltier elements, which are either heating or cooling to generate a temperature gradient. On top, we used an equisized plexiglass plate as the cover, which contained holes to apply test subjects. Two narrow arenas with 6 mm heights and widths were established by placing three thin plexiglass dividers between the two plates, which contained holes for inserting temperature sensors. We restricted the length of the arena to 30 cm by adding foam stoppers at the ends of each lane to prevent flies from escaping and to maintain airflow. In addition, Whatman paper was used as a bottom layer to cover the aluminum plate in the arenas. We built two identical devices with the aforementioned design, which allowed us to investigate Tp in four arenas in parallel during one experimental assay (see https://github.com/capoony/DrosophilaThermalGradient for a detailed description).

For Tp measurements in adult flies, we additionally designed and built a second “tube” thermal gradient device with a tubular shape following Rajpurohit and Schmidt22 and complementing the design as described in Truitt et al.14. This apparatus consisted of a central cylindrical aluminum rod connected to quadratic aluminum bases at both ends that conduct heat from two peltier elements, which are either heating or cooling. The aluminum rod was placed inside a transparent plexiglass tube, which left an open space of approximately 4 cm in diameter. The plexiglass tube was attached to the aluminum rod with Teflon covers which enclosed the fly arena on both sides. The plexiglass tube contained several holes to insert flies and to attach sensors for temperature measurement. A Whatman paper was inserted right above the aluminum rod to divide the arena into two halves. Flies were kept in the upper half, which facilitated imaging the location of the flies within the cylindrical arena around the central rod from atop during Tp measurements (see https://github.com/capoony/DrosophilaThermalGradient for a detailed description).

Peltier elements (P&N Technology, Xiamen Fujian China) generating heat were attached to small heat sinks (Fischer Electronic, Germany) connected to a ventilator (Oezpolat, Germany) to stabilize the temperature. Cooling peltier elements produce excess waste heat and were therefore placed on top of a bigger heat sink (Fischer Electronic, Germany), which was partially submerged in a bowl with cold water that was constantly cooled down by pipes supplying cold water from a distant water bath (fbc630, Fisher scientific, USA).

20 min prior to each experiment, we attached the peltier elements to power supplies set to 2 V and 3 V for cooling and heating, respectively, to stabilize the temperature gradient within the thermal gradient apparatus. We found that the temperature gradient remained stable for at least 1 h, which generally exceeded the duration of an experimental run (app. 20–30 min). After each experiment, the plexiglass parts of the apparatus were cleaned with soap and hot water to remove any potential pheromones and other odorants, which might interfere with thermal preference behavior of flies.

Each experiment was carried out in a dark isolated room with no, or very low noise distraction. The room was equipped with air-conditioning to keep the ambient temperature stable at 21–23 °C, which was constantly monitored with a data logger. The temperature within the devices was measured at three points (in the center and at the hot and cold edges) with digital thermal sensors (Analog devices, USA). The data from thermal sensors were collected with a custom python script on a Raspberry pi 3B + computer (Raspberry Pi Foundation, UK) in 10 s intervals and saved as text files. The position of the flies within the devices were assessed by an infrared camera attached atop of the thermal gradient apparatus. Images were taken every 30 s and saved to the Raspberry pi computer for each run. We developed a custom python script to estimate Tp for every fly using information of an individual's position relative to the linear temperature gradient between the temperature measurement points. The coordinates of each individual fly and of the thermal sensors were manually assessed in ImageJ23 based on infrared images captured 20 min after the onset of each experiment. The python scripts for quantifying thermal preference from the coordinates including a test dataset, a detailed description and all raw images from the thermal preference assays are available at GitHub (https://github.com/capoony/DrosophilaThermalGradient).

Temperature preference measurements in larvae

To assess larval Tp, we used early and late 3rd instar larvae, 72 h, and 120 h after egg laying (AEL), respectively, and focused on two fly strains that were either uninfected (w-) or infected with wMelCS for thermal preference experiments (see Fly lines section in Materials and methods). To obtain tightly synchronized cohorts of larvae, we maintained 40–50 adult female flies at 24 °C in glass vials with the medium for 3–6 h for egg laying and then transferred these to a fresh medium for collecting another replicate. After 72 or 120 h, larvae were moved to an 18% sucrose solution (in dH2O) using a spatula. Floating larvae were gently collected with a cut 1 mL pipette tip and transferred to dH2O. After washing three times with dH2O, larvae were transferred into empty plastic Petri dishes (d = 2.5 cm) and kept for 10–20 min to recover from the stress.

For Tp measurements, we covered the bottom of each lane in the thermal gradient machine with a 1 mm layer of 2% agarose gel to create a habitable environment for larvae that allowed them to crawl freely. We started the experiment when the thermal gradient was constant and linear from 18 to 28 °C (1 °C per 3 cm). Experiments were carried out in a dark room at 24–25 °C, with 30% humidity at different times of the day (from 11 am to 4 pm). Each run included two replicates of the w- and the wMelCS lines. 50–100 larvae were introduced in the middle of each lane (23 °C) with a wet brush and a Plexiglass cover was applied on top of the machine to prevent larvae from escaping. The position of larvae was analyzed on site after 30 min by quantifying the numbers of larvae located in a certain temperature zone marked with a pen beforehand.

Measurement of pupariation Tp

For assessing Tp at pupariation, we used late 3rd-instar larvae, 140 h after egg laying (AEL) close to pupariation. Again, we focused on the w- and wMelCS strains for the experiments and obtained synchronized cohorts of 140 h-old larvae as explained above.

For Tp measurements, we covered the bottom of the four lanes of the gradient machine with a 1 mm thick sheet of odorless black plastic to create a contrasting background and to supply a solid surface for pupariation. We inserted larvae when the gradient was constant and linear from 18 to 28 °C (1 °C per 3 cm). Experiments were carried out in a dark room at 24–25 °C with 30% humidity for approximately 12 h until every larva had pupariated. Each run included two replicate lines at the same time (2 times w- and 2 times wMelCS). 50–100 larvae were introduced in the middle of the lane (23 °C) by wet brush and a plexiglass cover was used to seal the top of the machine to prevent larvae from crawling out of the arenas. Thermal preference at pupariation was analyzed after 6–12 h by quantifying the numbers of pupae in certain temperature zones as described above.

Temperature preference measurements in adults

Prior to the experiments, we selected cohorts of 20 females and 20 males, which were 1 week old (± 2 days), for each of the four strains (w-, wMel, wMelCS and wMelPop). We transferred these to fresh glass vials with medium by gently applying CO2 and then allowed the flies to recover for two days. To reduce the possibility of an experimenter bias, we anonymized the ID’s of the cohorts prior to experiments by an independent researcher. For each assay on the “plate” device, we included one replicate of all four fly lines and placed each of the groups in one of the four lanes. For experiments using the “tube” device, we carried out two replicate assays in parallel, using randomly drawn cohorts. Flies were gently collected from the vial with a handmade fly aspirator and transferred to the thermal gradient apparatus through a hole in the center. Then, the hole was tightly sealed with cotton, the light was turned off and measurements were taken during 20 min. An image of the whole apparatus was taken every 30 s with an infrared camera attached atop the setup.

Because time of the day can have a strong influence on Tp in Drosophila24, we performed a maximum of 4 runs per day to avoid potential bias from circadian rhythms. The time of the runs during the day was usually as follows: first two runs from 10 to 12 am, last two runs from 1 pm to 3.30 pm. To quantify Tp of individual flies in the arena, we used the images of fly locations taken 20 min after the onset of the experiment similar to Truitt et al.14.

In addition to the experiments outlined above, we sought to test how environmental variation influences Tp. We accounted for four different factors: humidity, light, food, and type of the gradient machine. All four factors were tested in at least three replicates with the “tube” device, except for the last one where both types were used for comparison. When testing for the effects of humidity, we used a standard humidifier to increase the humidity from 30%, which we usually measured without any adjustment, to stable 60% humidity in the test room. To test the influence of light on thermal preference, we positioned the gradient machine at the center above a ceiling lamp and performed thermal preference runs with the light on and off using different biological replicates. When testing for the effect of food quality on Tp, we kept the flies for at least three generations on different diets before conducting the experiment. We compared the effects of our in-house food recipe, described above, to Carolina 4–24 instant food, obtained directly from the manufacturer (Carolina, USA). To test how the type of device affects Tp, we combined the data of the runs in the two different devices carried out in the same room with similar ambient temperatures to keep environmental conditions consistent. The analysis of images taken under infrared light did not allow to distinguish between sexes. Since differences in Tp has not been reported in Drosophila melanogaster25,26, we do not assume that ignoring the factor “sex” would lead to biased results.

Statistical analyses

The effects of Wolbachia infection and other environmental factors on Tp were analyzed using generalized linear mixed models (GLMMs) with a Poisson error structure in R27 based on the “glmer” function in the lme4 package28. In our models, we considered Tp of every individual as the dependent variable, and infection type as the fixed factor. Moreover, we always included the factor replicate experiments nested within infection type as random factors in each of our models. For the larval Tp experiment, we additionally included the larval age (72 h and 120 h) as a fixed factor and the interaction of larval age with infection status in our model. Moreover, for most of the models, we included the time of the run of each replicate during the day as a random factor. We used the anova function in R to test for a significant effect of infection status on thermal preference and calculated a Type-III analysis of deviance comparing nested models to test for significant effects of fixed factors and interaction in the Tp experiments. Whenever the factor infection status had a significant effect, we performed post-hoc tests using Tukey’s HSD method as implemented in the emmeans package30. We also inferred the skewness of Tp distributions using the moments package31 and compared the average skewness among experimental setups with Wilcoxon Rank tests in R. All R code can be found at https://github.com/capoony/DrosophilaThermalPreference.

Results and discussion

Wolbachia infection has no effect on Tp in 3rd-instar Drosophila larvae and on pupariation Tp in D. melanogaster

Using the newly designed thermal gradient apparatus (see Materials and Methods), we found that Tp in early (72 h AEL; n = 281) and late (120 h AEL; n = 658) 3rd-instar larvae significantly shifted from a median Tp of 22–23 °C to a median Tp of 19 °C (see Table S1) with progression of development (GLMM: p = 2.8e−8, x2 = 34.8, df = 2; Table 1A, Fig. 1A). Our results were consistent with previous findings32,33. However, we neither observed an effect of Wolbachia on Tp in 3rd-instar larvae (GLMM; p = 0.34, x2 = 2.1, df = 2; Table 1A; Fig. 1A) nor an interaction of Wolbachia with larval age (GLMM; p = 0.17, x2 = 1.9, df = 1). Since many larvae clustered at the coldest spot at the wall in the gradient machine (18–19 °C), we repeated the experiment for the 120 h age class, which exhibited lower Tp, and extended the lower temperature range to 15 °C. This extended analysis of 529 infected and 332 uninfected 3rd-instar larvae at 120 h AEL similarly showed no effect of Wolbachia infection on Tp of the host (GLMM: p = 0.38, x2 = 0.76, df = 1; Fig. S1, Table 1B), although the median Tp decreased by approximately 1 °C with the majority of larvae of both infection types (w- and wMelCS) clustering at temperatures between 16 and 18 °C (median Tp of 18 °C; Table S1).

Table 1 The influence of Wolbachia infections on Drosophila Tp at different stages of development.
Figure 1
figure 1

Thermal preference (Tp) of early and late Wolbachia-infected D. melanogaster 3rd-instar larvae and larvae at the onset of pupariation. (A) Temperature shift in early and late 3rd-instar larvae that were either uninfected (w-; grey) or infected with wMelCS (red), 72 h and 120 after egg laying (AEL) respectively (see also Fig. S1 and Table 1). (B) Tp of D. melanogaster larvae at the onset of pupariation (140 h AEL) for both infection types (see also Table 1). Note the absence of Wolbachia effects on thermal preference at all larval stages.

Pupariation in Drosophila is a crucial developmental stage during which the fly is immobilized for several days and undergoes complete metamorphosis. Thus, for larvae to properly develop choosing the optimal pupariation temperature is of great importance18,34. We analyzed the Tp of 192 infected and 142 uninfected larvae about to pupariate (140 h AEL; Table S1). In comparison to Tp in late 3rd-instar larvae (median Tp of 18 °C for both infection types; Table S1), the pupariation Tp shifted to warmer temperatures (Fig. 1B, median Tp of 20 °C for uninfected, and 21 °C for infected individuals; Table S1). However, similarly to 3rd-instar larvae, we found no significant effect of Wolbachia on thermal preference at pupariation stage (GLMM: p = 0.64, x2 = 0.21, df = 1; Table 1C).

The absence of Wolbachia effects on Tp in early and late 3rd-instar larvae and on pupariation Tp might indicate that infection does not impose significant costs at least in the developmental stages investigated here. It might be correlated with bacterial titer, which is known to influence the fitness of symbiotic association when it reaches high levels35,36,37,38,39. Although little is known about Wolbachia titer dynamics during fly development and in spite of yet undiscovered effects of Wolbachia infections during larval development, our findings could imply dormancy of infection at juvenile stages of the host. Strunov et al.37, for example, showed that the titer of the pathogenic wMelPop strain in D. melanogaster is significantly lower in larvae than in the imago and stable across development without any effects of rearing temperature. However, an influence of temperature on Wolbachia titer has been previously observed in adults after metamorphosis40,41, indicating that bacterial multiplication and pronounced interaction with the host may take place during late pupariation stage. In line with this hypothesis, it was shown that Wolbachia interferes with pheromone production in females during pupariation and affects female-to-male communication42. Additionally, two recent papers demonstrated the absence of Wolbachia effects on locomotion and fitness at juvenile stage of wild-caught D. nigrosparsa43 and D. melanogaster flies44. The absence of Wolbachia effects on host juvenile traits is challenged by a study, which reported stable abundance of Wolbachia transcripts at all stages of host development45, although there was no data on translation of the transcripts. Thus, Wolbachia have presumably no or very low and undetected effects on developing flies. Additionally, other cues like foraging for food46 might represent stronger behavioral stimuli, which could mask subtle effects of Wolbachia on thermal behavior.

Wolbachia infection has subtle effects on thermal preference in adult flies that are influenced by the environment and experimental design

Using our new experimental setup, we sought to reproduce previous experiments which reported that Wolbachia infection can lower thermal preference in adult D. melanogaster flies depending on the Wolbachia variant studied14,15, but see16. We used the same fly lines, initially established by Teixeira et al.19, as examined by Truitt et al.14. We investigated five replicate cohorts of each fly line (w-, wMel, wMelCS, and wMelPop) with our new thermal gradient device under highly controlled environmental conditions. Unexpectedly, we were unable to reproduce the previous results in Truitt et al.14, since none of the lines differed in thermal preference (GLMM: p = 0.35, x2 = 3.29, df = 3; Table1D; Fig. 2). Median Tp was 18.3 °C, 18.8 °C, 18.1 °C, and 18.2 °C for w-, wMel, wMelCS, and wMelPop, respectively (Table S1). The variation among the replicates was quite high with 2.4–3 °C standard deviation among the mean Tp, depending on the infection type studied.

Figure 2
figure 2

Thermal preference of adult D. melanogaster with different infection types. Boxplots showing the median Tp of flies that were either uninfected (w-) or with three different Wolbachia types (wMel: blue; wMelCS; red and wMelPop: orange).

To rule out that the absence of Tp variation among strains infected with different Wolbachia variants is an artifact of our experimental setup, we newly built a device similar to the design in Truitt et al.14 and repeated the Tp assays. Overall, median Tp was approximately 3 °C higher than the measurements from the “plate” device (21.7 °C, 22 °C, 21.5 °C and 21.5 °C average Tp for w-, wMel, wMelCS, and wMelPop, respectively; Table S1), which indicates a strong influence of the design on absolute Tp (GLMM: p < 2.2e−16, x2 = 748.6, df = 4; Table 2A). Additionally, we found significant differences among infection types (GLMM: p < 0.0044, x2 = 18.88, df = 3; Table 2A), albeit in the opposite direction according to our expectations: the Tp of the wMel variant increased by approximately 1 °C compared to w-(Tukey’s post hoc test: p < 0.003; Table S2). In contrast, wMelCS and wMelPop variants did not show any effect on Tp compared to the uninfected control lines (Tukey’s post hoc test: p > 0.05; Table S2), which is in stark contrast to substantial Tp differences (2–4 °C) among variants previously described by Truitt et al.14. Thus, despite using a similar design for the thermal gradient device as in Truitt et al.14, we were not able to reproduce the previously obtained results. Keeping the lines in the lab for 4–5 years with high inbreeding prior to the repeated thermal gradient assays might have potentially influenced the results through mutation accumulation, titer reduction or other unknown genetic factors47. Moreover, differences in the environmental conditions during our experiment and the experiments in Truitt et al.14 may strongly confound thermal behavior. For example, the experiments in Truitt et al.14 were neither controlled for light cues nor for the effects of humidity nor ambient temperature variation. While the experiments in Arnold et al.15 were carried out in complete darkness, these assays were also neither controlled for humidity variation nor ambient temperature variation. Such environmental factors may have a strong influence on behavior during experimental assays, which could potentially overwhelm subtle variation in thermal preference.

Table 2 Statistical analyses of different environmental factors and experimental design influencing Tp in Drosophila melanogaster infected with different Wolbachia types.

Humidity, diet and light substantially influence thermal preference of flies independent of Wolbachia infection

The analyses presented above show that the design of the thermal gradient device plays an important role in Tp measurements. The tubular device consisted of more spare metal parts than the plate device, which negatively affected the temperature conductivity. Accordingly, we found that the effective temperature range along the gradient was much narrower in the tubular compared to the plate device. The minimum temperature in the tube never decreased below 17 °C (maximum temperature: 27 °C), whereas the plate reached temperatures as low as 13 °C (maximum temperature: 27 °C). We therefore tested if the flies were limited by the temperature range and were unable to choose preferred temperatures below the minimum temperature in the tube. In this case, flies may cluster at the lower end of the gradient in the tube device, which would result in Tp distributions skewed towards the lower end, compared to the plate device. However, when comparing the skewness of Tp distributions in replicate experiments among the two devices we did not find significant differences (Wilcoxon Rank test, W = 258, p = 0.128) which suggests that the temperature range within the tube did not limit the behavior of the test flies.

Conversely, cold temperatures as low as 10–13 °C may cause reduced velocity48 which can lead to immobilization49,50 as a physiological response. This may thus result in biased Tp measurements due to a clustering of immobilized flies that get trapped at the cold end of the gradient18. Similar to Hague et al.16, we thus repeated testing for the influence of Wolbachia on Tp in flies on the plate device by excluding flies with a Tp < 15 °C, to avoid a potential bias from reduced mobility in cold temperatures. The analysis based on this reduced dataset did not indicate a Wolbachia-specific influence on host Tp either (GLMM: p = 0.43, x2 = 2.76, df = 3) and thus did not qualitatively differ from results based on the full dataset. This suggests that trapping due to immobilization at the cold end of the gradient is unlikely a confounding factor in our experiments.

We speculate that also other environmental factors associated with the design of the devices may strongly affect thermal behavior. According to Dillon et al.18, sex, age, humidity, light, circadian rhythms, feeding status and number of individuals tested at once all influence thermal behavior. While similar numbers of flies that were tested simultaneously during each experiment on both devices, the available space for each fly differed dramatically between the two designs. In particular, the narrower space in the plate device may have led to stronger interactions among the flies which could result in pronounced gregarism and clustering due to social interactions at certain regions along the arenas51. To further investigate how experimental design influences Tp measurement, we compared 15 studies on thermal behavior in D. melanogaster flies. This qualitative meta-analysis revealed high variation in measured Tp, which apparently depends on the design of the gradient device, the range or the temperature gradient, rearing and experimental conditions, food, age of flies and number of individuals tested (all summarized in Table S3).

To better understand the influence of specific environmental stimuli on thermal preference assays, we experimentally investigated how humidity, food and light affect Tp measurement in the context of varying Wolbachia infection status. We observed a highly significant effect of humidity (GLMM: p < 2.2e−16, x2 = 266.93, df = 4; Table 2B; Fig. 3) on Tp of adult flies. Higher humidity (60%) resulted in increased thermal preferences, elevated by 1–2 °C (Table S2). The median Tp at 30% humidity ranged from 21.5 °C (wMelCs and wMelPop) to 22 °C (w-), whereas the median Tp at 60% humidity ranged from 22.7 °C (w-) to 23.5 °C (wMel, wMelCS). A positive correlation between humidity and Tp was similarly observed already in other insects52,53.

Figure 3
figure 3

The influence of environmental and experimental factors on Tp in Wolbachia-infected Drosophila melanogaster. Boxplots showing the influence of the design of the thermal gradient device, humidity, food, and light on measurement of Tp in D. melanogaster and the influence of Wolbachia on host thermal preference, where the colors highlight the different Wolbachia genotypes.

Diet also had a strong influence on thermal behavior. We found that flies on in-house food preferred 1 °C lower temperatures than counterparts maintained on Carolina instant food (GLMM: p = 5.79e-6, x2 = 24.2, df = 2; Table 2C; Fig. 3). Differences in diet quality or feeding status (fed versus fasting) are known to influence thermal preference in ectotherms, where rich food diet increases Tp compared to poor food or fasting conditions54,55,56,57. Our results match these previous findings. While we did not assess the exact nutrient composition in our in-house fly food, the recipe is considered less rich in carbohydrates and proteins than Carolina 4–24 instant food. Additionally, diet is also known to affect the titer of Wolbachia in different tissues: protein-rich food has been found to boost titer levels in somatic tissues, but not in ovaries. Conversely, carbohydrate-rich food can increase titer levels in ovaries only58,59. If variation in titer levels may have a strong influence on thermal preference, as speculated previously14,16, the food quality may indirectly influence Tp by modulating titer levels. However, we failed to observe a significant influence of light on Tp, (GLMM: p = 0.059, x2 = 5.69, df = 2; Table 2D; Fig. 3).

Interestingly, in contrast to the experiments performed in our newly designed “plate” gradient device, the follow-up experiments in the “tube”, in particular the experiment testing for the effects of humidity variation, revealed significant effects of Wolbachia infections on Tp (see Table 2A). However, the observed patterns were opposite to expectations. Flies infected with wMelCS preferred warmer temperatures than uninfected flies in both experiments (Tukey’s post hoc test: p < 0.01; Table S2; Fig. 3). These findings contradict previously observed results where flies infected with wMelCS variant preferred lower temperatures than uninfected counterparts14,15. Our results are, however, in line with the data observed by Hague et al.16, showing no shift of preference to higher temperatures in flies artificially infected with wMelCS. In summary, these results further suggest that Tp measurement is strongly influenced by the experimental setup and that Tp variation with respect to Wolbachia infections is probably very subtle.

Conclusions

In our thermal behavior assays we found that Wolbachia does not influence thermal preference in early and late 3rd-instar Drosophila larvae, consistent with previous studies suggesting that Wolbachia has no, or only very weak effects on juvenile traits of D. melanogaster. In contrast, we found subtle effects of Wolbachia on thermal preference in adult D. melanogaster under certain experimental conditions only. These effects were inconsistent with previous data and indicate that Tp measurement assays are potentially influenced and confounded by uncontrolled environmental cues. Such unwanted behavioral stimuli can overwhelm subtle thermal preference differences during behavioral experiments. As we show in our study, factors such as humidity, diet and design of the gradient device substantially influence measurements of thermal preference in D. melanogaster infected with different Wolbachia variants. Our findings demonstrate the necessity of a careful experimental design and cautious interpretations of Tp measurements together with a thorough description of the methods and equipment used to conduct behavioral studies. Our data and findings thus provide important considerations when planning future behavioral assays to assess thermal preference not only in Drosophila but also in other insects infected with Wolbachia, such as vectors of human diseases like mosquitoes.