## ABSTRACT

The differentiation of tissues and organs requires that cells exchange information in space and time. Spatial information is often conveyed by morphogens: molecules that disperse across receiving cells to generate signalling gradients. Cells translate such concentration gradients into space-dependent patterns of gene expression and cellular behaviour. But could morphogen gradients also convey developmental time? Here, by investigating the developmental role of Hh on a component of the *Drosophila* visual system*,* the ocellar retina, we have discovered that ocellar cells use the non-linear gradient of Hh as a temporal cue, collectively performing the biological equivalent of a mathematical logarithmic transformation. In this way, a morphogen diffusing from a non-moving source is decoded as a wave of differentiating photoreceptors that travels at constant speed throughout the retinal epithelium.

## INTRODUCTION

Morphogens of the *hedgehog* (*hh*)/Shh family contribute spatial information during the development of a wide range of organs and organisms (Ingham et al., 2011; Briscoe and Thérond, 2013). Produced at specialized sites within developing organs, Hh molecules disperse and receiving cells respond according to the Hh concentration that reaches them. The mechanisms of Hh dispersion are not yet fully understood, and include potential transport in exovesicles or associated with specialized filopodia, called cytonemes. The lipid modifications of Hh (by cholesterol and palmitic acid) tether it to the membrane, ruling out free diffusion as the major transport mechanism for Hh (reviewed by Simon et al., 2016). In receiving cells, Hh molecules bind to membrane receptors of the *patched* (*ptc*) family. In *Drosophila,* the receptor Ptc (Nakano et al., 1989) forms a receptor complex that also includes the adhesion molecules iHog and Boi (Bilioni et al., 2013). Hh binding to Ptc relieves the repression of Smoothened (Smo) by Ptc, which, in turn, blocks the processing of the Gli transcription factor *cubitus interruptus* (Ci) into its repressor form. The result of this double-negative regulation is the stabilization and activation of full-length Ci (CiA), which then acts as a transcriptional activator of Hh pathway targets (Aza-Blanc et al., 1997; Alexandre et al., 1996). One of the target genes activated by Hh is the receptor *ptc* itself (Hidalgo and Ingham, 1990; Capdevila et al., 1994). Because Ptc is simultaneously the Hh receptor and a positive target of the pathway, it plays a very important dynamic role in Hh-driven patterning processes. As the pathway is activated, Ptc expression rises closest to the source (where higher Hh levels are received), trapping increasing amounts of Hh. This mechanism allows the reshaping of the Hh gradient as time passes, starting from shallower longer-reaching gradients to steeper shorter-reaching ones. This phenomenon has been observed both in *Drosophila* and vertebrate systems, and is important in establishing dynamically different domains of gene expression at different distances from the Hh source (Gallet and Therond, 2005; Nahmad and Stathopoulos, 2009; Dessaud et al., 2007; Chamberlain et al., 2008).

However, and although Hh signalling has been mostly involved in spatial patterning, in two systems Hh has also been shown to be required for temporal patterning – i.e. the reiteration of a developmental process at a particular pace. During the development of the *Drosophila* compound eye, Hh drives a wave of photoreceptor (R) cell differentiation across the eye primordium at a constant speed (Ma et al., 1993; Heberlein et al., 1993). A similar Shh moving wave has been described during the differentiation of the ganglion cells in the zebrafish retina (Neumann and Nuesslein-Volhard, 2000). However, these waves are not generated based on the morphogen characteristics of Hh/Shh (i.e. differential responses to varying Hh concentration in space), but on the fact that the source of Hh production itself moves across the developing retina: Hh/Shh molecules are expressed in differentiating retinal cells (R cells in *Drosophila* and ganglion cells in zebrafish) and non-autonomously induce progenitors to differentiate into retina cells that, in turn, start producing Hh/Shh. In this way, the source of signalling molecule moves coupled to the differentiation process.

