Introduction

Linking genetic changes in adaptively relevant genes to evolutionary transitions in ecology and life history is a central pursuit in evolutionary biology (Baldwin et al., 2014; Foote et al. 2015; Partha et al. 2017). Clades that include lineages with considerable ecological variability represent good candidates for such investigations. The actinopterygian fish order Beloniformes is a group of over 200 species that includes the ricefishes, needlefishes, sauries, flyingfishes, and halfbeaks, and exhibits impressive diversity across several ecological axes (Nelson et al. 2016). Many beloniforms, including the epipelagic flyingfishes and most needlefishes and halfbeaks, occupy marine habitats, but several beloniform lineages have independently invaded freshwater habitats in the Neotopics, Asia, and Australasia (Lovejoy and Collette 2001; Bloom and Lovejoy 2017). In addition, beloniforms have evolved a wide array of dietary specializations, and include generalists, zooplanktivores, herbivores, and piscivores (Lovejoy et al. 2004; Manjakasy et al. 2009; Day et al. 2011; Van Noord et al. 2013). These characteristics make Beloniformes an interesting and informative model system for understanding how different aspects of ecology influence molecular evolutionary changes.

Adaptation in the visual system has a clear link to changes in environmental illumination (e.g., ambient lighting) and may also be associated with life history traits such as diet and inter- or intraspecific communication (O’Quin et al. 2010; Gutierrez et al. 2018; Stieb et al. 2016a). Opsin genes, which code for proteins that initiate visual transduction, are ideal for testing hypotheses about the various parameters influencing visual system evolution. Opsins may be specialized for dim light detection (rhodopsin), or bright light vision and colour detection (cone opsins). Gene duplications early in vertebrate evolution, combined with neofunctionalization and divergence of sensitivities to different wavelengths of light, resulted in a cone opsin repertoire sensitive to ultraviolet (SWS1), blue (SWS2), green (RH2), and green/yellow to red (LWS) light, with additional expansions and contractions of these subtypes occurring throughout vertebrate evolution (Bowmaker 2008). Adaptation to environmental lighting conditions is strongly correlated with the number, expression, and evolution of different opsin genes providing an interface of ecology, evolution, and genetics (Hauser and Chang 2017; Musilova et al. 2019, 2021). For example, fishes inhabiting dim light environments (e.g., nocturnal niches, turbid waters, or the deep sea) exhibit reduced expression, pseudogenization, and loss of opsins sensitive to shorter wavelength light (Stieb et al. 2016b; Lin et al. 2017; Luehrmann et al. 2019; Hauser et al. 2021). The physicochemical properties of water can also dramatically alter the ambient light environment. Notably, freshwater habitats are often red-shifted in their spectral content relative to comparatively blue-tinted marine habitats (Sioli 1984). Aquatic species often exhibit mutations in opsin genes that optimize their visual systems to these disparate photic conditions (Van Nynatten et al. 2015; 2021). Furthermore, fishes that underwent drastic shifts in habitat such as transitions from marine to freshwater habitats experience a transition from a blue-shifted to a red-shifted photic environment, imposing new selective forces on the sensitivity and expression of their opsins (Lin et al. 2017).

Opsin expression and evolution can also be linked to trophic specializations in fishes. Larval fishes typically forage on small, suspended particles in the water column, a behaviour likely aided by UV sensitivity (mediated by SWS1) that provides enhanced contrast of prey items (Novales Flamarique 2016; Yoshimatsu et al. 2020). In cichlid fishes, SWS1 opsin expression has been found to be higher in both larval and adult fishes that feed on zooplankton and phytoplankton (Hofmann et al. 2009). Sensitivity in the medium range of the spectrum via both expression, and gene duplication of RH2 opsins may enhance foraging in piscivorous fishes (Levine and MacNichol 1982; Nakamura et al. 2013). Recent work on shallow-water dwelling reef fishes has also demonstrated a strong link between long wavelength-sensitive (LWS) opsin expression and herbivory (i.e., algal foraging; Stieb et al. 2016a).

