Insects
Pine logs infested with S. noctilio were collected from Knysna (South Africa) (n = 133). Trees with characteristic symptoms of infestation, such as brown needles and fresh resin droplets oozing from the bark from oviposition sites were selected and cut into logs. Logs were stored in an insectarium at 20°C with ambient humidity and a photoperiod of 12/12 hr L/D. After emergence, insects were collected and stored in a fridge at 12°C for later use. Before any analyses were performed, insects were left under artificial light for 30 minutes at room temperature. The use of plants in this study complies with international, national and/or institutional guidelines.
Electroretinographical recordings (ERG)
To reduce external noise, recordings were conducted in a grounded Faraday cage painted completely black. Live, intact animals were fixed in a custom-made Plexiglas holder using dental wax. Antennae were carefully fixed to ensure they did not obstruct the measured compound eye. The reference electrode (25 µm silver wire) was inserted into the head capsule behind the compound eye. Before inserting the recording electrode, a little hole was drilled into the cuticle of the compound eye using a minute pin. Recording electrodes were glass capillaries pulled with a DMZ-Universal Puller (DMZ-Universal Puller, Zeitz-Instruments, Germany) filled with 1 molar Potassium-Chloride solution. To be consistent among insects, recording electrodes were always placed carefully at the centre of the compound eye just under the cuticle surface. The signal was 10x amplified (Neuroprobe Amplifier Model 1600, A-m System Inc. Sequim, USA) and Bandpass filtered 0.1–150 Hz using a dual variable filter (VBF 8, Kemo Inc., Greenville, USA). The filtered analogue signal was digitized using an analogue-digital receiver (Lap-Trax 4/16, World Precision Instruments, USA) to be visualized and recorded with the computer software LabScribe (LabScribe Version 3.010800, iWorx Systems Inc., USA).
ERG: Light stimulation
A xenon arc lamp (Abet Technologies Inc., Model LS-150-Xe SN 127, Milford, USA) was used to produce a full daylight spectrum with a spectral range from 320–820 nm. Optical band pass filters (Edmund Optics Inc., Barrington, USA) with a 20 nm full width-half maximum, produced the monochromatic light stimuli tested. For each stimulus, light intensity was adjusted to 1.04 ± 0.07 × 1014 photons/cm2 × sec using a motor driven neutral greyscale filter wheel (Nanotec-Munich, Model ST2818L1006B, Munich, Germany) controlled by an Arduino board. Two motor driven wheels (Lambda 10 − 2, Model LB10-2, Shutter Instrument, Novato, USA) equipped with the different band pass filters were positioned successively into the light beam. The first one included a shutter to produce light flashes of 100 ms. The Arduino, the shutter and the filter wheels could be controlled using a custom-made MatLab script (The MathWorks Inc., MatLab R2014a, Version 8.3.0.532). Having passed the computer controlled filter settings the light was guided through an optical quartz fibre placed 1 cm in front of the eye.
Before and after each series of spectral measurements, eight increasing intensities of white light were flashed for 100 ms on the insect eye. The range of white light intensity was generated by passing the light through a combination of eight positions of the neutral grey filter, which created intensities of white light that ranged from 5.97 × 1012 to 4.95 × 1016 photons/cm2 × sec. After the last white light flash, insects were given 15 min to readapt to ambient light conditions before the first round of spectral measurements. For each series of spectral measurement, two rounds of 17 monochromatic lights (334, 352, 358, 382, 398, 418, 431, 449, 468, 501, 519, 529, 550, 569, 599, 620 and 649 nm) were flashed for 100 ms with 1 minute between each flash of monochromatic light. One minute after the first round ended, a second round of the same 17 monochromatic lights were flashed every minute in a different random order. This procedure was conducted for three light adaptations. Insects were first dark-adapted for 15 min prior to the experiment. When the last white flash from the first experiment was finished, insects were left for 15 min under a constant dim green light (551 nm at 7 × 1012 quanta/s/cm2) and the procedure was repeated. The same procedure was used a third time under a constant strong green light (551 nm at 7 × 1015 quanta/s/cm2). Insects were excluded from the dataset if no depolarisation was observed to the brightest white light.
ERG analyses
For each individual and under each light adaptation, a V-log(I) curve was computed. The depolarisation for each white light intensity flashed before and after the spectral measurements were averaged and a logarithmic model was used to create a V-log(I) curve. In order to start at log(0), the different intensities were log(I) transformed and the log(I) of the weakest value was subtracted from each white light intensity. The amplitude signal was transformed into the equivalent intensities log(I) for each monochromatic wavelength tested with the V-log(I) curve. The sensitivity (S) for each wavelength tested was computed using the method described in Telles et al. (2014)48 with the following equation:

where log(I) is the equivalent intensity for each response, and log(Imax) is the equivalent intensity of the highest response for each series. Sensitivity values were averaged for each sex under the same light adaptations. The difference in quantum catch for the receptor i (∆(Qi)) and a colour stimulus was calculated with the equation:

where Ri(𝝀) is the sensitivity of the receptor i for the wavelength 𝝀, and ki an arbitrary scaling factor for the photoreceptor i for each light adaptation 49. The Ki for the UV peak under strong green light adaptation and for the LW1 photoreceptor under dark adaptation was defined as 1 since these adaptations are maximising the sensitivity of each photoreceptor. For each light adaptation, the sensitivity of the wavelength measured (Ri measured) at 364 nm for the UV and 527 nm for the LW1 was divided by the Ri measured under strong green light and dark adaptation, respectively.
Statistical analyses
The Stavenga 2 parameter opsin template50 was used to determine the 𝝀max of each photoreceptor. The averaged sensitivity value for each receptor was fitted with the nlsLM function from the “minpack.lm“ package in R (https://cran.r-project.org) into the different templates with the corresponding constant for each model50. Models were compared and the residual standard error and P-value were used as a measure to choose the best model fitting the data. For each light environment, no difference between male and female sensitivity was detected (Kruskall-Wallis test > 0.05 for both LW1 and UV). Therefore, data from both sexes were pooled and averaged for curve fitting.
Genetic analyses
Genomic coding sequences (CDS) of the visual opsin genes LW1, LW2, UV and SW of Apis mellifera (Lop1, Lop2, Uvop and Blop) and Orussus abietinus were used to perform a local BLASTp and BLASTn51 search against the genome assembly and annotation of S. noctilio (Alisa Postma et al. unpublished data) using CLC Main Workbench V7.7.3 (www.clcbio.com). Sequences with an E-value <10-20 were retained for further analyses. The Apollo Genome Annotation and Curation tool52 was used to curate the identified gene models.
The SW opsin gene was not identified using the above-mentioned BLAST searches; therefore, a targeted search for the SW opsin gene in S. noctilio was conducted. Local BLASTn, BLASTp and tBLASTn searches were performed using the SW opsin nucleotide and amino acid sequences from A. mellifera, O. abietinus and Camponotus floridanus species as queries against the genome assembly (nucleotide sequence) and the annotation (protein sequences) of S. noctilio. The flanking genes of the SW opsin gene from the genome of A. mellifera, O. abietinus and C. floridanus were identified and used to perform local BLAST searches against the S. noctilio genome. The corresponding flanking genes in S. noctilio were annotated. The section in scaffold 35 surrounded by the flanking genes in S. noctilio where the SW opsin was found in other insects was used to perform local BLAST analyses on NCBI including all available hymenopteran genomes. In order to assess whether the absence of the SW opsin gene in the S. noctilio assembly could be ascribed to errors/misassembly of the genome sequence, the raw genomic sequencing reads used to generate the genome assembly of S. noctilio were mapped back to scaffold 35 from the S. noctilio genome using the Burrows-Wheeler Aligner (BWA)53. The resulting alignments were analysed and visualised using the Integrative Genomics Viewer (IGV)54.
Hymenopteran visual opsin DNA, RNA and protein sequences were obtained from the literature and online resources including GenBank55, OrthoDB56 and i5K57. For these sequences, the gene predictor Augustus58 was used to remove potential introns and to translate DNA sequences into amino acid sequences. RNA sequences were translated into amino acid sequences via MEGA759. Amino acid sequences were aligned using MAFFT60 under default parameters. Data were visually curated after alignment. Accession numbers of the hymenopteran sequences used for the phylogenetic reconstruction and aligned curated sequences are available (Table 1, Supplementary material).
Phylogenetic reconstruction was performed in IQTree v1.4.461. The most likely amino acid substitution model was found to be the LG+F+I+G4. This model was used to build a Maximum Likelihood tree with 10,000 ultrafast bootstrap iterations62 and 10,000 SH-like approximate likelihood ratio tests63 were used to assess nodal support. The tree was rooted at the midpoint and visualised in FigTree v1.4.3 (http://tree.bio.ed.ac.uk/software/figtree/) .
Transcriptome analyses
RNA was extracted from both male and female S. noctilio. The compound eyes and the ocelli were surgically removed using a clean scalpel blade and stored individually in Eppendorf tubes at -80 °C. The compound eyes and ocelli of ten individuals of each sex were pooled, and a NucleoSpin RNA purification kit (Macherey-Nagel) was used to extract and purify the RNA. The quantity and quality of RNA was assessed by means of a nanodrop and a 2 % electrophorese gel, respectively. The RNA was then transformed into cDNA via a cDNA synthesis kit (SensiFAST).
Specific primers for S. noctilio were designed to amplify the LW1, LW2 and UV opsin genes in the Genscript primer design software (https://www.genscript.com/tools/real-time-pcr-taqman-primer-design-tool) using default parameter values (Table 2, Supplementary material). Primers were designed with at least one intron present between the forward and reverse primer. Polymerase chain reactions (PCR) were performed for all samples and primers as follows: denaturation at 95 ºC for 5 min, followed by 40 cycles of 94 ºC for 30 s, 49 ºC for 30 s, 72 ºC for 1 min, then 7 min at 72 ºC. The PCR products were run on 2 % agarose gel at 110 V, 400 mA for 30 min. The PCR products were prepared for sequencing when the genes were thought to be expressed. A PCR clean-up was performed by adding 8 µL of Exo-SAP to the PCR product and put at 37 ºC for 15 min and 80 ºC for 15 min. A sequencing PCR was performed by adding 6.4 µL of dH20, 2.1 µL of sequencing buffer, 0.5 µL of BigDye, 1 µL of primer and 2 µL of cleaned PCR product. The PCR thermocycling profile used was 27 cycles of 96 ºC for 10 s, 55 ºC for 15 s, 60 ºC for 4 min. Samples were subsequently washed and precipitated for sequencing. Samples were cleaned with 50 µL of 100 % EtOH, 2 µL of NaOAc and 8 µL of dH2O and centrifuged at 13400 rpm and 4 ºC for 30 min. The supernatant was removed and 150 µL of 70 % EtOH was added and the mixture centrifuged at 13400 rpm and 4 ºC for 10 min. This step was repeated a second time. The supernatant was removed and tubes were left open under the fume hood overnight to dry. Dried samples were sent for Sanger sequencing at FABI, University of Pretoria (South Africa). Sequencing results were manually curated in CLC Main workbench. Base calling conflicts were resolved by selecting the peak with the highest relative fluorescence units. Noise and contamination data under 4000 relative fluorescence units were eliminated. Sequences were aligned with the corresponding genomic sequence under default parameters.