In *Drosophila,* the compound eye develops from the cephalic disc (also called the ‘eye-antennal’ disc), a monolayered epithelial sac that additionally gives rise to another component of the fly visual system: the ocellar complex. This complex comprises three small camera-type eyes, or *ocelli* (one anterior ocellus and two posterior ocelli), located on the forehead of the fly that are part of the visual system of most insects (Fig. 1A,B). Similar to the compound eye, the specification of the ocelli requires Hh signalling (Royet and Finkelstein, 1996; Blanco et al., 2009; Aguilar-Hidalgo et al., 2013). In the prospective ocellar complex region of the disc, one domain of Hh expression is flanked by two regions competent to differentiate into the ocellar photoreceptors (R cells) under the action of Hh signalling. One marker of competence is the gene *eyes absent* (*eya*) (Blanco et al., 2009; Aguilar-Hidalgo et al., 2013) (Fig. 1C,D). When the two contralateral discs fuse, the anterior ocellar regions merge into the single anterior ocellus (aOC), while the two other regions remain separate and will develop into the paired posterior ocelli (pOC). Previous work has defined the gene regulatory network that, under the control of Hh, results in the specification of the OC competent regions and regulates their size (Aguilar-Hidalgo et al., 2013, 2016). Here, we further investigate the role of Hh in the next developmental step: the differentiation of the ocellar retinas. First we find that, in the ocelli, R differentiation also proceeds as a wave of constant speed, and that this wave depends on Hh. However, and in contrast to the compound eye, Hh is not expressed in ocellar R cells, but remains expressed in a spatially static source. Our work further shows how the non-linear gradient that emanates from this source of Hh signal can in principle be translated into a wave of R differentiation with constant speed, owing to a single modification in the Hh signalling pathway: the attenuation of Ptc expression as R cells differentiate. Thus, Hh, produced at a spatially static source, can be read as a ‘time arrow’ during R differentiation.

## RESULTS AND DISCUSSION

In order to study how Hh signalling controls the differentiation of the ocellar retinas, we first set to study the dynamics of R cell differentiation, focusing on the larger posterior ocellus.

The ocellar competent regions, which abut the Hh-expressing domain, can be labelled with Eya, and R differentiation can be followed using the neuronal markers Elav and Glass. In fixed discs of increasing age, we observed that R cell differentiation proceeded in a wave-like fashion – i.e. differentiation starts in the vicinity of the Hh source and then progress in a proximal-distal direction across the ocellar tissue (Fig. 1E). The transition from precursors to R cells can be monitored using the precursor marker gene *senseless* (*sens*) (Nolo et al., 2000) (Fig. 1, Fig. S1A-C). We find that, as in the compound eye, Sens expression precedes temporally that of Elav. Sens expression in differentiating R cells is transient, and it decreases as Elav expression increases. Spatially, Sens and Elav distribute along a proximal-distal axis with respect to the Hh source. Therefore, the differentiation wave can be visualized as a succession of Elav and Sens along this axis, with new Sens-expressing cells being added progressively further away from the Hh source as differentiating cells express Elav and downregulate Sens (Fig. 1, Fig. S1). Importantly, and in contrast to the moving wave of Hh that sweeps across the developing compound eye, Hh is never expressed in ocellar R cells (Fig. 1, Fig. S1D,D′) (Aguilar-Hidalgo et al., 2013; Amin et al., 1999). The Hh source remains the inter-ocellar region and, therefore, does not move in space. To start investigating the potential role of Hh signalling in organizing this wave, we first examined the distribution of Hh across the competence domain, which is about 40 μm (10 cells) wide, using a Hh:GFP BAC construct (Chen et al., 2017). Hh:GFP disperses away from its source following roughly a decaying exponential (Fig. 2A,A′ and see below). The Hh receptor Patched (Ptc) is also a target of the signalling pathway, so that its expression can be used as a read-out of the signalling activity of the pathway (Nakano et al., 1989). We found that, before R differentiation starts, Ptc expression follows the Hh:GFP gradient (Fig. 2A,A′ and see below), indicating that Ptc signalling intensity reflects Hh distribution across the ocellus. In addition, this result suggested that the non-uniform Hh distribution could contribute to generating the wave, transforming the spatial gradient into a temporal axis, such that cells closer to the Hh source (and therefore receiving a higher concentration of Hh) would differentiate earlier than cells farther away. To test this possibility, we equalized Hh signalling across the developing ocellus by expressing, specifically in the ocellar primordia, uniform levels of *cubitus interuptus* (*ci*), the Gli-type nuclear transducer of the Hh pathway (Fig. 2B,C, Fig. S2A,B). As the stabilization of Ci depends on Hh signalling (and this signalling decays as the distance from the source increases), we drove expression of a mutant form of Ci that cannot be phosphorylated by PKA (‘Ci-PKA’) and, hence, is not cleaved into the repressive form of Ci (Methot and Basler, 2000). In *eyaL>Ci-PKA* ocelli*,* a larger than normal number of cells had initiated the expression of Sens and Elav relative to control ocelli, indicating their premature differentiation. More importantly, the progression of the wave seemed disrupted: instead of the succession of Elav and Sens cells, Elav and Sens cells are intermingled in Ci-overexpressing ocelli (Fig. 2B,C). This result was compatible with the idea that the Hh signalling gradient encodes a temporal axis that generates the wave-like differentiation of ocellar R cells. To test this point more directly, we distorted the normal distribution of Hh by inducing new foci of Hh expression from around the developing ocelli (*wg2.11-*GAL4; *UAS-GFP:Hh* or ‘*wg>Hh*’; Pereira et al., 2006 and Fig. 3) to then compared the spatial patterns of Elav^{+}Sens^{-}, Elav^{+}Sens^{+} and Elav^{–}Sens^{+} cells between control and *wg>Hh* ocelli (Fig. 3A-D′). Because even the wild-type pattern shows some variability, we used a statistical analysis to compare the ‘grouping’ (as measured by the departure from a random proportion of neighbours of a given type) and ‘polarity’, which measures the ordered succession of cell states along the proximodistal axis (and is a defining trait of a wave) (Fig. S3A-C′). Control and *wg>Hh* patterns were both significantly – but similarly – different from random (Fig. S3D), as expected if spatially localized Hh drives the pattern of differentiation. However, when ‘polarity’, the metrics that reflects a wave-like organization, was analysed, control samples were significantly more polarized than *wg>Hh*, which were closer to a non-polarized distribution (Fig. S3E; see Materials and Methods for a complete description of the statistical analysis). We subjected the ocellar patterns of *eyaL>Ci-PKA* larvae to the same analysis and found also that they were close to non-polarized (Fig. S3E). These results confirm that, despite the variability of the system, the pattern of differentiation from Sens precursors to Elav photoreceptors progresses as a wave, and reinforce the notion that the distribution of Hh across the developing ocellus is necessary for organizing this wave.