In general, visual system pigment evolution and adaptation in fishes at the molecular level involves a dynamic interplay among multiple factors. Visual pigments consist of a vitamin A1 (11-cis-retinal) or A2 (11-cis-3,4-dehydroretinal)-based chromophore that is covalently bound to the opsin protein (Wald 1968). In response to a photon-induced isomerization of the chromophore, the opsin undergoes a conformational change that activates the phototransduction cascade. The wavelength at which the visual pigment maximally absorbs (Lmax) is determined by both the chromophore type (A1 or A2) and the opsin protein sequences. The chromophore rests within a “chromophore binding pocket” lined with amino acid residues. Different amino acid identities in this region may alter the wavelength of light at which the chromophore isomerizes-these mutations are deemed “spectral tuning mutations”, with spectral tuning referring to the phenomenon of a shifting of wavelength absorbance of the visual pigment (Bowmaker 2008; Musilova et al. 2021; Hagen et al. 2023).

Fishes tune sensitivity via chromophore switching, with marine fish typically expressing an A1-based chromophore to better match the ambient blue-shifted light of marine habitats, and freshwater fish often employing an A2 (red-shifting) chromophore for better visual performance in turbid or red-shifted habitats (Carleton et al. 2020; Corbo 2021). Switching from an A1 to A2 chromophore typically induces a red Lmax shift of ~ 20 nm in Rh1, Rh2, and LWS pigments (pigments absorbing at 500 nm or greater). In shorter wavelength-sensitive pigments (440 nm and shorter) this difference is only a few nanometres (Bowmaker 2008). Spectral tuning mutations are also highly variable in fishes. For example, many deep sea fishes have evolved mutations at spectral tuning sites that blue-shift the Lmax of their pigments to match the dominant available wavelengths (e.g., Hunt et al. 2001), while freshwater fishes often have red-shifting mutations (Van Nynatten et al. 2021). Fishes also alter visual sensitivity by modulating gene expression in several different ways. Opsins may be differentially expressed through ontogeny (O’Quin et al. 2010; Härer et al. 2017), in different habitats (Hofmann et al. 2009; Luehrmann et al. 2020; Torres-Dowdall et al. 2021), or coexpressed in different regions of the retina (Dalton et al. 2017), allowing for rapid visual adaptation to different spectral environments.

For this study, we focus on patterns of molecular evolution in the cone opsin visual pigments, which encompass the evolution of spectral tuning sites as well as other mutations affecting opsin performance. Evidence of opsin interactions with both environment and trophic specialization highlights the intersection of habitat and diet in shaping patterns of opsin evolution in fishes. We use beloniform fishes as a model system to test how two important ecological variables, water type (marine or freshwater) and diet, have influenced molecular evolution of opsin genes. Most beloniforms occur in near-surface habitats, and are diurnal, visually-oriented feeders with attendant anatomical modifications for vision in shallow water (Baylor 1967; Reckel and Melzer, 2003). We focus specifically on the cone opsins since beloniforms forage during the day and under bright light conditions where RH1 (responsible for dim light vision (Yokoyama et al. 2008; Liu et al. 2011)) is not expected to play a significant role. We expected that multiple transitions from marine (blue-shifted ambient light) to freshwater (red-shifted ambient light) in Beloniformes would exert differential selective pressure on their cone opsin repertoire and predicted that positive selection would occur in opsins governing long wavelength sensitivity, and simultaneously a release of constraint in opsins associated with green and blue/violet sensitivity. We also tested whether shifts in diet (among zooplanktivory, piscivory, and herbivory) corresponded to shifts in selection in opsin genes. We analyzed a previously collected cross-species targeted exome sequence capture dataset to construct a robust beloniform phylogeny and to extract opsin sequence data for analysis using codon-based likelihood models. We reconstruct evolutionary shifts in diet and habitat and use models of molecular evolution to examine shifts in selection on opsin genes.

Materials and Methods

Taxon Sampling and Sequence Data

