Dowel experiments

Rearing: To control for any potential genetic effects among families in larval colour responses, the dowel experiments were conducted with a split family design (Supplementary Table 1). Biston betularia were reared from eggs and provided with goat willow (Salix caprea) ad libitum, with leaves on branches and in the absence of artificial dowels. At second instar, prior to any strong colour-matching response (Supplementary Fig. 12), 25 larvae were transferred to each treatment arena. Treatment arenas comprised of transparent plastic boxes measuring 279 × 159 × 102 mm (length × width × depth) lined with plain blue C-fold 1-ply paper towel, each box containing 20 × 12-cm-long wooden dowels (10 × 5 mm diameter and 10 × 3 mm diameter) held in position by a chicken-wire frame painted to match the colours of the dowels used for each experiment (Supplementary Figs. 13 and 14; Supplementary Table 1). Larvae were fed on S. caprea leaves stripped from the branches and stem ad libitum and boxes were washed with 10% bleach every three days to reduce infection risk. Treatment boxes were kept 20 cm apart in a Sanyo Versatile Environment Test Chamber (model MLR-351), with a 12:12 h day:night cycle, at 24 °C in the day with luminescence set at 15,000 lx, and 18 °C at night for the duration of the experiment, until pupation.

Blindfolding: Following a pilot study, black acrylic paint (Royal Langnickel Essentials Acrylic Paint PNTA158 BLACK) was chosen as the most suitable method to occlude light from ocelli and applied using a Royal Langnickel Sable Hair Detail Brush (Liner 5/0,0), with the aid of a microscope. The paint did not permit light transmission (Supplementary Fig. 15). Larvae were checked twice daily for signs of head capsule slippage. Individuals presenting signs of head capsule slippage were removed from the treatment arena and placed into small plastic boxes (70 mm × 70 mm base × 50 mm high) covered in opaque white card, containing only food material (no dowel to rest on). This treatment removed the dowel stimulus whilst maintaining the normal day/night cycle, albeit at a reduced light intensity during the day period. Following complete head capsule slippage, the ocelli of these individuals were re-painted and they were placed back into their designated treatment arenas. The maximum time taken for complete head capsule slippage from beginning to end is 24 h44. In this experiment, head capsule slippage was usually completed 6–12 h after larvae were removed from dowels. In this way, there was no point at which the ocelli in the blindfolded group could have received visual information about the dowels. Control larvae were not painted or transferred to isolation boxes. Partial removal of the blindfold was observed only twice out of a total of 11,480 checks across all experiments; these individuals were removed from the experiment.

Quantifying the colour response: Colour quantification and analysis was performed as described in reference20. The reflectance of final instar larvae and painted dowels was measured using an Ocean Optics USB2000 spectrophotometer, with a DH-2000 halogen deuterium light source and measured relative to a WS-1 reflectance standard. Larvae were cooled in a fridge for 2–10 min prior to measurement to reduce movement. A total of six measurements were taken: three from the left and three from the right lateral surfaces of each individual, always recorded from the third thoracic segment and the second and sixth abdominal segments. This was to prevent overlap in measurements, and because these segments showed no prominent markings. All spectrometry data were recorded using Overture v.1.0.1.

We processed spectra to 1 nm intervals within the visible light spectrum (300–700) using a program in MATLAB (provided by I. C. Cuthill), and modelled vision in avian colour space using cone photon catches from the blue tit, Cyanistes caerulus22. Cone stimulation values were converted to Cartesian coordinates and plotted in a tetrahedral space using a custom written MATLAB script45, such that each cone is represented by an axis. This colour space is useful because if a colour stimulates only one cone type, then its coordinates lie at the appropriate tip of the tetrahedron, and when all four cone types are equally stimulated its coordinates lie at the origin (Supplementary Fig. 2).

To provide a simpler measure of colour, we calculated greenness as the ratios between the cone catch values of the medium wavelength and long wavelength photoreceptors [MW/(MW + LW)], which represent opponent mechanisms, following Arenas and Stevens46. For the black and white dowel experiment we modelled response to luminance but not to colour. We therefore analysed only the blue tit DD cone catch, as these cones mediate luminance vision22,47.

We modelled the ease with which an avian predator might discriminate between dowels and larvae using JND; for mathematics, see Vorobyev and Osorio23. For chromatic contrasts, we used spectral sensitivities of the blue tit through relative cone ratios of SW = 0.7111; MW = 0.9926; LW = 1.0; and UV = 0.370448, with a Weber fraction of 0.05 and idealised irradiance (D65). To model luminance JNDs, we used blue tit DD cones. JND < 1.00 indicate that two stimuli are indiscriminable; stimuli differing by 1–3 JND units are only discriminable under good viewing conditions; stimuli showing values above this should be distinguishable with increasing ease49.