Next, we tested whether blocking Hh signalling could result in abrogation of R differentiation. To do that, we expressed a dominant-negative Ptc receptor (PtcΔloop2), which, due to its incapacity to bind Hh, represses the pathway constitutively (Briscoe et al., 2001). Our results show that, as in the compound eye, Hh is necessary for R differentiation in the ocelli (Fig. S2C-E). Altogether, our results so far indicated that the time needed for a cell to start differentiating depends on the amount of Hh that it receives.

Because Hh distribution decays non-linearly in space (Fig. 2A′), R cells should also accumulate non-linearly over time (i.e. with fast R cell generation close to the source and progressively slowing down with increasing distance from it). To test this hypothesis, we quantified the number of Elav-expressing R cells over developmental time. As developmental timer, we used the number of rows of ommatidia that have undergone differentiation in the compound eye, which is known to increase at a constant speed (Wartlick et al., 2014; Vollmer et al., 2016) at least during the second half of the last larval stage (Spratford and Kumar, 2013), the period during which ocellar differentiation takes place. In contrast with the expectation, though, the number of Elav cells increased linearly with time in both anterior and posterior ocelli, indicating that the differentiation wave propagated at a constant speed (Fig. 2D).

In order to explore the signalling outputs in this system, we constructed a mathematical model capturing the essence of the Hh signalling pathway (see Materials and Methods). In this model, Ptc represses Hh signalling targets unless it binds Hh. As Ptc is one of the targets of the pathway, Hh binding to Ptc releases the repressive action of Ptc and results in its upregulation (Nakano et al., 1989). Sens is included as a target in the model, although this does not imply that Sens is a direct target. Expression of Elav in Sens-expressing precursors follows irreversibly, and to reflect the loss of Sens expression observed in Elav cells, we have also included a negative feedback from Elav to Sens (see Fig. 4A). The dynamics of Hh production and dispersion in the model were calibrated using measured Hh:GFP profiles determined experimentally (Fig. S4; and see Table S1 for values, units and source of parameters). The intrinsic variability of the system is modelled by introducing a 20% variability in all parameters of the model (see Materials and Methods). In brief, the model simulates a two-dimensional array of 10×10 cells (see Fig. S5 and Movies 1 and 2) that respond to an external concentration of Hh. Hh is being secreted at one of boundaries of the system and diffuses through the array. The response to Hh in each cell is simulated by numerically solving a set of ordinary differential equations (ODEs) that model a simplified version of the Hh signalling pathway (Fig. 4A, see Materials and Methods). With no further assumptions, the model simulations confirmed the prior expectation: the accumulation of Elav cells was non-linear and differentiation was often not completed during the developmental period allowed (40 h) (Fig. 4B). The fact that the model was unable to reproduce the experimental observations indicated that our understanding of the signalling dynamics was missing some important process. Owing to the key relevance of Ptc as both Hh receptor and target of the pathway, we examined in detail the dynamics of Ptc accumulation during differentiation. We found that, although before R cell differentiation Ptc signal followed a non-linear decay with a strong peak close to the Hh source (see Fig. 2A,A′), at later stages Ptc signal decreased dramatically in R cells, identified by expression of Elav (Fig. 4C-D′). As binding of Hh to Ptc reduces its mobility (Chen and Struhl, 1996), we reasoned that the reduction of Ptc availability in R cells could allow the non-bound Hh to move over these cells and disperse farther away from the source. In this model, the sequential dampening of Ptc expression acts as a ‘desensitization’ mechanism. When this Ptc dampening was incorporated in the model (simplified as a repressor link from Elav-R to Ptc) it now correctly predicted that the differentiation wave moves with about constant velocity, and achieves the full differentiation of the progenitor population during the differentiation window (Fig. 4E) (see also Movies 1 and 2). In addition, the simulated dynamic profile of Hh matched that measured experimentally (Fig. S4), with its gradient flattening and reaching further as developmental time progresses. Simulations include the ∼50% reduction of Hh:GFP production that we observed experimentally (Fig. S4A) but the results remain the same if the Hh production rate is constant (Fig. S5). Therefore, the desensitization of differentiating cells to Hh, caused by the dampening of Ptc, would allow the field of ocellar competent cells to transform the Hh gradient into a moving signalling and differentiation wave of constant speed. It has been described that Ptc is downregulated upon binding to Hh (Gallet and Therond, 2005; Incardona et al., 2002; Torroja et al., 2004) and also in a self-regulated manner (Casali, 2010) in *Drosophila* wing discs. To test whether the dramatic downregulation of Ptc we observed was due to R cell differentiation or merely to a process depending on ligand binding or Ptc concentration, we examined Ptc levels in the ocelli of late discs from *atonal* (*ato*) mutant larvae, in which R differentiation is abrogated (Fig. S6)*.* For each disc, the levels of Ptc signal in the ocelli were normalized relative to the signal in the antenna of the same disc. Whereas in control discs (*ato1 ^{−/+}*) the relative levels of Ptc decrease with time (Fig. S6A,B), Ptc expression is maintained at levels comparable with those found in control discs before the onset of R differentiation, despite their having been exposed to Hh for the whole duration of the third larval stage (Fig. S6C). To test directly whether R differentiation was causing Ptc downregulation, we drove uniform and premature Sens expression to force ocellar cells to differentiate prematurely. As expected, after Sens overexpression, the ocellar region of