Our taxon sampling consisted of 38 species spanning the phylogenetic and ecological diversity of the order Beloniformes, including representatives of all six of its families: flyingfishes (Exocoetidae), marine halfbeaks (Hemiramphidae), freshwater halfbeaks (Zenarchopteridae), marine and freshwater needlefishes (Belonidae), sauries (Scomberesocidae), and ricefishes (Adrianichthyidae) (online resource 2, Table S1). Raw sequence data for all species except ricefishes was obtained from targeted exome capture as described in Daane et al. (2021). In brief, the medaka (Oryzias latipes) genome was used to design exome-wide probes, and after hybridization with these capture baits, pooled libraries of multiple individuals per species were sequenced using Illumina technology. Data for ricefishes (Oryzias latipes and O. melastigma) was obtained from publicly available genomes. Detailed descriptions of methods are provided in supplementary information (online resource 1).

Phylogenetic Analysis and Reconstruction of Habitat and Diet Transitions

We reconstructed the phylogeny of Beloniformes species based on a concatenated alignment of single-copy exons > 100 bp with at least 85% coverage across species (totalling 1,579,692 bases over 8768 exons). We used IQ-TREE (Nguyen et al. 2015) to generate a maximum likelihood (ML) tree with ultrafast bootstrap (Hoang et al. 2017), and MrBayes 3.2.6 (Ronquist et al. 2012) to generate a Bayesian tree. Both trees were identical in topology, and we used the ML tree for subsequent molecular evolutionary analyses. Species were categorized as marine or freshwater, as described in online resource 1. For ML ancestral reconstruction of habitat (freshwater or marine), we used a Beloniformes multigene species tree with more taxon sampling (N = 127 species including 6 non-beloniform outgroups) based on data generated by Bloom and Lovejoy (2017). This habitat transition tree was pruned to only include the species with opsin data analyzed in this study. We used ML to reconstruct diet transitions on the exon-based species ML phylogeny using four categories: herbivory, piscivory, zooplanktivory, and omnivory/non-specialized (referred to hereafter as generalists).

Cone Opsin Sequence Assembly and Alignment Pipeline

We developed a custom pipeline that used Python scripts to generate consensus sequences for each species and multiple sequence alignments (MSAs) for each cone opsin. According to studies of the freshwater medaka (Oryzias latipes), beloniform species are expected to have an opsin repertoire consisting of one rod opsin (RH1), and eight cone opsins (SWS1, SWS2B, SWS2A, RH2A, RH2B, RH2C, LWSA, LWSB) (Matsumoto et al. 2006). Sequences were assembled in an iterative manner from trimmed, raw reads using opsin sequences from related fishes (medaka, zebrafish, and guppy) as references. Sequences from two ricefish species, obtained from published genomes, were included in MSAs. We generated MSAs for eight cone opsins with average coverage ranging between 90.53–99.48% (online resource 2, Table S2). We found high sequence similarity between paralogous opsins LWSA and LWSB, and RH2B and RH2C, hence we selected a single paralogue from each pair (LWSA and RH2C) for downstream molecular evolutionary analysis (Escobar-Camacho et al. 2017). To verify the identity of our assembled opsin sequences, we combined our sequences with published opsin sequences from Danio rerio and Poecilia reticulata and conducted phylogenetic analyses of the entire opsin dataset (online resource 1, Fig. S2 and S3). Sequences analyzed for this study are deposited in GenBank (accession numbers PP372607 - PP372642; PP378736 - PP378878; PP386397 - PP386433).

Analyses of Molecular Evolution

