The base population of Caenorhabditis elegans used in this study was composed of a mixture of the strains used in Teotónio et al. 2006 
. It was kept in the experimental conditions described in Manoel et al. 2007 
, for over 80 generations prior to our study. Levamisole (Levamisol hydrochloride, C11H12N2S · HCl), an imidazothiazole and Ivermectin (22,23-Dihydroavermectin B1), a macrocyclic lactone, were purchased from Sigma-Aldrich.
From the initial population, we derived 10 experimental lines: five maintained in standard conditions [C1–C5] and five kept in plates containing the nematicide Levamisole (LE1–LE5). The populations were cultured for 20 generations at 20°C and 80% RH and frozen at generation 10 (G10) and 20 (G20) for later use in the assays. Our standard experimental evolution protocol followed that of Manoel et al.
. Each generation lasted 4 days. At day 1, 1000 individuals at the first larval stage (L1) were placed onto Petri dishes (9 cm diameter) containing Nematode Growth Media-light agar (NGM) (US Biological) with a lawn of HT115 Escherichia coli
as food source, then incubated for 3 days. At day 4, individuals were washed off the plates and exposed to a hypochloride/sodium hydroxide solution, which kills all life stages except the eggs inside the hermaphrodites. These eggs were subsequently kept in a M9 buffer solution in 15mL falcon tubes in an incubator at 20°C and 120 rpm overnight. The next day, the number of larvae on each tube was estimated with five sample drops of 5 µL from each tube and the volume corresponding to 1000 of individuals was placed in fresh Petri dishes. Each population was composed of 10 Petri dishes, hence N
10 000, individuals per population. The NGM-light agar in which LE populations were kept contained Levamisole 0.15 mM. This concentration was lethal for 75% of the individuals in the base population, but had no effect on bacterial growth (T-test, N
10 petri dishes per environment, t
Adaptation was assessed by comparing the performance of LE populations to those of C populations in petri dishes containing Levamisole (hereafter the Levamisole environment), while the control (drug-free) environment and the environment containing Ivermectin 0.04 µM served to measure potential costs of adaptation. Prior to testing performance, all populations (C1–C5 and LE1–LE5) spent three generations in a drug-free environment, to ensure that the responses observed were due to genetic differences among populations. Subsequently, 100 eggs from each population were placed onto fresh petri dishes of each environment (N
5 plates/environment) and incubated for 3 days at 20°C and 80% RH. When individuals reached adulthood (4th
day of culture), 30 gravid hermaphrodites from each plate were collected and individually submitted to a hypochloride/sodium hydroxide solution. The surviving eggs were counted, yielding the fecundity measure. This method mimics the conditions used in the experimental evolution setup, but at an individual level. The plates with the remaining individuals were placed at 4°C for two days to immobilize the individuals to be counted. Survival was obtained by counting the number of individuals per plate (accounting for the 30 removed to measure fecundity) and dividing it by the initial number of eggs plated (100). Male frequency was estimated as the ratio between the number of males and the total number of individuals counted.
Next, we aimed at understanding the male frequencies observed (cf. Results). We first tested whether males were more susceptible to Levamisole than hermaphrodites. 20 adult males and 20 hermaphrodites from each C population at generation 20 were placed separately in Levamisole and in Control plates (5 plates per population per environment). After one day, the number of individuals surviving was counted. Subsequently, we measured the encounter rate between males and hermaphrodites. Four hermaphrodites from one population were placed on a small drop of bacteria (10 µL) that had grown overnight in a 5-cm diameter plate containing either 0.15 mM Levamisole or no drugs. Subsequently, a male was introduced and this group was observed for 20 minutes. We registered the number of male-hermaphrodite encounters. This was done ten times for C1, C3, C5 and LE1 at generation 20.
Differences in survival and fecundity were first analyzed with General Lineal Models using the GLM procedure in SAS. The factors of the model were “environment” (levamisole, ivermectin or control), “generation” (10 or 20), “selection regime” (LE or C lines), a factor “selection line” (C1–C5 and LE1–LE5) nested to the factor “selection regime”, and the interactions “environment*selection regime”, “generation” * “selection regime”, “environment*selection line” and “generation” * “selection line”. The factor “selection line” and its interactions with other factors were considered random factors. The interaction terms with P-values larger than 0.1), were sequentially dropped from the analysis and included in the error term 
. Subsequently, we performed statistical tests within each environment to answer specific questions. Adaptation was tested by comparing survival and fecundity of LE and C populations in the Levamisole environment. The analysis and the factors used were the same as before, except for the factor environment and its interactions with the other factors. A cost of adaptation was tested with the same model, but with the data collected in the other two environments.
Differences in male frequencies were tested with a GLM procedure in SAS, with the same model as for fecundity and survival, but excluding the Ivermectin environment. Comparisons between the control and the levamisole environment aimed at testing whether an immediate physiological effect of the environment could affect the male frequencies observed; comparisons among selection regimes tested the effect of the pesticide on male frequency, while comparisons between generations of the levamisole lines tested recovery due to the evolution of resistance. To test differences in survival between males and hermaphrodites, only C populations were used. The sex of the individuals was introduced as a fixed factor and population as a random factor. To test the effect of the Levamisole environment on the ability to find a mate, we compared the number of encounters of individuals from C populations in the Levamisole versus the Control environment. Environment was introduced as a fixed factor and population as a random factor. As there were no significant differences among populations, these were grouped in the subsequent analysis. To test whether resistant individuals had recovered their ability to find a mate, we used individuals from the most resistant population at generation 20, LE1, and compared their behavior to that of individuals from the C selection regime. To test whether the encounter rates of individuals from the LE1 population varied between environments, we performed a T-test in Microsoft Excel.