*eyaL>Sens*larvae had an increased number of Elav-expressing cells relative to stage-matched controls. These cells also showed a concomitant loss of Ptc expression (Fig. S6F,G). To investigate

*ptc*regulation further, we analysed

*ptc*expression using a

*ptc-Z*transcriptional reporter. Indeed,

*ptc-Z*signal falls in Elav-expressing cells, suggesting that, as differentiation proceeds,

*ptc*is repressed transcriptionally (Fig. S7). Therefore, in the ocelli, R differentiation is a major controller of Ptc dynamics.

One important aspect of ocellar differentiation is that, by the end of development, the number of R cells per ocellus is very consistent (the number of R cells of the adult posterior ocellus is 47.9; s.d.=0.7; *n*=5). However, we have noticed in static measurements of Hh:GFP that its signal is highly variable (Fig. S4). To test for robustness, we compared the output of the model with or without signal desensitization, varying Hh production rates by up to 10%. Although without desensitization the dynamics were far from linear and the time to differentiation termination varied widely, the model including reduced Ptc availability coupled with differentiation maintained linearity (i.e. constant differentiation speed) and showed low variability in time to termination, despite these variations in production rates (Fig. 5, Fig. S8). Therefore, our model predicts that, in addition to promoting a differentiation wave of constant speed, the R differentiation-induced Ptc desensitization results in increased developmental reliability.