To test for selection along sites in each opsin gene, we used the random-sites models from the CODEML package from PAML 4.0 (Yang 2007) and the HyPhy FUBAR model (Kosakovsky Pond et al. 2005; Murrell et al. 2013). Both PAML random-sites models and FUBAR analyses estimate overall rates of selection (nonsynonymous to synonymous substitutions; denoted as dN/dS or ω) and identify individual codons showing evidence of positive selection. We ran both analyses using datasets pruned to include only lineages from particular habitats (marine or freshwater) or having specialized diets (zooplanktivorous, piscivorous, or herbivorous). We also implemented PAML clade model C (CmC) (Bielawski & Yang 2004) on the full beloniform dataset to test for different patterns of selection among habitat and diet partitions. CmC allows ω values to vary among site classes and among clades/partitions set as the foreground compared to clades/partitions set as the background. The comparisons included (1) freshwater vs. marine, (2) herbivory vs. all other diets (3) piscivory vs. all other diets, (4) zooplanktivory vs. all other diets, and (5) all three specialized diets (herbivory, piscivory, and zooplanktivory) as separate foreground partitions vs. generalist diet as the background (3-diet partition) (see Fig. 2A for partitions). Akaike Information Criterion (AIC) (Akaike 1974) values were used to determine which partitioning schemes best explained the observed patterns of selection for each cone opsin. In partitions best supported by AIC values and showing evidence for strong positive selection, codon sites showing significant positive selection were identified using Bayes’ Empirical Bayes (BEB) in PAML for CmC and M8 (sites with posterior probabilities (PP) ≥ 80%), and BEB in FUBAR (PP ≥ 80%). CMC analyses were repeated on individual opsin ML gene trees reconstructed using IQTREE with ultrafast bootstrap (Nguyen et al. 2015). Opsin amino acid numbering corresponds to bovine rhodopsin (Okada et al. 2004).

Results

Phylogeny, Habitat and Diet Evolution

The Beloniformes species trees produced with maximum likelihood and Bayesian methods were identical with high node support (Fig. 1; online resource 1, Fig. S1). The species tree is congruent with previous studies (Lovejoy & Collette 2001; Bloom & Lovejoy 2017; Daane et al. 2021) and provides the following general phylogenetic findings: the freshwater zenarchopterid “halfbeaks” are the sister group of needlefishes and sauries; sauries are nested within needlefishes; halfbeaks are non-monophyletic, with some species more closely related to flyingfishes; and flyingfishes are a monophyletic group. Likelihood reconstructions of habitat and diet supported multiple habitat and diet transitions (Fig. 1; Fig. 2; online resource 1, Fig. S4).

Fig. 1
figure 1

Phylogenetic tree for beloniform fishes showing evolutionary transitions in habitat (left) and diet (right) based on maximum likelihood reconstructions. All branch support values were > 100 (ML bootstrap) and/or equal to 1 (Bayesian posterior probability); see online resource 1, Fig. S1. Scale bars represent number of substitutions per codon

Fig. 2
figure 2

A Habitat and diet partitions used for codon-based likelihood analyses of selection in opsins of beloniform fishes. For habitat, freshwater occupancy was used as foreground partition. For diet, non-grey colours show foreground partitions for different models. In addition, a 3-diet partition (3P) scheme was implemented where each diet specialization was set as a different foreground and compared to the generalist diet as background. All branch support values were > 100 (ML bootstrap) and/or equal to 1 (Bayesian posterior probability); see online resource 1, Fig. S1. B Clade model C (CmC) divergent site class dN/dS values (ωD) for models including habitat and diet, showing differences between foreground (black bar) and background (grey bar) partitions for each gene. Opsins are ordered from shortest to longest wavelength with maximal absorbance in nanometers shown above the opsin according to Oryzias latipes (see Matsumoto et al. 2006). Lime highlights indicate the best fitting model(s), with ΔAIC < 2. Asterisks indicate significance of the CmC model, with *indicating partitions that were significant (p < 0.05) against M2aRel, and **indicating significance (p < 0.05) for both CmC versus M2aRel and CmC versus CmCNULL (when ωD is significantly positively selected) or in the case of 3P, the 3P CmC model versus CmC for each individual diet (Color figure online)

Overall Patterns of Molecular Evolution

Figure 2B summarizes results of CmC-based analyses of molecular evolution performed on the ML species tree (online resource 2, Tables S3–S7). These results were generally congruent with analyses conducted on individual opsin gene trees. Best-fitting models are highlighted, and it is evident across genes that models that incorporate diet as a factor explaining differences in patterns of molecular evolution are generally a better fit than models that incorporate habitat. In addition, best fitting models partitioned by diet are more often statistically significant. Below, we focus on interpreting ω values for the divergent site class (ωD) for models that are considered the best explanations of the data and that are statistically significant.