Microhabitat choice: Final instar blindfolded and control larvae that had been reared on brown and green dowels were placed into two designs of choice chamber: one with a choice of two diagonally crossing dowels and one with a single horizontal dowel. The rationale for using two designs was to test larvae under different starting conditions, which may produce initial, non-selective escape responses (onto any twig when the larva is placed on a flat surface). All microhabitat experiments were conducted using 12 individuals at a time in a Sanyo Versatile Environment Test Chamber (model MLR-351) on light level 4 (15,000 lx).

The diagonal habitat choice chamber consisted of a transparent plastic cube measuring 70 × 70 × 80 mm (length × width × depth, including lid) and containing two diagonally crossing 100-mm-long dowels painted in the contrasting colours (brown vs green) that larvae were reared on during blindfolding experiments (Supplementary Fig. 16A). Individual larvae were placed on the base of the diagonal dowel enclosures, equidistantly from each dowel. Prior to placement, larvae were gently poked with tweezers three times along the dorsal surface to simulate predation, as predation risk increases likelihood of microhabitat choice24. A sticker with larva ID was placed on the side of each chamber. Individuals were left for 12 h (7-h dark and 5-h light, chosen to reduce disturbance to the natural circadian rhythm of the larvae), after which the dowel colour that each caterpillar was resting on was recorded, followed by the larva ID. One recording was taken per larva.

The horizontal design was a single 200 mm dowel suspended horizontally inside a transparent cylindrical tube measuring 210 × 60 mm (length × diameter) (Supplementary Fig. 16B). Each half of the dowel was painted with the same pairs of contrasting colours as described for the diagonal chamber design. Final instar larvae were subjected to simulated predation and then draped along the centre of the two-tone dowel, not facing either colour. Individuals were left for 12 h (7-h dark and 5-h light), as in the diagonal dowels experiments, and the dowel colour that each caterpillar was resting on and the larva ID were recorded. If the larva position was found to be crossing two colours (<10% of larvae), then the colour that the larva most occupied was recorded. Two experiments were conducted per individual, where the position of the dowel was switched, so that the brown end was facing the base of the chamber (back of the cabinet) for one experiment, and the green end for the other (the order was random). Out of 137 individuals, 34 (~25%) alternated their colour choice between trials.

Identification and characterisation of visual genes

Visual gene identification: Predicted CDS for ultraviolet (UV) wavelength sensitive opsin, blue wavelength sensitive opsin, melanopsin, and long wavelength sensitive opsin (copy one and two) were obtained (see Supplementary Table 2 for accession numbers) by aligning contiguous sequences from a draft B. betularia whole genome sequence (based on NCBI SRA SRX1060178) by tBLASTn50 with homologous Manduca sexta sequence (Supplementary Table 2), using Geneious, v.5.5.6 (Biomatters Ltd). CDS for RDB and Arr-1 genes were predicted using the same method, with known Drosophila melanogaster, Bombyx mori, and Plutella xylostella homologs (Supplementary Table 2). These CDS were completed and confirmed using a B. betularia whole genome BAC library (constructed by Amplicon Express) and a mixture of larval and pupal cDNA from head and dermal tissue. BAC library clones containing sequences of interest were identified from superpools with primers designed from the predicted CDS using Oligo v.6.051 (Supplementary Table 3), and Sanger sequenced (ABI 3130xl).

Phylogenetic analysis: To ensure that visual genes were true homologs, wavelength-sensitive opsins—UV, blue (Bl), LW1, and long wavelength copy 2 (LW2), in addition to Arr-1 and RDB—were aligned with corresponding genes of closely related Lepidoptera species (Supplementary Table 2), obtained using a combination of NCBI BLAST using B. betularia sequence as the query sequence. Sequences were aligned manually in MEGA6 v.6.052, and model selection was performed on nucleotide substitutions using the maximum likelihood statistical method for all sites, with complete deletion of gaps/missing data.

Phylogenetic trees for each gene were then constructed from nucleotide substitutions using maximum likelihood. The model used was the best-fitting model based on AICc and BIC values. For UV nucleotide sequences, the best model was the Tamura 3-parameter model with a discrete gamma distribution used to measure evolutionary differences among sites. For Bl and Arr-1 nucleotide sequences, the Tamura 3-parameter model was also used, with a discrete gamma distribution and five rate categories, assuming that a certain fraction of sites are evolutionarily invariable. For LW sequences, the general time reversible model was used, with a discrete gamma distribution and five rate categories, assuming that a certain fraction of sites are evolutionarily invariable. For RDB sequences, the general time reversible model was used, with a discrete gamma distribution. Each phylogeny was constructed using all codon positions and analysis was run using 2000 bootstrap replications. Trees were constructed in MEGA6 v.6.0 and edited in Figtree v.1.4.353.