Previous work had shown, in different developmental contexts, how a spatially static source of Hh/Shh coupled to its intracellular signalling network could generate spatial patterns of gene expression (reviewed in Briscoe and Thérond, 2013). In all these cases, the dynamics of Ptc expression were shown to be particularly important. For example, in the *Drosophila* epidermis, Hh is produced in a stripe per segment. Early, Hh spreads over the whole width of the segment and represses the target gene *Serrate* (*Ser*). Later, as Ptc upregulation sharpens the gradient, Ser becomes expressed in cells most distal to the Hh source, with Ser cells contributing a specific cell type in the dorsal epidermis. Interestingly, different segments exhibit different temporal dynamics (with some segments never showing Ser expression) (Gallet and Therond, 2005), suggesting that the Hh/Ptc dynamics may be subject to the control of segment-specific Hox genes. Another example is the patterning of the vertebrate neural tube along its dorso-ventral axis by Shh, which is expressed in the floor plate. Here, the upregulation of the receptor Ptc1 not only results in a change in the signalling profile across the tissue, but also causes a progressive cell-autonomous desensitization of the pathway, as increasing levels of unbound Ptc1 inhibit the signal transduction pathway (Dessaud et al., 2007). This desensitization may resemble the one we have described here. However, in the ocellar retina, the pathway becomes desensitized by a reduction of Ptc expression, which involves its transcriptional downregulation in photoreceptor cells.

In this article, we show that a spatially static Hh source can also be decoded as a linear ‘time arrow’ – a wave of differentiation of photoreceptors with constant speed. This capacity requires a single change in the regulation of the Hh receptor Ptc. Two system-level properties are worth mentioning: First, the ‘log-transform’ of the signal of the gradient is an active process, in the sense that cells are not passive readers, but transform the signal dynamically through a reactive intracellular signalling network. Second, the mathematical transformation of the signal is an emerging property of the system: although the signalling changes operate at the single cell level, this transformation requires a number of cells coupled within a Hh gradient. Even though the pervasive use of Hh/Shh as a morphogen might be the result of evolutionary contingencies, an alternative explanation is that Hh and its signalling pathway, by acting on fields of cells, are flexible in the type of information outputs that cells generate when reading the gradient. It is conceivable that this flexibility would be a selective advantage that might have resulted in the Hh signalling pathway being redeployed once and again during evolution.

## MATERIALS AND METHODS

*Drosophila* strains and genetic manipulations

Hh:GFP (BAC) was used to monitor the expression for Hh protein (Chen et al., 2017). *ato ^{1}* is an

*atonal*mutant allele (FlyBase) and

*ato:GFP*has been described by Quan et al. (2016). GAL4/UAS crosses were set up at 29°C to maximize GAL4-driven expression, except when indicated. The

*hh-GAL4, UAS-GFP:Hh*strain was used as reporter for Hh expression (Callejo et al., 2008). Elav-Gal4 (FlyBase) was used to drive UAS-

*H2B-mCherry-P2A-eGFP-PH*line (Sánchez-Higueras and Hombría, 2016) in differentiated R cells, allowing the distinction between nuclei (mCherry) and cell membranes (eGFP) (experiment at 25°C). The FlyLight (Jenett et al., 2012) GAL4 line R20D09 from

*eya*(herein referred to as EyaL-GAL4) was used to drive UAS transgenes specifically in the anterior and posterior ocellar competence domains (Fig. S2). UAS lines used were: UAS-nlsGFP (FlyBase), UAS-Ci-PKA (Methot and Basler, 2000) and UAS-GFP-

*ptc*Δloop2 (UAS-

*ptc*DN) (Briscoe et al., 2001). Larvae from crosses of

*eyaL-GAL4*and UAS lines were raised at 29°C. GMRtdTom was used as a reporter of Glass to monitor the PR cells and membranes (Pappu et al., 2011). Quantification of the number of R cells over time was performed in the wild-type strain Oregon R at 25°C. To perturb the normal distribution of Hh, a GFP-tagged Hh (UAS-GFP:Hh; Torroja et al., 2004) was driven with the

*wg2.11-GAL4*strain (

*wg2.11-GAL4; UAS-GFP:Hh,*or ‘wg>Hh’). wg2.11 is an enhancer of the

*wg*gene that is expressed surrounding the ocellar region and overlapping the prospective interocellar region in the eye imaginal disc [described by Pereira et al. (2006) and see Results].

### Immunofluorescence