Purifying Selection in Beloniformes SWS Opsins Affected by Diet and Habitat

Overall, we found evidence of purifying selection across all habitat and diet categories for SWS1, SWS2A, and SWS2B. SWS opsins are evolving much more conservatively when compared to RH2 and LWS opsins (Fig. 2B).

We anticipated a shift to positive selection in SWS1 in zooplanktivores, because UV-sensitive vision aids in foraging for small, suspended particles (Utne-Palm 2010; Novales Flamarique 2013). Instead, we found purifying selection in all analyses of this gene, but detected comparatively elevated ωD values in zooplanktivores. This trend was also observed in SWS2B and SWS2A.

When considering the effect of habitat, we found that in contrast to the pattern observed in zooplanktivores, freshwater beloniforms showed evidence of greatly constrained SWS opsins compared to marine beloniforms, with ωD < 0.2 for all three genes.

Positive Selection in RH2 Opsins in Piscivores and Freshwater Lineages

All our analyses of RH2A and RH2C showed ωD values greater than 1, providing strong evidence for positive selection in these genes (Fig. 2B). The best-fitting models for these genes all indicated particularly elevated ωD value in piscivores. In contrast, zooplanktivores and herbivores showed ωD values that were very similar to background levels, suggesting that these diet categories did not markedly alter patterns of evolution in these genes.

In contrast to the pattern observed for SWS genes, the RH2 opsins showed evidence of elevated ωD values (> 3.5) in freshwater compared to marine lineages, indicating increased levels of positive selection in freshwater, although these differences were not statistically significant.

Positive Selection in the LWSA Opsin in Zooplanktivores

The long wave sensitive opsin LWSA showed evidence for positive selection that was generally correlated with diet, as the three partition diet model was the best supported (Fig. 2B). Zooplanktivores showed the highest ωD values (> 3) when compared against background or other diet partitions for both genes. In contrast, when habitat is considered, freshwater lineages showed a significant decrease in ωD to near 1.

Positively Selected Sites in Beloniformes Opsins

Individual sites experiencing significant positive selection have been linked to visual tuning (Hofmann et al. 2012; Schott et al. 2014; Van Nynatten et al. 2015; 2021; Carleton et al. 2020). In diet partitions that showed evidence of significant positive selection, positively selected sites were determined using FUBAR and PAML BEB analysis, identifying several key sites that may be influencing spectral sensitivity for the RH2 opsin. Site 205 was identified as a positively selected site in both medium wavelength opsins in piscivores and supported by all three BEB models (online resource 1, Fig. S5; online resource 2, Table S7). This site is located in transmembrane region 5 (Schott et al. 2014) and is adjacent to known spectral tuning site 207 (Nakamura et al. 2013; Stieb et al. 2016a). For LWSA, site 49 was estimated to be under significant positive selection for piscivores, site 42 for herbivores, and sites 172 and 201 for zooplanktivores (online resource 1, Fig. S6; online resource 2, Table S7).

Discussion

Drivers of opsin evolution are typically investigated by focusing on single ecological axes (for example, depth in the water column) and their effect on individual genes. Here, we explored the effects of both diet and habitat on the cone opsin repertoire. Our results indicate that SWS opsins are selectively constrained, while RH2 and LWS opsins have experienced positive selection, with levels varying in response to ecological parameters. Surprisingly, overall consideration of best-fitting models of molecular evolution for our data suggests that diet appears to play a more prominent role in opsin evolution than habitat in this ecologically diverse clade of fishes.

Short Wavelength-Sensitive Opsins are Highly Constrained in Beloniformes