Gene expression: Four final instar larvae and four imagines (two male and two female) were placed intact (except for gut tissue removal) in 1.5 mL eppendorfs of RNAlater® (Thermofisher) and stored at −80 °C until required. Larvae were later dissected into head, thorax, abdomen, and claspers (Supplementary Fig. 17A; Supplementary Table 1) and imagines were dissected into head, thorax, abdomen, and the distal portion of the abdomen containing the genitalia (Supplementary Fig. 17B; Supplementary Table 1). For all specimens, as much internal tissue as possible was removed from the body, leaving only dermal tissue intact. RNAlater was removed by pipette and the whole tissue was placed in a clean 1.5 mL Eppendorf Safe-Lock Tube containing a 3-mm tungsten bead (Qiagen), to which 1 mL of TRIzol reagent (Thermofisher) was added. Samples were homogenised with a Qiagen tissue lyser II, at 25 Hz for 4 min. Total RNA was isolated following the TRIzol manufacturer’s guidelines (Invitrogen). Genomic DNA was removed from 6 μL of each RNA sample by DNase I Amplification Grade (1 U/μL), following the manufacturer’s protocol. First strand cDNA was synthesised from 5 μL of DNase-treated RNA using 200 U/μL Superscript III Reverse Transcriptase (Thermofisher), following a modified version of the recommended protocol, excluding the RNaseOUT stage and using 0.5 μL of 100 μM Oligo (dT)20 as the anchor primer. Reactions were incubated at 50 °C for 60 min, followed by deactivation at 70 °C for 15 min.

In total we quantified nine visual genes, including splice variants: UV, Bl (splice variants A and B), Mel (splice variants A and B), LW1, LW2, Arr-1, and RDB (Supplementary Fig. 18). We were unable to amplify the alternative splice variant of UV, so only UV splice variant A was quantified. End-point PCR reactions were performed in a Veriti (Applied Biosystems) 96-well thermal cycler with LongAmp® Hot Start Taq DNA Polymerase (New England Biolabs) and the following cycling conditions: 2 min at 94 °C, 40 cycles of [20 s at 94 °C, 30 s at 57 °C, 1 min at 70 °C]. PCR products were loaded onto 2% agarose gel and visualised with 3 μL Midori Green DNA stain (Nippon Genetics) against HyperLadder 50 bp (Bioline). Quantitative PCR was performed using KAPA SYBR fast qPCR (2×) mastermix (KAPA Biosystems), following the manufacturer’s protocol in a final reaction volume of 10 µl containing 0.5 µL cDNA template (diluted to 55%). Each sample measurement was repeated in triplicate and quantified using a Roche Lightcycler 480 II and software v.1.5, under cycling conditions: [3 min at 95 °C, 45 cycles of 3 s at 95 °C, 20 s at optimal annealing temperature, and 20 s at 72 °C]. Melting curves were inspected to ensure single products. Relative expression of PCR product was determined as a ratio against a reference gene, spectrin (Supplementary Table 2), which shows uniform expression across cells in B. betularia18, using [(ERef)^(CpRef)]/[(ETarget)^(CpTarget)]. Here, E = efficiency of PCR reaction (assumed to be the idealised value of 2), Cp = crossing point, Ref = reference gene (spectrin), Target = target gene (visual genes). Primers for all PCR reactions were designed using Oligo v.6.051 (see Supplementary Table 3 for sequences).

Statistics and reproducibility

All statistics were performed using R version 3.3.254.

Colour response: To test whether treatment colour and blindfolding affected the colour and luminance of larvae, as well as their ability to match dowels (JND between larvae and dowels), we fitted linear models to log 10 JND, greenness, and luminance values. Deviance from normality was checked with qqPlot and by plotting model residuals. Treatment (dowel colour) and blindfolding were tested as predictors of larval luminance (DD) for black and white achromatic treatments, larval greenness for brown and green chromatic treatments, and JNDs for chromatic and achromatic treatments.

Microhabitat choice: To test the effects of blindfolding, treatment, and dowel position (horizontal dowel chambers only) on dowel colour choice, we performed generalised linear models (family = binomial) with larva colour, blindfolding, and dowel position as predictors of matching success (0 or 1).

Gene expression: Comparisons between head and dermal expression of larvae and adults were tested by fitting linear models to the log 10 of gene expression values. Deviance from normality was checked with qqPlot. To examine the relative contribution of dermal expression within life stages, we used the ratio of dermal to head expression, taking the sum of all the dermal tissue parts (thorax, abdomen, and claspers/genitalia) as a proportion of total expression [dermal expression/(head + dermal expression)]. We modelled this ratio using beta regression, appropriate for proportional data that follows a beta distribution. We tested stage (larva, imago) as predictors of relative dermal expression across genes. Model residuals were checked for normality using qqPlot.

Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.