Medium to late third instar larvae and pupae were dissected and fixed according to standard protocols. Immunostainings were performed as previously described (Bessa and Casares, 2005). We used the following primary antibodies: rabbit anti-GFP at 1:1000 (Molecular Probes), rat anti-RFP at 1:500 (Chromotek), rabbit anti-β-gal at 1:1000 (Cappel), mouse anti-Eya 10H6 at 1:400, rat anti-Elav 7EBA10 at 1:1000 and mouse anti-Ptc at 1:100 were from the Developmental Studies Hybridoma Bank. Aliquots of mouse anti-Sens at 1:250 were gifts from Andrew Jarman (University of Edinburgh, UK), Bassem Hassan (ICM, Paris, France), Rosa Barrio (Biogune, Leioa, Spain) and Xavier Franch (IBE-UPF, Barcelona, Spain), and rat anti-Ci 2A1 at 1:5 was a gift from Bob Holmgren (Northwestern University, Evanston, IL, USA). Imaging was carried out on Leica SP2, SPE or SP5 confocal microscope.

### Measurement of the Hh:GFP signalling gradient dynamics

Eye discs from the BAC Hh:GFP strain were dissected from 96-130 h after egg laying (grown at 25°C) and stained simultaneously. Number of discs per experiment was 11 or more and one representative example is shown. Developmental stage was determined as number of ommatidial rows in the region of the compound eye. Imaging was carried out using a Leica SP5 confocal setup with the same settings. Lasers were warmed up beforehand for 1 h. Fluorescence intensity measurements were obtained with Fiji (Schindelin et al., 2012) by selecting a ROI across the ocellar complex. Then a Plot Profile was generated for the ROI and the quantitative data were obtained were processed in Excel.

#### R cell recruitment over-time

*Y*is the number of R cells,

*X*is the number of ommatidial rows in the compound eye; β

_{0}is the intercept coefficient, β

_{1}is the number of ommatidial row coefficient, N is the number of data points and σ

^{2}is the variance and ε is the regression error. The model was estimated by the least squares method using the

*lm()*function in Rsoftware and validated checking for normality, independence and homoscedasticity of residuals. The analysis shows a statistically significant linear dependence between PR cell number and developmental time, either when considering PR cell number of the anterior or the posterior ocelli individually or aggregating the data from both ocelli. Table 1 provides a summary of the statistical results of the linear regression.

#### Quantification of adult ocelli R cell number

Brain preparations, with the ocelli attached, were dissected from newly hatched (0-1 days) adults, stained with anti-Elav and counterstained with rhodamine-phalloidin (cell membranes) and DAPI (nuclei). Ocelli were imaged as *z*-stacks on an SPE Leica confocal setup and reconstructed using Imaris (Bitplane) for quantification.

#### Spatial statistics of Elav and Sens pattern under normal and perturbed Hh distribution

We imaged as confocal *z*-stacks ocellar regions stained for Sens and Elav from control (Oregon-R strain; *n*=19) or *wg2.11>GFP:Hh* (*n*=18), over the 18-23 ommatidia stage. Three cell states can be observed – (1) [Sens−, Elav+], (2) [Sens(weak), Elav(weak)] and (3) [Sens+, Elav−] – that correspond to differentiating photoreceptors, the transition between precursors and photoreceptors, and precursors, respectively. To obtain a bidimensional description of the distribution of these cells types in the tissue, we superimposed an orthogonal grid (ImageJ: Analyze>Tools>Grid) on a maximal projection of the *z*-stack sections comprising all Sens and Elav signals. The cell size of the grid is set to correspond approximately to the size of the nucleus of the cell, so that, in general, there is only one nucleus per cell of the grid. When a nucleus spans two or more cells in the grid, its position is allocated to the cell of the grid where most of the signal is. Then, a 1, 2 or 3 is assigned to each grid cell according to its Sens and Elav signal. A grid cell with no signal is assigned a ‘0’. The result is a two-dimensional matrix of positions of the three states per sample (Fig. S3).

### Statistical analysis of Elav and Sens expression patterns

In order to test the departure from a random pattern of Sens and Elav expression, we defined two statistics: ‘grouping’ and ‘polarity’. Importantly, the degree of polarization will tell whether the pattern is compatible with a wave-like organization. For the analysis, each matrix comprising 1, 2 and 3 cell types (Elav+Sens−, Elav+Sens+ and Elav−Sens+, respectively) is split into two matrices, one in which 2 is identified as 1 and another in which 2 is identified as 3, because ‘2’ is expression of 1 and 3 in the same cell. This allows a straightforward statistical analysis.