All three short wavelength-sensitive opsins (SWS1, SWS2A, and SWS2B) experienced strong purifying selection in beloniforms, but the UV sensitive opsin SWS1 generally had the lowest ω values, indicating that this opsin was under the strongest purifying selection. SWS1 is often retained and expressed in shallow-water fishes where UV light is abundant (e.g., Marshall et al. 2003; Cortesi et al. 2020). Beloniformes occupy shallow water habitats in both marine and freshwater habitats, and our results point to the idea that SWS1 is important for their visual ecology. However, our data suggest the function of this opsin may be relatively conserved across taxa and ecologies, because we did not observe dramatic shifts in selection associated with diet or habitat. While we anticipated a possible shift to positive selection in zooplanktivores because SWS1 plays an important role in zooplankton foraging in both juvenile fishes and adult zooplanktivores (Novales Flamarique 2005, 2013, 2016), instead we found that a zooplanktivores experienced relaxed selective constraint in all three SWS opsins. Positive selection at a few sites in SWS1 in primarily zooplanktivorous species to improve prey detection might elevate ω values by slightly increasing the rate of nonsynonymous substitutions. An important consideration for future work investigating SWS opsins in Beloniformes is the fact that SWS opsins are often differentially expressed during ontogeny in fishes (Hofmann et al. 2010; Härer et al. 2017). SWS1 is typically highly expressed in early larval stages when fish feed primarily on small suspended particles, and SWS2 is more highly expressed in juveniles or adults (O’Quin et al. 2011). It would be valuable to trace SWS expression through ontogeny in different beloniform species, to investigate whether expression patterns differ depending on trophic specialization. Such studies would need to consider the fact that opsin expression can be highly localized and variable within the retina and coexpressed in photoreceptors (Dalton et al. 2014, 2017; Stieb et al. 2019), and these effects could be pronounced in fishes that live near the surface. Lastly, UV vision mediated by SWS1 is also important for other aspects of fish behavior, including predator detection and communication, and these factors could be considered in future analyses.

Piscivory and Positive Selection of RH2 Opsins

Throughout teleost history, the medium wavelength RH2 opsins (Lmax range for teleosts ranging from ~ 450-540 nm; Carleton et al. 2020) have undergone a dynamic series of gene losses, duplications, and gene conversion events (Musilova and Cortesi 2021). We found that these genes are generally evolving under positive selection in beloniforms, with the highest levels of positive selection in piscivores. For highly visual predatory teleosts, expression of opsins sensitive to the blue/green region of the visual spectrum may enhance prey fish detection against dark backgrounds (Levine and MacNichol 1982). Levine and MacNichol (1982) emphasized that possession of blue-sensitive photoreceptors matching the blue background of water aids in distinguishing dark prey, whereas green-sensitive photoreceptors improve the detection of lighter prey against a blue background. Thus, piscivore RH2 opsins may evolve to improve detection of prey fishes in the blue-green water column. Positively selected sites in beloniform RH2 opsins, although not directly spectral tuning, may impact nearby spectral tuning residues such as 163 or 207 (Spady et al. 2006; Nakamura et al. 2013; Stieb et al. 2016a). Future studies could seek to determine the specific effects of selected RH2 sites on opsin function or wavelength sensitivity.

LWS Evolving under Positive Selection in Zooplanktivorous Sauries and Flyingfishes

Zooplanktivores were inferred to be experiencing positive selection in LWSA (Fig. 2B). In contrast, past work on other fishes found herbivory to be more strongly associated with positive selection on LWS (e.g., Stieb et al. 2016a; Carleton and Kocher 2001). Although red light sensitivity likely does not contribute to detection of translucent zooplankton, surface-dwelling zooplankton often have higher levels of pigment molecules such as melanin or carotenoids as a form of UV protection, making them appear more pigmented than translucent (Hansson 2000; Hansson and Hylander 2009). Thus, in the case of the zooplanktivorous beloniforms, the particular ecological niche occupied (epipelagic surface waters) may interact with the visual requirements for detecting prey to drive evolution in LWS.