*i,*the proportion of Elav- or Sens-expressing neighbours,

*p*

_{i}, is calculated as:where

*s*

_{i}is the number of neighbours of a given type and

*n*

_{i}is the total number of neighbours [this number will depend on the position of the cell within the matrix, with cells in the centre with more neighbours (8) than those in the periphery]. Grouping is a global property of the ocellus, so the estimation of grouping for the whole ocellus could be reduce to count the number of Elav- or Sens-expressing cells relative to total cells in the neighbourhood:However, this grouping is strictly dependent on the proportion of Elav or Sens in the ocellus, so in order to obtain an unbiased measure of grouping, the total proportion of cells expressing a factor needs to be subtracted from the proportion of this factor in the neighbourhood. As a correction of the statistic thus defined we actually consider the total proportion as:Where

*S*is the total number of cells expressing the factor in the ocellus and

*N*the total number of cells in it. We have to subtract 1 from the numerator and denominator because each time we calculate the proportion of neighbours, we focus non-randomly on a cell expressing the factor (effectively we are ‘removing’ one case from the sample) so the proportion of success in the neighbourhood that can be expected in a random matrix would be lower than the actual proportion. Grouping of cells of the same type is the expressed as follows:where

*x*is the expressed factor, Elav or Sens.

*y*) around a cell of the other type (

*x*), the grouping would be defined as:Where

*x*is the expressed factor in a cell, and

*y*is the other factor, expressed in the neighbourhood of the cell.

*Y*that classifies a cell as expressing a factor, 1, or not, 0. So we can define a logistic regression model to predict the expression of this factor in a cell using column position

*X*as a predictor:The hypothesis for Elav is that its expression will be ‘proximal’, i.e. the left or first column, whereas Sens will be ‘distal’, i.e. the right or last column, so after the estimation of the model for each factor, we will use these models to predict the probability of finding ELAV in the first column and Senseless in the last one. The following expressions define them:andwhere

*n*is number of columns in the matrix and α is the factor used.

*S*

_{α}is the number of cells expressing the factor and

*N*the number of cells in the matrix.

*wg>Hh*, a Welch's test for unequal variances was performed for each grouping variable:

The same hypothesis was posed and the same test performed for polarity, first to check whether these groups were significantly different from one another and then to check whether the polarity was larger than 0.

Statistics and data treatment were performed in R software. Data matrices were imported to R from.csv.

### Adult cuticles dissections

The dorsal head capsules were dissected in PBS. Brain tissues and proboscis were removed from the samples. All the structures were incubated overnight in Hoyer's:Lactic Acid (1:1) solution at 80°C (Magri et al., 2018). Imaging was carried out on a Leica DM500B microscope with a Leica DFC490 digital camera. All images were processed with Fiji (Schindelin et al., 2012).

### Modelling the Hh pathway in the *Drosophila* ocelli

Simulations were performed using an in-house computational script developed in Matlab (The Mathworks). This script is available as source code (Source code File 1). Equations are discretized in space and time using an Euler approach, with adimensional concentrations but dimensional variables in space and time. The model is based on a hybrid approach that combines partial differential equations (PDEs) solved in a continuous space and ordinary differential equations (ODEs) that are solved in a discrete space. The PDEs account for the diffusive extracellular signals, whereas the ODEs account of the intracellular reactions. Cells are simulated as two-dimensional regions in a hexagonal Voronoi diagram, with cell-to-cell variability introduced as gamma-distributed values for each of the kinetic constants of the reactions involved, with a standard deviation of 20% of the mean value.

The equations define a simplified representation of the Hh signalling pathway, illustrated in Fig. 3. Our model is based on the idea that the differentiation of photoreceptors regulated by Hh is a dynamic process, owing to the fact that the amount of Hh that each cell in the tissue receives depends on time. To reduce free parameters and to try to obtain a simplified model that includes only the basic interactions that are required to reproduce the experimental observations, we have condensed all production and degradation rates in two constants (see Table 1). In addition, we have condensed all Hill coefficients in three constants. Free Hh degradation or Elav downregulation are not included in the model equations, as they are not relevant to the process studied by the model. The set of interactions that the model takes into account are outlined in the following paragraphs.

#### Diffusion of the Hedgehog (Hh) morphogen

#### Binding of Hh to its receptor Ptc

*Ptc-Hh*) (Gallet and Therond, 2005; Incardona et al., 2002; Torroja et al., 2004), following the scheme:where

*k*corresponds to the affinity rate constant of the interaction.

_{Hh}*Hh*corresponds to the amount of Hh that a given cell

_{i}*i*is receiving, computed at each time step as the average value of Hh over the whole cell area of cell

*i.*In this way, the continuous value of Hh computed in Eqn 1 is converted to a discrete value for each cell in the population

*Hh*. This value is then used to compute the amount of Hh that binds to Ptc via Eqn 2, as an ODE that is solved for each cell in the hexagonal lattice:This ODE equation is then solved continuously in time but discretely in space, i.e. for each cell

_{i.}*i*in the population. The amount of Hh molecules consumed by each cell

*i*in each particular position is the subtracted from the continuous spatial variable Hh in the corresponding position. The resulting Hh profile is then computed at the next time step using Eqn 1.

#### Expression of Ptc and binding to Hh

*.*In the absence of Hh

*,*free Ptc acts, indirectly through inhibition of the signal transducer Smo, as a repressor of Hh signalling target genes. This repression is set in the model as sigmoidal function of Ptc, with cooperativity

*m*=3 (slightly higher or lower values of

*m*also reproduce the experimental results). As one of Hh targets is Ptc itself, the sigmoidal repression is introduced in the equation corresponding to Ptc, forming a direct negative-feedback loop. In addition, a constant degradation of Ptc is introduced to ensure a dynamic equilibrium in its concentration. Taking this into account, the dynamics of Ptc is described by the following ODE:where

*α*and

*ß*corresponds to the rate constant for production and degradation.

*A*corresponds to the half maximal concentration of the sigmoidal curve, and

*m*sets the slope of the sigmoidal. The next term accounts for the binding of Ptc and Hh, following Eqn 2.

The second version of the model includes a reduction of available (‘free’) Ptc in terminally differentiated photoreceptors*.* This is simplified in the model by adding the last term in Eqn 4 in the form of a Hill function dependent on *Elav,* a marker of photoreceptor (‘R’) fate.

#### Expression of Senseless (Sens)

*senseless*(Sens), a zinc-finger transcription factor required for ocellar photoreceptor differentiation downstream of the proneural gene

*atonal*(Nolo et al., 2000; Frankfort et al., 2001). Our model described the dynamics of expression of Sens by the following ODE:where the expression of

*Sens*is mediated by simple direct repression by

*Ptc,*where the half maximal concentration of the sigmoidal correspond to

*B*. In addition, we have observed that, during ocellar differentiation,

*Sens*expression is also lost in terminally differentiated photoreceptors. We represent this loss of

*Sens*expression in the models as a direct repression by

*Elav*in each cell

*i.*To make this repression stronger than the repression by Ptc, the second term is elevated again to

*m.*

#### Differentiation into a terminal photoreceptor cell

*elav*gene. Its expression is assumed as directly proportional to the amount of Sens. Therefore, the equation for the dynamics of Elav takes the form:Once the concentration of Elav reaches a given threshold value in a cell

*i*, the model assumes an irreversible transition to a differentiated photoreceptor.

## Acknowledgements

We thank T. Kornberg (UCSF), C. Sánchez-Higueras and J. C. G. Hombría (CABD), G. Struhl (Columbia University) and J. Culí (CBMSO) for fly strains; A. Jarman (University of Edinburgh), R. Holmgren (Northwestern University), B. Hassan (ICM), R. Barrio (Biogune), X. Franch (IBE-UPF) and I. Guerrero (CBMSO) for antibodies; and the CABD ALMI platform for imaging and image analysis support.

## Footnotes

**Author contributions**

Conceptualization: D.G.M., F.C.; Methodology: D.G.-M., T.N.; Software: D.G.M.; Formal analysis: T.N., D.G.M.; Investigation: D.G.-M., A.I., F.C.; Resources: P.S.P.; Data curation: D.G.-M., F.C.; Writing - original draft: D.G.M., F.C.; Writing - review & editing: D.G.-M., T.N., D.G.M., F.C.; Visualization: D.G.-M., T.N., A.I., F.C.; Supervision: F.C.; Project administration: F.C.; Funding acquisition: D.G.M., F.C.

**Funding**

Research was funded through grants BFU2015-66040-P and MDM-2016-0687 (to F.C.) and BFU2014-53299-P (to D.G.M.) from the Ministerio de Ciencia, Innovación y Universidades (Spain).

## References

**Competing interests**

The authors declare no competing or financial interests.