Additionally, epipelagic zooplanktivorous fishes, such as the sauries and flyingfishes studied here, have many predators, including other fishes, dolphins, squids, and seabirds (Kutschera 2005; Lewallen et al. 2018). Epipelagic prey fishes have evolved several mechanisms for predator avoidance. For example, flyingfishes have evolved enlarged pectoral fins that provide them with the ability to quickly leap out of the water and glide for long distances across the water surface (Davenport 1994). Flyingfishes have also evolved a three-plane cornea (i.e., pyramid shaped) to help identify predators in one plane, distance to the surface in another plane, as well as safe landing zones (Baylor 1967). It is no surprise that use of abundant, available light wavelengths at the surface is essential for the detection of threats and would be important for fishes that occur in environments with large, active predators. Long wavelength light is abundant at the surface (in addition to ultraviolet light) before quickly diminishing below the water surface and generally disappearing below 40 m (Lythgoe 1998). Thus, changes in selection in LWS in zooplanktivorous beloniforms could be related to the detection of approaching predators. We also found that multiple sites were under positive selection in LWS opsins in zooplanktivores compared to only a single site in piscivores and herbivores (Table S7). These sites have not been tested for effects on opsin spectral tuning but are adjacent to sites with minor spectral tuning or structural properties, such as site 173 which is found in transmembrane 4 and may mediate opsin dimerization (Guo et al. 2005; Fotiadis et al. 2006; Schott et al. 2014). Future studies on the functional effects of substitutions at these sites could help to resolve whether diet or other ecological factors, such as trophic position and behaviour, are key drivers of positive selection in zooplanktivore long wavelength-sensitive opsins.

Effects of Marine to Freshwater Transitions on Opsin Evolution

Beloniforms are ancestrally marine but have given rise to multiple freshwater lineages, most notably in the needlefishes and zenarchopterid halfbeaks (Fig. 1). For this study, we distinguished between freshwater species and lineages thought to have experienced an extended period of evolution in freshwater and marine species that may occasionally enter fresh or brackish waters. For example, the Potamorrhaphis/Belonion needlefish clade invaded freshwater more than 22 million years ago (Bloom and Lovejoy 2017). Here we show the effects of evolutionary transitions to freshwater on cone opsins, while previous studies have documented the impact of freshwater invasions on rhodopsin evolution in other taxa (Van Nynatten et al. 2015, 2021). We detected that freshwater lineages exhibit shifts in patterns of selection, with decreasing ωD values in opsins at either end of the sensitivity spectrum (SWS1, SWS2B, SWS2A, and LWSA) but increasing ωD in opsins in the mid-spectral range (RH2A and RH2C) (Fig. 2B), although this was not significant for SWS1. Freshwater habitats are generally red-shifted compared to marine waters due to abundant sediment that selectively attenuates shorter wavelengths of light, thus displacing the spectral range towards green and red light (Bowmaker et al. 1994). It is therefore likely that freshwater surface-dwelling species would benefit from selection on opsins detecting medium wavelengths of light which are more available than shorter wavelengths in freshwater habitats, and offers more avenues for spectral tuning (e.g., towards longer or shorter wavelengths). Further investigation of beloniform opsins could compare RH1 across marine and freshwater lineages, since dim-light vision is important for behavior of some taxa.

Overall, our study is the first to explore the effects of both habitat and diet transitions on the molecular evolution of opsins in a highly vision-oriented and diverse group of fishes. Several studies have considered shifts in habitat to be key factors that drive opsin evolution in fishes. However, even though beloniform lineages have transitioned between oceans and freshwaters, we found that habitat transitions do not play the largest role in driving opsin evolution in Beloniformes. This may be because most beloniform species are diurnal and occupy the upper subsurface layers in both marine and freshwater systems—in these specific zones, light availability is similar between the two systems, limiting the need for changes in spectral sensitivity. Instead, we found that shifts among specialized diets impacted selection patterns on opsins, with a piscivorous diet resulting in strong positive selection in medium wavelength-sensitive opsins and a zooplanktivorous diet resulting in strong positive selection in long wavelength-sensitive opsins. Future investigations of differential opsin expression in this group would shed additional light on visual system adaptation in Beloniformes and may reveal shifts in which cone opsins are expressed in response to different environments, trophic specializations, or through ontogeny. Nevertheless, this study is an important first step in demonstrating that opsin molecular evolution in fishes dwelling in environments with abundant available light is more highly correlated with diet than habitat. These findings highlight the benefit of considering multiple ecological dimensions in investigations of visual pigment molecular evolution.