in vertebrates , melatonin and its signaling through g - protein - coupled receptors ( gpcrs ) play a fundamental role in the circadian modulation of physiology and behavior . melatonin is a highly diffusible hormone secreted at night by the pineal organ , which in nonmammalian vertebrates is directly light sensitive ( lamb , 2013 ) . as a  hormone of darkness ,  melatonin levels change according to circadian , lunar , and seasonal cycles ( reiter , 1993 ) . a conserved function of melatonin in vertebrates , from fish to mammals , is the regulation of sleep ( dollins et  al . , 1994 ; zhdanova et  al . , 2001 ) . in mammals , this occurs through direct modulation of neuronal excitability in the suprachiasmatic nucleus , the brain circadian pacemaker ( jiang et  al . , 1995 ) , and in the thalamus , where sleep is initiated ( ochoa - sanchez et  al . , 2011 ) . melatonin is one of the oldest biologically active molecules in  nature , present in a nearly ubiquitous range of organisms , including bacteria and plants . its rhythmic production has been reported not only in vertebrates , but also in various protostomes , in cnidarians , and in dinoflagellates ( balzer and hardeland , 1991 ; hardeland and poeggeler , 2003 ; roopin and levy , 2012 ) . the ubiquitous presence of melatonin ( hardeland and poeggeler , 2003 ) has been linked to its chemical properties , which make it one of the most powerful radical scavengers known in nature ( tan et  al . , 2007 ) . beyond that , the presence of melatonin receptors in all animal lineages , except sponges ( feuda et  al . , 2012 ) , indicates that melatonin acquired an additional signaling function early in animal evolution . it has been speculated that the role of melatonin as the  hormone of darkness  has evolved directly from its antioxidant properties : in a system with constant melatonin synthesis , the reduction of melatonin levels during the day due to its light - dependent oxidation would make it a suitable signal for darkness ( hardeland et  al . , 1995 ) . chemical indicator of darkness  for the circadian regulation of some physiological process and/or behavior . however , the nature of such melatonin - controlled behavior has so far remained elusive , as the role of melatonin signaling has been poorly investigated outside vertebrates . in few cases , it has been demonstrated that melatonin has modulatory ( often inhibitory ) effects on locomotion ( anctil et  al . , 1991 ; bentkowski et  al . , 2010 ; tanaka et  al . , 2007 ; tilden et  al . , 2003 ) ; yet it is not clear whether these effects are linked to circadian rhythms and how they relate to the ancient role of melatonin signaling in animals . to broaden our perspective on the function of melatonin signaling in metazoans , we investigated its possible role in the day / night control of zooplankton locomotion . primary larvae forming most of the zooplankton are part of the life cycle in the majority of animal phyla . they swim using locomotor cilia , which are either distributed over the entire body surface or concentrated in specialized ciliary bands . in the ocean , almost all of these larvae show a pronounced rhythmic behavior , known as diel vertical migration ( dvm ) , which generally consists of an upward swimming phase at dusk and a downward displacement phase throughout the night and/or at dawn ( alldredge and king , 1980 ; forward , 1988 ; rudjakov , 1970 ) . the control of vertical migration in the oceans has been linked to the origin of animal circadian rhythms ( gehring and rosbash , 2003 ; pittendrigh , 1993 ) , as a mechanism to escape damaging uv irradiation during the daytime ( calkins and thordardottir , 1980 ; rhode et  al . , 2001 ) . we thus considered it an attractive hypothesis that melatonin signaling may play a role in the diurnal control of ciliary swimming . to elucidate the possible interplay between ambient light detection , melatonin signaling , and circadian larval swimming activity in an invertebrate zooplankton larva , we chose the annelid platynereis dumerilii , a marine animal model amenable to molecular and behavioral studies , which has conserved vertebrate - type ciliary photoreceptors ( arendt et  al . , 2004 ; jkely et  al . , as an entry point , we found that the most specific marker of melatonin synthesis , the gene hydroxyindole - o - methyltransferase ( hiomt ) ( nowak et  al . , 1993 ) , is conserved in several bilaterian genomes ( figure  s1 available online ) . therefore , in order to identify the platynereis melatonin - producing cells , we performed whole - mount in  situ hybridization ( wmish ) with probes detecting transcripts of platynereis hiomt and of marker genes for phototransduction and circadian clock ( figure  1 ) . expression was detected in the episphere , where the larval brain differentiates ( figures 1a and 1b ) , starting at 34  hr postfertilization ( hpf ) in dorsomedial cells ( figures 1d1f ) and covering the extended ciliary photoreceptor region at 48 hpf ( dashed circles in figures 1g1j ) . this area comprises the previously described ciliary photoreceptors expressing c - opsin1 ( arendt et  al . , 2004 ) . in vertebrate ciliary photoreceptors , phototransduction involves the g - alpha subunit  gt , a member of the gi family , and nonselective cationic cyclic nucleotide - gated ( cng ) channels , which lead to an off response ( hyperpolarization ) in the presence of light . the same phototransduction components were expressed specifically in the platynereis dorsal brain ( figures s2a  s2c , 1e , 1h , and 1k ) . intriguingly , markers of the circadian clock , like bmal ( arendt et  al . , 2004 ) , vrille , and l - cry , the ortholog of the drosophila light - sensitive cryptochrome , were expressed in the same region ( figures s2d , 1f , and 1i ; see also zantke et  al . , 2013 ) . coexpression of these genes was apparent from the similar position of stained cells adjacent to the photoreceptor cilia ( arrows in figure  1 ) and confirmed with the profiling by image registration ( primr ) technique ( tomer et  al . , 2010 ) , which revealed coexpression of platynereis hiomt , l - cry , cnga , and c - opsin1 in a few cells of the dorsal brain , including the ciliary photoreceptors ( blue in figure  1c ) . interestingly , the expression of melatonin synthesis , phototransduction , and clock markers was broader than the highly restricted c - opsin1 expression ( magenta in figure  1c ) and overlapped with that of other opsin family representatives , such as neuropsin ( figure  s2e ) and peropsin ( figure  1j ; compare extended red coexpression region in summary figure  1l ) . our data suggest that photosensitivity , circadian entrainment , and melatonin release are directly coupled , at the cellular level , in the platynereis dorsal brain , just as in pineal photoreceptors . the first experimental evidence for such coupling was obtained from a quantification of gene expression dynamics during the light - dark cycle . we measured simultaneously the expression levels of clock genes , neuropeptides , opsins , and genes of the melatonin synthesis pathway using a high - throughput quantitative pcr ( qpcr ) screen ( figures 2 and s3 ) . to this aim , platynereis larvae were sampled between 45 and 75 hpf ( with the night phase between 56 and 64 hpf ) . the circadian system is already active and entrainable at these larval stages : the expression levels of clock genes ( such as clock , period , and tr - cry ; zantke et  al . , 2013 ) oscillated throughout the light - dark cycle , and in sibling larvae raised in an inverted light - dark cycle ( shifted by 12  hr ) , the phase of clock gene expression was likewise shifted by 12  hr ( figure  2b ) . clustering analysis of gene expression changes over our entire data set retrieved two major groups : genes with expression levels constantly increasing throughout development ( reflecting the steady increase in the number of differentiated cells at these stages ) and genes upregulated specifically during the night ( figures 2a , 2c , and s3 ) . the first group included neuronal differentiation markers , such as synaptotagmin ( syt ) and prohormone convertase 2 ( phc2 ) , several neuropeptides ( conzelmann et  al . , 2011 ) , and rhabdomeric opsins expressed in the eyes ( r - ops1 and r - ops3 ; randel et  al . , 2013 ) . the second group included several genes expressed in the hiomt+ cells , such as peropsin , neuropsin , and cng channel subunits , indicating a night - dependent change of light sensitivity . moreover , all genes involved in the melatonin synthesis and degradation pathway ( tph , ddc , mao , aanat , and hiomt ) were upregulated at night , whereas those exclusively involved in serotonin signaling ( vmat , sert ) were not ( figures 2c and 2d ) . these findings suggested that melatonin itself is produced and released during the night , as reported in other invertebrate species ( hardeland and poeggeler , 2003 ) , and that melatonin release is directly controlled by light and/or by the circadian clock . to identify and characterize a possible effect of nocturnal melatonin release on larval behavior , we assayed larval ciliary swimming . in platynereis , the larval brain controls ciliary locomotion by direct innervation of the prototroch , an equatorial girdle of cells equipped with multiple motile cilia ( figures 1a and 1b ) . changes in the ciliary beating frequency ( cbf ) and in ciliary closure time ( i.e. , length and frequency of ciliary arrests ) differentially affect swimming speed , depth , and direction ( conzelmann et  al . thus , we assayed cbf and ciliary arrests at 52 hpf , comparing larvae in their midday and midnight ( zt8 and zt20 ; zt , zeitgeber time ; figure  3a ) . although cbf did not differ significantly between day and night ( figure  3b ) , we found a significant increase in overall ciliary closure time at night ( figure  3c ) . treatment at night with the melatonin receptor antagonist luzindole dramatically decreased closure time ( figure  3d ) , indicating that the nocturnal increase in ciliary closure time depends on melatonin signaling . consistently , daytime treatment with 100  m melatonin was sufficient to almost double ciliary closure time ( figure  3e ) . finally , we found that absence of light during daytime was not sufficient by itself to increase ciliary closure time ( figure  3f ) . our data are thus consistent with the possibility that the circadian clock contributes to the regulation of the melatonin rhythm ( as in vertebrates ; falcn et  al . , 2010 ) . next , we reasoned that the ciliary closure time depends on two parameters : the frequency and the length of the closure events . therefore , we dissected how these parameters change during day and night . at night , the frequency of ciliary arrests is significantly higher compared to daytime ( figure  3 g ) . moreover , the bimodal distribution of ciliary closure lengths ( figure  3h ) indicated the existence of two distinct kinds of arrests , the  short  and  long  closures ( with an average length of 0.2 and 2.2 s , respectively ; figure  3h ) . the day - night transition involves a significant increase of the proportion of long closures ( figures 3i and 3i ) . the melatonin receptor antagonist luzindole applied at night recapitulated the diurnal condition : the overall frequency of arrests was reduced ( figure  3j ) and the long closures were suppressed ( figures 3k and k ) . conversely , treatment with melatonin during the day increased the proportion of long closures to night levels ( figures 3l and 3l ) . taken together , our data indicate the existence of two alternative behavioral states during day and night , which correlate with the day - night differences in gene expression profile . melatonin signaling is necessary and sufficient to increase ciliary closure frequency and length , establishing the nocturnal behavioral state . to dissect the mechanism of ciliary arrest ciliomotor neurons  driving ciliary arrests and to test whether they are responsive to melatonin signaling . given that the prototroch cells express the acetylcholine receptor 9/10 ( jkely et  al . , 2008 ) , the best candidates were the early developing cholinergic neurons previously identified in the larval brain ( jkely et  al . , 2008 ) . consistent with this , application of acetylcholine ( ach ) significantly increased ciliary closure time , whereas the acetylcholine receptor antagonist mecamylamine was able to suppress the ach effect and reduce ciliary arrests ( figure  4a ) . notably , mecamylamine specifically suppressed the long closures that are regulated by melatonin signaling ( figure  4b ) . acetylcholinesterase staining confirmed direct innervation of the prototroch by cholinergic axons ( figure  4c ) . in particular , the ventral cholinergic neurons , some of which directly innervate the prototroch ( cfr mn3l / mn3r in randel et  al . , 2014 ) , qualified as candidate melatonin - responsive neurons , as indicated by the coexpression of the platynereis melatonin receptor ( mtnr ; figure  s2 ) and the cholinergic marker chat ( figure  4d ) . to test whether melatonin signaling modulates neuronal activity , we performed two - photon imaging on larvae expressing the genetically encoded calcium indicator gcamp6s . to facilitate the identification of the ventral cholinergic neurons , we took advantage of the fact that these cells are located at the interface between the two halves of the larval brain developing from the ab and cd blastomeres ( figure  s4 ) . therefore , we expressed gcamp6s and h2b - rfp in the cd lineage by single - blastomere injections ( figure  5a ) . in control conditions , we detected sparse , arrhythmic small - amplitude calcium transients in these neurons and along their projections . unexpectedly , the application of melatonin elicited enhanced neuronal activity in the most ventral cell of the cholinergic cluster . this heightened neuronal activity also revealed a direct contralateral projection to the prototroch cells through the ventral cerebral commissure ( figure  5b ) . melatonin robustly induced a sustained rhythmic activity pattern , characterized by the appearance of gcamp6s peaks of regular amplitude and frequency ( mean frequency : 0.43  hz ; figure  5c ; movie s1 ) . the melatonin - induced calcium peaks were readily suppressed by subsequent addition of the melatonin receptor antagonist luzindole ( figure  5c ) . moreover , we detected this activity pattern specifically in the prototroch - projecting ciliomotor neuron and never in any of the neighboring cd cells ( figure  5d ) . to test whether the melatonin - induced activity recapitulates the nocturnal endogenous activity , we performed the same experiments at night . in untreated larvae , we found spontaneous rhythmic calcium peaks reminiscent of the melatonin - induced activity ( mean frequency : 0.31  hz ; figure  5e ) . these peaks were suppressed by application of luzindole ( figure  5e ) , indicating that at night this rhythmic activity is induced by endogenous melatonin release . analysis of gcamp6s peak frequency and temporal distribution confirmed that daytime administration of melatonin mimics the spontaneous nocturnal activity ( figures 5f and 5 g ) . notably , the rhythmic activity of the cholinergic neuron proved insensitive to mecamylamine treatment ( figure  s5 ) , indicating that the effect of cholinergic agonists and antagonists on ciliary arrests occurs downstream of these neurons ( i.e. , at the cholinergic ciliomotor synapses on the prototroch cells ) . to better understand the neurophysiological processes that underlie the observed rhythmic firing and the nocturnal change in ciliary arrests , we performed intracellular sharp electrode recordings from prototroch cells . ciliary arrests coincided with electrical activity , as reported previously from extracellular field potential recordings ( conzelmann et  al . , 2011 ) ; however , intracellular recordings with simultaneous imaging of ciliary beating revealed that these arrests coincide with depolarizations that arise from an intrinsic electrical excitability of the prototroch cell ( figure  6a ) . consistent with excitatory cholinergic transmission , application of acetylcholine induced prototroch depolarization , and this effect was suppressed by concurrent mecamylamine application ( figure  s6 ) . application of melatonin caused a significant increase in prototroch spike frequency ( figures 6a6c ) , as well as a decrease in the distribution of interspike intervals ( figure  6d ) , reflecting the sustained electrical activity that would be expected given the effect melatonin has on the length of ciliary arrests . intracellular recordings also revealed the presence of excitatory postsynaptic potentials ( epsps ) . in agreement with the calcium imaging data , melatonin changed prototroch epsps from single sparse events to regular periodic bursts , each characterized by a duration of 0.25  0.08  s ( figure  6e ) . the effect of melatonin was reversible with application of the melatonin receptor antagonist luzindole ( figure  6e ) . moreover , application of mecamylamine after melatonin treatment completely eliminated excitatory synaptic transmission , indicating that this activity was exclusively cholinergic ( figure  6e ) . these results indicate that each nocturnal peak of gcamp6s fluorescence corresponds to a burst of action potentials in the presynaptic cholinergic cells , increasing the likelihood of prototroch spiking . to further assess the effect of melatonin - induced bursting on synaptic transmission this revealed a significant increase of the mean epsp amplitude , indicating that the number of synaptic vesicles released per action potential more than doubles during the melatonin - induced bursting ( figures 6f and 6 g ) . at the same time , the mean resting membrane potential of the prototroch cells ( which do not express mtnr ) was not significantly altered in presence of melatonin ( from 70.45 to 70.39  mv , n  = 7 , ns ) . therefore , we conclude that at night melatonin signaling directly controls the excitability of presynaptic cholinergic neurons , that it induces rhythmic bursting and potentiates synaptic transmission at the ciliomotor - prototroch cells synapses , and that this augmented release of acetylcholine enhances the frequency and duration of ciliary arrests . our combination of expression profiling , neuronal activity imaging , and intracellular recordings in a zooplankton model reveals a  role of melatonin signaling in the circadian control of ciliary swimming . in platynereis , melatonin is necessary and sufficient to establish a nocturnal behavioral state characterized by enhanced ciliary arrests . we can distill the underlying circuit architecture into two major components ( red and blue in figure  7 ) . the first is the sensory - neuromodulatory component , constituted by melatonin - releasing , ambient light - detecting photoreceptors that harbor a circadian clock . the second is the effector component , represented by the cholinergic ciliomotor neurons , which are direct targets of nocturnal melatonin signaling and respond by rhythmic bursting . this system represents a minimalistic example of integration of sensory - neuromodulatory and motor circuits in animal nervous systems . comparative evidence indicates that at least parts of these circuits are of more widespread occurrence in animals and may thus be evolutionary ancient . the shared key feature of the dorsal brain neurons described here is the coexpression of hiomt with markers of opsin - based phototransduction and the circadian clock . the circadian clock is already entrained in early larvae , and several genes expressed in these cells , including hiomt itself , are upregulated at night , suggesting that ambient light detection and the circadian clock control melatonin synthesis . a coupling of these three processes in the same cells is also observed in the pineal photoreceptors of  lower vertebrates ( lamb , 2013 ) , and intriguingly , the platynereis ciliary photoreceptors ( previously compared to pineal and retinal photoreceptors ; arendt et  al . , 2004 ) are part of the clock - controlled , melatonin - releasing system . the expression of multiple opsins in nonvisual photoreceptors of the most anterior ( or apical ) part of the larval nervous system has been documented in other protostomes and in deuterostomes ( ooka et  al . , 2010 ; passamaneck et  al . , a shared feature of this so - defined larval  apical nervous system  ( specified by conserved developmental patterning mechanisms ; marlow et  al . , 2014 ) is the presence of multiple sensory cells that project into a neurosecretory neuropil and release hormones and neuromodulators ( tosches and arendt , 2013 ) . the expression of different opsins in subsets of hiomt+ cells in platynereis hints at a sophisticated responsiveness of the apical nervous system to light . opsins responding to different wavelengths would allow dissecting the spectral composition of light at different depths or during dusk and dawn and may also contribute to moonlight detection for the regulation of circalunar rhythms , which in adult worms has been attributed to the brain region harboring the ciliary photoreceptors ( zantke et  al . , 2013 ) . the upregulation of peropsin , neuropsin , and cng channels during the dark phase might then prepare the larvae to sense moonlight . the expanding array of functional tools available for platynereis ( zantke et  al . , 2014 ) will allow testing these hypotheses and unraveling the contributions of individual opsins and neuropeptides to the annelid ambient light - dependent behaviors . on the effector side , we identify a pair of cholinergic ciliomotor neurons as regulators of ciliary arrests . these neurons belong to a larger cholinergic system that innervates larval ciliary bands , as revealed by acetylcholinesterase staining ; within this system , they are the only neurons expressing the melatonin receptor and responding to melatonin treatments . cholinergic innervation of ciliary bands has been observed in most protostome and deuterostome larvae , and a general requirement of cholinergic transmission for ciliary arrests has been also documented ( lacalli and gilmour , 1990 ; lacalli et  al . , 1990 ) , indicating that the cholinergic ciliomotor system described here is of broader relevance for understanding zooplankton neurobiology . in platynereis larvae , the melatonin - sensitive cholinergic system regulates distinct , long - lasting diurnal and nocturnal behavioral states . at the level of the ciliomotor neurons , this regulation involves the switch from sparse firing to rhythmic bursting . this finding is especially interesting as it may shed light on the evolutionary origin of circadian behavioral states in animals . circadian behavioral states , such as sleep - wake cycles , are widespread in the animal kingdom , indicating that the day - night regulation of activity rhythms is crucial for homeostasis and survival ( allada and siegel , 2008 ) . a defining and conserved feature of sleep , which makes it distinct from rest , is the disconnection of the brain from the sensory environment and hence the increase of arousal threshold . platynereis larvae can respond to a variety of sensory cues , which would ultimately affect ciliary arrests through the same ciliomotor system . for example , ciliomotor neurons are innervated by interneurons of the larval visual system , indicating that they respond to visual stimuli , together with other motoneurons ( randel et  al . , 2014 ) . but could any sensory cue be relayed in presence of rhythmic bursting ? if not , the nocturnal rhythmic burst firing might be a mechanism that filters incoming sensory information and reduces responsiveness to sensory stimuli . in a similar way , in mammals , the switch of thalamic relay neurons to rhythmic burst firing is responsible for filtering sensory information during sleep ( mccormick and feeser , 1990 ) and can be induced directly by melatonin ( ochoa - sanchez et  al . , 2011 ) . it will be interesting to determine whether these functional analogies correspond to conserved molecular mechanisms , for instance , to conserved targets downstream of melatonin signaling . promising candidates are shaker voltage - gated potassium channels , key determinants of neuronal excitability , which are regulated by melatonin ( yang et  al . , 2011 ) and are necessary for sleep in flies and mammals ( cirelli et  al . , 2005 ; douglas et  al . , 2007 ) the most prominent behavior associated with day - night cycles is dvm ( see introduction ) . we propose that the day - night changes in ciliary closure time evoked by melatonin signaling in platynereis correspond to different phases of dvm in the field . in platynereis , a long ciliary closure time correlates with a low vertical position ( conzelmann et  al . , 2011 ) ; therefore , the nocturnal behavior would lead to the slow descent of larvae in the water column . in line with this conclusion , field studies have shown that planktonic annelids reach their highest position in the water column at dusk and then sink throughout the whole night ( alldredge and king , 1980 ) . other zooplankton species show different temporal dvm regimes that often involve muscular rather than ciliary swimming , suggesting a more complex regulation of locomotor activities downstream of melatonin signaling as an adaptation to variable ecological constraints ( lampert , 1989 ) . interestingly , it has been proposed that circadian rhythms and ambient light detection evolved in the context of dvm , an advantageous behavior facilitating escape from light - induced oxidative stress ( gehring and rosbash , 2003 ; pittendrigh , 1993 ) . light - sensitive cryptochromes , present in all basal metazoan phyla , including sponges ( rivera et  al . , 2012 ) , might have represented the first link between ambient light detection and clock entrainment . we now extend this reasoning with the idea that melatonin signaling has been added to this system as an efficient paracrine signal , ensuring better coordination of the organismal response and whole - body physiology and becoming a perfect  chemical indicator of darkness  after its original radical scavenger role . because melatonin receptors and opsins arose from the same duplication of an ancestral g - protein - coupled receptor ( feuda et  al . , 2012 ) , we further hypothesize that melatonin signaling and opsin - based phototransduction evolved in the same dvm context . as photopigment , opsin outperformed cryptochrome by increased signaling speed , signal amplification , coupling with different transduction cascades and an evolvable spectral tuning that , after repeated duplications , allowed perception of colors at different depths and times of the day ( nilsson , 2013 ) . this way the full system involving opsin - based ambient light detection , circadian clock , and melatonin signaling became a key regulator of circadian behavior and persisted in the dorsal brain of annelids and in the pineal and retinal photoreceptors of vertebrates . platynereis genes were either obtained from expressed sequence tag libraries or cloned with rapid amplification of cdna ends ( race ) pcrs and/or rt - pcr using gene specific primers ( pcr primers are listed in the extended experimental procedures ) . in situ hybridizations and acetylcholinesterase stainings ( ache ) were performed and imaged following established protocols , as detailed in the extended experimental procedures . platynereis larvae were fertilized at zt8 ( midday ) and raised in an 18c incubator , under a 16l:8d cycle . nine groups were sampled at different time points , as indicated in figures 2 and s3 . at night , animals were collected under dim red light . for the experiments with the inverted cycle conditions , immediately after fertilization , sibling larvae were raised under an inverted light cycle ( 12  hr shift ) . cdna was synthesized from 100  ng of total rna ; 1.25  l of each cdna was used as a template for a preamplification reaction ( preamp ) of target genes . diluted preamps were loaded on a 48.48 fluidigm biomark dynamic array chip ( spurgeon et  al . , 2008 ) . the chip was run following manufacturer s instructions ( see the extended experimental procedures for further details on the protocol and the list of primers used ) . fluidigm data were analyzed with the bioconductor htqpcr package ( dvinge and bertone , 2009 ) . the genes cdc5 and rps9 were used to obtain the normalized dcq values , and for each time point the two dcqs from the two preamps were averaged . expression relative to the first time point ( 45 hpf ) was calculated as 2 . the expression values of all the genes ( except the housekeeping genes ) were used for clustering analysis . clustering was performed with the  average  method using the euclidean distance . for clustering , expression values were scaled to the same range in order to compare similar trends regardless of the amplitude of expression changes . the following drugs were used : l - cis - diltiazem ( enzo life sciences ) in natural sea water ( nsw ) , luzindole ( tocris ) , stock in dmso , mecamylamine ( sigma ) , stock in 95% etoh or nsw , and melatonin ( sigma ) and acetylcholine ( sigma ) solutions freshly prepared in nsw . drugs were diluted to their final concentration in nsw ; corresponding concentrations of vehicle were used as controls . ciliary beating and arrests were imaged as described ( conzelmann et  al . , 2011 ) , with a dmk 21bf04 camera ( the imaging source ) and a frame rate of 60 or 15 frames / s , a 750-nm - long pass filter was always interposed between the light source and larvae . behavioral data were analyzed in r. all the experiments were repeated at least twice with larvae from different embryonic batches . platynereis cd blastomeres were injected with gcamp6s ( chen et  al . , 2013 ) and h2b - rfp mrnas ( final concentration of 250  g/l each ) . injected larvae at the 4852 hpf stage were mounted in 3% low - melting agarose on glass - bottom culture dishes ( mattek ) and maintained in nsw . imaging was performed using a zeiss lsm780 microscope , with a 32-ch gaasp detector and a two - photon light source ( chamaleon , coherent ) set at 910  nm . two - photon imaging was chosen to avoid any interference of light with behavioral responses . movies ( 248   250 pixels ) were acquired under a 40 oil - immersion objective and with a temporal resolution between 8.26 and 16  hz . responses to drugs were imaged 520  min after application to the bath and without any change of imaging settings . gcamp6s movies were analyzed using fiji and r , as described in the extended experimental procedures . the same region of interest ( roi ) was used to quantify fluorescence before and after drug application . sharp electrode recordings with simultaneous high - speed imaging were performed on 4060 hpf platynereis larvae . holding pipettes were made from borosilicate glass ( science products ) with an outer diameter ( od ) of 1  mm and were fire polished to minimize damage to the larvae . recording electrodes were made from pipettes with an od of 1.5  mm , filled with 3  m kcl , and showed resistances between 1525 m. to facilitate electrode placement , larvae were digested with 46.7  g / ml of proteinase k for 1015  min . signals were acquired at 20 khz and analyzed using clampfit 10.3 ( molecular devices ) . input resistances of prototroch cells were monitored by delivering small hyperpolarizing currents via the recording electrode , and only prototroch cells that displayed resting potentials between 65 to 80  mv and input resistances between 1025 m were used for analysis . simultaneous high - speed ( 20  hz ) imaging of ciliary beating was performed on an andor neo s - cmos camera and analyzed using fiji . larvae were raised in natural seawater ( nsw ) , at 18c under a 16  hr light - 8  hr dark cycle.sources of platynereis genes and phylogenetic analysisgenesnew platynereis genes were cloned either directly , with rt - pcr and gene specific primers , or first with race pcrs using a mixed stages cdna library ( from 24hpf , 39hpf , 48hpf , 56hpf , 72hpf and 5 dpf larvae , invitrogen generacer kit ) . pcr primers were designed on the basis of available transcriptome and est data , and for amplification we used either the hotstart taq polymerase ( qiagen ) or the phusion polymerase ( new england biolabs ) . pcr fragments were cloned in the pcrii - topo vector ( invitrogen ) and verified by sequencing.the following race primers were used to isolate the hiomt cdna sequence : ttggagcataaatgattgggctgatgg , aaggtggcgatattccttccctgaacg , atgcctccaccagggttgattttctca , gctcagcaggtagaggtcggcttca , tgatgaagaagtccccgggcaaa , tgcatgagagatacagggccttcgaca , agtgctgtcgatttaggagctggcaca.the following pcr primers were used to amplify cdnas and produce probes for in  situ hybridization : gene nameforward primerreverse primeraanattggtgtaggtatagcacaagtcacatctttttatgttgaaattgagtttggatttcngaacttggattgcagggtacttggagcaaacattatgaccatggcgttccaactgacngbcagtctgcagatgcagcgaagacaaattgtgagcttcagggtagtcactcatgggchgactccagcgacgtcagtcctatccatgtttgattggtggactgcacattttcggiacaaatctttaagacaggatggagggttcgtaacaacactgtacchiomtcaggggaaggacggaaagcacaattaccaccaaaactttgtgcacatatcacctcamaoaggagcaggcataagtggtctctcagccacagtcagaaagcacacactggcaganeuropsinttcccgggatcctgttacccagttagggagggctctgaccgactcttgttgtgaperopsintggtgatgtgccactgctagtcagcatgcaaactgcataaaccagagggacacctgvmattactcggacgacaaacaaaggagcagagcagccatcttgaaacgcacacataagvrilleggacaccaccaagtgtgccactccactgttttcgcttgtggcggtgttactin order to design qpcr primers and/or produce probes for in  situ hybridization , the sequences for the following genes were obtained from previous publications : ddc ( raible et  al . , 2005 ) , fmrf , phc2 , tph and vtn ( tessmar - raible et  al . , 2007 ) , chat ( denes et  al . , 2007 ) , fvri ( jkely et  al . , 2008 ) , dlamide , flamide , fvamide , yfamide , ryamide and wldamide ( conzelmann et  al . , 2011 ) , r - opsin4 ( randel et  al . , 2013 ) , tr - cry and clock ( zantke et  al . , 2013 ) and npy-4 ( conzelmann et al . , 2013).phylogenetic analysessequence data were retrieved from the jgi genome portal webserver , ncbi and ensembl . multiple sequence alignments of protein sequences were generated with muscle ( http://www.ebi.ac.uk/tools/msa/muscle/ ) and with webprank ( lytynoja and goldman , 2008 ) , inspected and corrected in jalview ( waterhouse et  al . phylogenetic trees with the maximum likelihood method were computed with phyml 3.0 ( guindon et  al . , 2010 ) , with 100x bootstrap . phylogenetic trees were plotted with figtree.imaging of gene expression patternsin situ hybridizationswhole mount in  situ hybridizations and tubulin counterstaining were performed as described previously ( arendt et  al . , 2001 ) , with few modifications . for hiomt in  situs , probe binding specificity was improved by carrying hybridization and post - hybridization washes at 62c and by using a lower ssc concentration for the last post - hybridization washes ( 0.1x ssc instead of 0.2x ssc ) . in situ hybridizations were normally counterstained with an anti - acetylated tubulin antibody ( sigma , t7451 ) , which labels the axonal scaffold and the ciliary bands . for early developmental stages , larvae were acetylated after the proteinase k digestion with the following protocol : 5  min in 1% triethanolamine , 5  min in 1% triethanolamine 3  l / ml acetic anhydride , 5  min in 1% triethanolamine 6 acetylated larvae were counterstained with the anti - tyrosinated tubulin antibody ( sigma t9028).imagingwe used a zeiss axio imager.m1 microscope for light microscopy and a leica tcs spe and a leica tsc sp8 for confocal microscopy . confocal stacks of expression patterns were acquired with reflection microscopy ( jkely and arendt , 2007 ) , using a 40x oil immersion objective . contrast and brightness were adjusted equally throughout the images.image registrationprofiling by image registration ( primr ) was performed as described in tomer et  al . average expression patterns was performed using built - in functions in fiji and imaris.acetylcholinesterase staining and imagingacetylcholinesterase ( ache ) staining was performed according to denes et  al . ( 2007 ) and karnovsky and roots ( 1964 ) , with some modifications . before fixation , larvae were digested for 1  min with 46.7  g / ml of proteinase k in nsw . larvae were then fixed in ice - cold etoh for 2  min or in 4% pfa for 10  min , and stained for 3 - 4  hr at room temperature in 65 mm phosphate buffer ph 6 , 0.5mg / ml ach iodide , 5 mm sodium citrate , 3 mm copper sulfate and 0.5 mm potassium ferricyanide . staining was stopped with 50% etoh , then larvae were dehydrated with an etoh series and transferred in 87% glycerol for imaging . reflection microscopy was used for confocal imaging of the ache signal.qrt-pcr screen with fluidigm dynamic arrayssample preparationeight batches of platynereis larvae were fertilized at the same time at zt8 ( midday ) . they were subsequently pooled , separated again into nine groups and raised in a 18c incubator , under a 16  hr light - 8  hr dark cycle . the nine groups were sampled at different time points between 45hpf and 75hpf , and frozen in liquid nitrogen . the time points were selected as follows ( see also figure  2a ) : 1 ) 45hpf zt5 ; 2 ) 48hpf zt8 ; 3 ) 54hpf zt14 ; 4 ) 57hpf zt17 ; 5 ) 60hpf zt20 ; 6 ) 63.5hpf zt23.5 ; 7 ) 67.5hpf zt3.5 ; 8) 72.5hpf zt8.5 ; 9 ) 75hpf zt11 . for the nighttime samples , animals were collected under dim red light . for the experiments with the inverted cycle conditions , immediately after fertilization sibling larvae were transferred into a different 18c incubator with inverted light cycle conditions ( 12  hr shift ) , and then sampled at the same developmental stages . total rna was extracted from frozen samples using trizol ( peqlab ) and phenol - chloroform , and rna quality was assessed with bioanalyzer ( agilent technologies).reverse transcription , preamplification of cdna , and qrt - pcrfor each sample , 100ng of total rna were reversed transcribed with superscriptiii first - strand synthesis supermix for qrt - pcr ( invitrogen ) , in a 10  l reaction with oligo - d(t ) and random hexameres . 1.25  l of each cdna ( corresponding to 12.5ng of initial rna ) were used as template for a preamplification reaction ( preamp ) with the abi preamp mastermix kit ( pn4391128 ) . for each sample , preamps were run in duplicate.each preamp consisted in the specific target amplification ( sta ) of all the 48 target genes . the gene specific primers were pooled to a final concentration of 50 nm each , and preamplification was carried out for 14 cycles . after preamp , sta primers were removed with exonuclease i ( neb ) , and the cdnas were diluted 10 times . conventional qpcr was used to confirm the linearity of the preamp reactions.to quantify gene expression levels , we used a high - throughput microfluidics 48.48 fluidigm biomark dynamic array chips were used to measure the expression of 48 target genes , following the manufacturer instructions . the inlets were loaded with 2.25  l of the diluted preamp cdnas or with gene specific primers , to an inlet concentration of 5  m ( corresponding to a 500 nm concentration in the final reaction ) . serial dilutions of the templates were included to control the linearity of the amplification . the fluidigm real time pcr analysis software was used to set an optimal global threshold for all the target genes and obtain cq values . these results were confirmed with independent qpcr experiments on a subset of target genes.data analysisthe fluidigm data were analyzed with the bioconductor htqpcr package ( dvinge and bertone , 2009 ) . the genes cdc5 and rps9 , previously shown as reliable normalization genes ( dray et  al . , 2010 ) , were used to obtain the normalized dcq values , and for each time point the two dcqs from the two preamps were averaged . the expression values for all the genes ( except the housekeeping genes ) were used for clustering analysis . clustering was performed with the  average  method using the euclidean distance . for clustering , expression values were scaled in order to compare similar trends regardless of the amplitude of expression changes . we obtained comparable results for other two biological replicates assayed independently.qpcr primersqpcr primers were designed to target , whenever possible , sequences without snps , and to span exon - exon junctions ( as assessed from internal transcriptomic and genomic resources ) . the efficiency of all the primer pairs was determined experimentally using as template a dilution series of cdna ; only primers with efficiency between 90% and 110% were used . the selected primers have an average tm of 60c and an average amplicon size of 91.4bp . all the primers used for qpcr are listed in the following table ( gene name , forward primer , reverse primer):gene nameforward qpcr primerreverse qpcr primercdc5cctattgacatggacgaagatgttccctgtgtgttcgcaagrps9cgccagagagttgctgactactccaatacggaccagacgaanatccaaacatcatggcactgacagtggcagcttcatcacttgddcatgttgttccgaccgatgacgaaagcacatgtcggagttggchaaagccctcctctacttcacctctcggacaatcaccatctchiomtacatgtgggacaccttcatcaggtggcgatattccttccmaoatctgggaggtcgataatgggctgacttgcattgaacctcmtnratcaatcccttcagcattacagcgacagaggcccaaattatcsertcaacgagaccaacgtcaaaccccaagcctcttgctttatctphccctcaagaagctgaatctgatttcgagagttggggtctcvmatgatggttatcagccggattcgaatgggatacaagccaagcbmalcagcatgccataaaaagaaacgcaggatttcaaataaccagcaaaaclockgaggttcccgaatattcaaatcagtcagagagatcggttcgtagl - cryagaagcccttcaacaagtgggcgttcaatcatgagacgagtr - cryatgggacaagaatccagaggcatgacgagcaagatgatggvrilleactggatgaagagacgcaagttagctcacgacgaaggttgperiodtcctgcagcacatgaagaagtggcaccaaggagttctatgc - ops1tctgcaagtggtatggcttcaaacttccaagcctcaggacneuropsatttcgccgagaggtgatagtcgccatggttgcattagperopscgaggtatgctttggacaaggaagcagctcatggttatggr - ops1accctatgccgtcgttggaggcgagcagagggtggatr - ops3tcattcactgggtcatagggtggacggagttcgtaatgagr - ops4aaagccatccagcactcaccaatagccagatgggttgagbsxcccagaaagagtggaattggtgcggtgaatgtgactgttcnotaaagtcaggagggatggttccctaaccctctttgctttgcdlamidegcattgccttacagaagcagtgagaagacactgacgaccagflamidecacacttaaaggaggcaagcgagcctacattggcactttgfmrfattcgggaaacgggaaagcttcccaaacctcatgaaccfvamidectcactaggtgggcaaaatgtcatcttcgtcatcctctcgfvricaaagaccgacttcaccaagcatactgtcacaacggactggyfamidecaatggtgaactgcaagaccggatatctcttctcgctgtcgnpy-4gcaagaggacaatagcagagtggtggatatgttccatggcttcpdfaggatgggatcaagcaagacagacaacctgcatgacgaacryamidectctcattctcgctttagcccctcgcttgtcatcttcatcvtncagtgtttcggacccaacattaacgtgttaatgtagcatcctattgawldamideaaacgccgtcctaactcaaggtggcagtttgtttgctgtgcngattgctggtcacagaaagaggaatcagtgggaaggatggaccngatgccgtccatagcagtaaaccaaagcgcactacaaagctgcngbagtcctgcctaagatcctgaagaagagctgcactttgctgagphc2caacggagaacacaactggacatatccgaagaggtggttgasytaaagaaaaggtgcagcctgatcatagatggcgaacaccagbehavioral experimentsanimalsfor all the behavioral experiments , animals were raised in an 18c incubator , under a 16  hr light - 8  hr dark cycle . all experiments were typically performed between 51 and 55hpf . for the midday conditions ( zt8 ) , fertilizations were set up at zt4 , whereas for midnight conditions ( zt20 ) fertilizations were set up at zt16 . therefore the night experiments were specifically performed in the second half of the night phase.pharmacologythe following drugs were used : l - cis - diltiazem ( enzo life sciences ) , 10 mm stock in nsw ; luzindole ( tocris ) , 100 mm stock in dmso ; mecamylamine ( sigma ) , 10 mm stock in 95% etoh or freshly dissolved in nsw ; melatonin ( sigma ) and ach ( sigma ) solutions were freshly prepared in nsw . the drugs were diluted to the final concentration in nsw ; corresponding concentrations of vehicle were used as controls.imagingciliary beating and ciliary arrests were imaged as described ( conzelmann et  al . , 2011 ) , with a zeiss axiophot microscope equipped with a dmk 21bf04 camera ( the imaging source ) . movies were acquired with a frame rate of 60 or 15 frames / s , respectively . a 750 nm long pass filter for the nighttime measurements , larvae were quickly mounted under a dim red light and imaging was performed in complete darkness . for the ach experiments ( figure  4 ) , each larva was imaged after acute treatment with ach and/or mecamylamine ( within 1  min after drug application ) . for the melatonin and luzindole experiments , larvae were incubated with the drugs for at least 20  min before mounting and imaging.data analysisbehavioral data were analyzed in r ( r core team , 2012 ) . all the experiments were repeated at least twice with larvae from different embryonic batches . for the analysis of closure length distribution , the log10 transformed data set was used in the histograms of figure  3 , and the data are normalized according to the number of larvae imaged in each condition.two-photon calcium imaging with gcamp6smicroinjection of zygotesplatynereis zygotes were injected using a zeiss axiovert 40c inverted microscope , equipped with a joystick micromanipulator ( narishige ) and a microinjector ( femtojet , eppendorf ) . injection needles were pooled from glass capillaries ( borosilicate thin wall with filament , 1.0  mm outer diameter , 0.78  mm inner diameter , harvard apparatus ) using a sutter needle pooler . embryos were accommodated on an agarose stage , customized for platynereis injections.gcamp6s ( chen et  al . , 2013 ) was kindly provided by the genie project , janelia farm research campus , howard hughes medical institute ( addgene plasmid 40753 ) . the gcamp6s coding sequence was subcloned in the pcs2 + vector , and mrna was in  vitro transcribed with the sp6  mmessage mmachine high yield capped rna transcription kit ( ambion ) . gcamp6s mrna was injected in the cd blastomere to a final concentration of 250  g/l . h2b - rfp mrna was co - injected at the same concentration in order to label the cd lineage.two-photon imagingfor calcium imaging , 48 - 52hpf larvae were mounted on glass bottom culture dishes ( mattek ) in 3% low melting agarose , and maintained in natural seawater . imaging was performed using a zeiss lsm780 microscope , with a 32-ch gaasp detector and a two - photon light source ( chamaleon , coherent ) running at 910 nm . movies ( 248x250 pixels ) were acquired under a 40x oil - immersion objective , for at least one minute and with a temporal resolution ranging from 8.26hz to 16hz . drugs were applied directly to the seawater , and responses were imaged 20  min after application ( or 5  min after application for the mecamylamine experiment in figure  s5 ) . for the calcium imaging experiments during the night , larvae were mounted under dim red light and imaged in complete darkness.image analysisgcamp6s movies were analyzed using fiji and r. the cholinergic ciliomotor neuron was identified on the basis of its position within the cd domain and the presence of a contralateral projection . rois ( region of interest ) were manually selected around the cell body and/or the axon of the cholinergic ciliomotor neuron . in each experiment , the same roi was used to compare gcamp6s fluorescence before and after the drug treatments . for the calculation of normalized f / f0 data with a global baseline , f0 was set as the average fluorescence of the 11-frames interval centered on the minimum fluorescence value . for the calculation of normalized f / f0 data with the moving average approach , a sliding window of 0.8 s was used to calculate f0 . for the analysis of peak frequency and peak - to - peak intervals , peaks were extracted from the imaging data with custom - written algorithms.electrophysiologysharp electrode recordings along with simultaneous high - speed imaging were performed on 4060 hpf platynereis larvae . holding pipettes were made from borosilicate glass ( science products gmbh , hofheim ) with an outer diameter ( o.d . ) of 1  mm and were fire polished to minimize damage to the larvae . of 1.5  mm , filled with 3 m kcl , and showed resistances between 15  25 m. to facilitate electrode placement , larvae were digested with 46.7  g / ml of proteinase k for 10 - 15  min.electrophysiological recordings were performed on a multiclamp 700a amplifier . signals were acquired at 20 khz and analyzed using clampfit 10.3 ( molecular devices , union city , ca ) . input resistances of prototroch cells were monitored by delivering small hyperpolarizing currents via the recording electrode and only prototroch cells which displayed resting potentials between 65 to 80  mv and input resistances between 10  25 m were used for analysis . simultaneous high - speed ( 20  hz ) imaging was performed on an andor neo s - cmos camera and analyzed using fiji . larvae were raised in natural seawater ( nsw ) , at 18c under a 16  hr light - 8  hr dark cycle . new platynereis genes were cloned either directly , with rt - pcr and gene specific primers , or first with race pcrs using a mixed stages cdna library ( from 24hpf , 39hpf , 48hpf , 56hpf , 72hpf and 5 dpf larvae , invitrogen generacer kit ) . pcr primers were designed on the basis of available transcriptome and est data , and for amplification we used either the hotstart taq polymerase ( qiagen ) or the phusion polymerase ( new england biolabs ) . pcr fragments were cloned in the pcrii - topo vector ( invitrogen ) and verified by sequencing . the following race primers were used to isolate the hiomt cdna sequence : ttggagcataaatgattgggctgatgg , aaggtggcgatattccttccctgaacg , atgcctccaccagggttgattttctca , gctcagcaggtagaggtcggcttca , tgatgaagaagtccccgggcaaa , tgcatgagagatacagggccttcgaca , agtgctgtcgatttaggagctggcaca . the following pcr primers were used to amplify cdnas and produce probes for in  situ hybridization : gene nameforward primerreverse primeraanattggtgtaggtatagcacaagtcacatctttttatgttgaaattgagtttggatttcngaacttggattgcagggtacttggagcaaacattatgaccatggcgttccaactgacngbcagtctgcagatgcagcgaagacaaattgtgagcttcagggtagtcactcatgggchgactccagcgacgtcagtcctatccatgtttgattggtggactgcacattttcggiacaaatctttaagacaggatggagggttcgtaacaacactgtacchiomtcaggggaaggacggaaagcacaattaccaccaaaactttgtgcacatatcacctcamaoaggagcaggcataagtggtctctcagccacagtcagaaagcacacactggcaganeuropsinttcccgggatcctgttacccagttagggagggctctgaccgactcttgttgtgaperopsintggtgatgtgccactgctagtcagcatgcaaactgcataaaccagagggacacctgvmattactcggacgacaaacaaaggagcagagcagccatcttgaaacgcacacataagvrilleggacaccaccaagtgtgccactccactgttttcgcttgtggcggtgttact in order to design qpcr primers and/or produce probes for in  situ hybridization , the sequences for the following genes were obtained from previous publications : ddc ( raible et  al . , 2005 ) , fmrf , phc2 , tph and vtn ( tessmar - raible et  al . , 2007 ) , chat ( denes et  al . , 2007 ) , fvri ( jkely et  al . , 2008 ) , dlamide , flamide , fvamide , yfamide , ryamide and wldamide ( conzelmann et  al . , 2011 ) , r - opsin4 ( randel et  al . , 2013 ) , tr - cry and clock ( zantke et  al . , 2013 ) and npy-4 ( conzelmann et al . , 2013 ) . multiple sequence alignments of protein sequences were generated with muscle ( http://www.ebi.ac.uk/tools/msa/muscle/ ) and with webprank ( lytynoja and goldman , 2008 ) , inspected and corrected in jalview ( waterhouse et  al . , 2009 ) , and trimmed with gblocks ( castresana , 2000 ) . phylogenetic trees with the maximum likelihood method were computed with phyml 3.0 ( guindon et  al . , 2010 ) , with 100x bootstrap . whole mount in  situ hybridizations and tubulin counterstaining were performed as described previously ( arendt et  al . , 2001 ) , with few modifications . for hiomt in  situs , probe binding specificity was improved by carrying hybridization and post - hybridization washes at 62c and by using a lower ssc concentration for the last post - hybridization washes ( 0.1x ssc instead of 0.2x ssc ) . in situ hybridizations were normally counterstained with an anti - acetylated tubulin antibody ( sigma , t7451 ) , which labels the axonal scaffold and the ciliary bands . for early developmental stages , larvae were acetylated after the proteinase k digestion with the following protocol : 5  min in 1% triethanolamine , 5  min in 1% triethanolamine 3  l / ml acetic anhydride , 5  min in 1% triethanolamine 6 acetylated larvae were counterstained with the anti - tyrosinated tubulin antibody ( sigma t9028 ) . we used a zeiss axio imager.m1 microscope for light microscopy and a leica tcs spe and a leica tsc sp8 for confocal microscopy . confocal stacks of expression patterns were acquired with reflection microscopy ( jkely and arendt , 2007 ) , using a 40x oil immersion objective . profiling by image registration ( primr ) was performed as described in tomer et  al . ( 2007 ) and karnovsky and roots ( 1964 ) , with some modifications . before fixation , larvae were digested for 1  min with 46.7  g / ml of proteinase k in nsw . larvae were then fixed in ice - cold etoh for 2  min or in 4% pfa for 10  min , and stained for 3 - 4  hr at room temperature in 65 mm phosphate buffer ph 6 , 0.5mg / ml ach iodide , 5 mm sodium citrate , 3 mm copper sulfate and 0.5 mm potassium ferricyanide . staining was stopped with 50% etoh , then larvae were dehydrated with an etoh series and transferred in 87% glycerol for imaging . eight batches of platynereis larvae were fertilized at the same time at zt8 ( midday ) . they were subsequently pooled , separated again into nine groups and raised in a 18c incubator , under a 16  hr light - 8  hr dark cycle . the nine groups were sampled at different time points between 45hpf and 75hpf , and frozen in liquid nitrogen . the time points were selected as follows ( see also figure  2a ) : 1 ) 45hpf zt5 ; 2 ) 48hpf zt8 ; 3 ) 54hpf zt14 ; 4 ) 57hpf zt17 ; 5 ) 60hpf zt20 ; 6 ) 63.5hpf zt23.5 ; 7 ) 67.5hpf zt3.5 ; 8) 72.5hpf zt8.5 ; 9 ) 75hpf zt11 . for the nighttime samples , animals were collected under dim red light . for the experiments with the inverted cycle conditions , immediately after fertilization sibling larvae were transferred into a different 18c incubator with inverted light cycle conditions ( 12  hr shift ) , and then sampled at the same developmental stages . total rna was extracted from frozen samples using trizol ( peqlab ) and phenol - chloroform , and rna quality was assessed with bioanalyzer ( agilent technologies ) . for each sample , 100ng of total rna were reversed transcribed with superscriptiii first - strand synthesis supermix for qrt - pcr ( invitrogen ) , in a 10  l reaction with oligo - d(t ) and random hexameres . 1.25  l of each cdna ( corresponding to 12.5ng of initial rna ) were used as template for a preamplification reaction ( preamp ) with the abi preamp mastermix kit ( pn4391128 ) . for each sample each preamp consisted in the specific target amplification ( sta ) of all the 48 target genes . the gene specific primers were pooled to a final concentration of 50 nm each , and preamplification was carried out for 14 cycles . after preamp , sta primers were removed with exonuclease i ( neb ) , and the cdnas were diluted 10 times . conventional qpcr was used to confirm the linearity of the preamp reactions . to quantify gene expression levels , we used a high - throughput microfluidics qpcr system from fluidigm ( spurgeon et  al . , 2008 ) . 48.48 fluidigm biomark dynamic array chips were used to measure the expression of 48 target genes , following the manufacturer instructions . the inlets were loaded with 2.25  l of the diluted preamp cdnas or with gene specific primers , to an inlet concentration of 5  m ( corresponding to a 500 nm concentration in the final reaction ) . the fluidigm real time pcr analysis software was used to set an optimal global threshold for all the target genes and obtain cq values . the fluidigm data were analyzed with the bioconductor htqpcr package ( dvinge and bertone , 2009 ) . the genes cdc5 and rps9 , previously shown as reliable normalization genes ( dray et  al . , 2010 ) , were used to obtain the normalized dcq values , and for each time point the two dcqs from the two preamps were averaged . the expression values for all the genes ( except the housekeeping genes ) were used for clustering analysis . clustering was performed with the  average  method using the euclidean distance . for clustering , expression values were scaled in order to compare similar trends regardless of the amplitude of expression changes . qpcr primers were designed to target , whenever possible , sequences without snps , and to span exon - exon junctions ( as assessed from internal transcriptomic and genomic resources ) . the efficiency of all the primer pairs was determined experimentally using as template a dilution series of cdna ; only primers with efficiency between 90% and 110% were used . the selected primers have an average tm of 60c and an average amplicon size of 91.4bp . all the primers used for qpcr are listed in the following table ( gene name , forward primer , reverse primer):gene nameforward qpcr primerreverse qpcr primercdc5cctattgacatggacgaagatgttccctgtgtgttcgcaagrps9cgccagagagttgctgactactccaatacggaccagacgaanatccaaacatcatggcactgacagtggcagcttcatcacttgddcatgttgttccgaccgatgacgaaagcacatgtcggagttggchaaagccctcctctacttcacctctcggacaatcaccatctchiomtacatgtgggacaccttcatcaggtggcgatattccttccmaoatctgggaggtcgataatgggctgacttgcattgaacctcmtnratcaatcccttcagcattacagcgacagaggcccaaattatcsertcaacgagaccaacgtcaaaccccaagcctcttgctttatctphccctcaagaagctgaatctgatttcgagagttggggtctcvmatgatggttatcagccggattcgaatgggatacaagccaagcbmalcagcatgccataaaaagaaacgcaggatttcaaataaccagcaaaaclockgaggttcccgaatattcaaatcagtcagagagatcggttcgtagl - cryagaagcccttcaacaagtgggcgttcaatcatgagacgagtr - cryatgggacaagaatccagaggcatgacgagcaagatgatggvrilleactggatgaagagacgcaagttagctcacgacgaaggttgperiodtcctgcagcacatgaagaagtggcaccaaggagttctatgc - ops1tctgcaagtggtatggcttcaaacttccaagcctcaggacneuropsatttcgccgagaggtgatagtcgccatggttgcattagperopscgaggtatgctttggacaaggaagcagctcatggttatggr - ops1accctatgccgtcgttggaggcgagcagagggtggatr - ops3tcattcactgggtcatagggtggacggagttcgtaatgagr - ops4aaagccatccagcactcaccaatagccagatgggttgagbsxcccagaaagagtggaattggtgcggtgaatgtgactgttcnotaaagtcaggagggatggttccctaaccctctttgctttgcdlamidegcattgccttacagaagcagtgagaagacactgacgaccagflamidecacacttaaaggaggcaagcgagcctacattggcactttgfmrfattcgggaaacgggaaagcttcccaaacctcatgaaccfvamidectcactaggtgggcaaaatgtcatcttcgtcatcctctcgfvricaaagaccgacttcaccaagcatactgtcacaacggactggyfamidecaatggtgaactgcaagaccggatatctcttctcgctgtcgnpy-4gcaagaggacaatagcagagtggtggatatgttccatggcttcpdfaggatgggatcaagcaagacagacaacctgcatgacgaacryamidectctcattctcgctttagcccctcgcttgtcatcttcatcvtncagtgtttcggacccaacattaacgtgttaatgtagcatcctattgawldamideaaacgccgtcctaactcaaggtggcagtttgtttgctgtgcngattgctggtcacagaaagaggaatcagtgggaaggatggaccngatgccgtccatagcagtaaaccaaagcgcactacaaagctgcngbagtcctgcctaagatcctgaagaagagctgcactttgctgagphc2caacggagaacacaactggacatatccgaagaggtggttgasytaaagaaaaggtgcagcctgatcatagatggcgaacaccag for all the behavioral experiments , animals were raised in an 18c incubator , under a 16  hr light - 8  hr dark cycle . all experiments were typically performed between 51 and 55hpf . for the midday conditions ( zt8 ) , fertilizations were set up at zt4 , whereas for midnight conditions ( zt20 ) fertilizations were set up at zt16 . therefore the night experiments were specifically performed in the second half of the night phase . the following drugs were used : l - cis - diltiazem ( enzo life sciences ) , 10 mm stock in nsw ; luzindole ( tocris ) , 100 mm stock in dmso ; mecamylamine ( sigma ) , 10 mm stock in 95% etoh or freshly dissolved in nsw ; melatonin ( sigma ) and ach ( sigma ) solutions were freshly prepared in nsw . the drugs were diluted to the final concentration in nsw ; corresponding concentrations of vehicle were used as controls . ciliary beating and ciliary arrests were imaged as described ( conzelmann et  al . , 2011 ) , with a zeiss axiophot microscope equipped with a dmk 21bf04 camera ( the imaging source ) . movies were acquired with a frame rate of 60 or 15 frames / s , respectively . a 750 nm long pass filter was always interposed between the light source and larvae . ciliary closure time was measured from 1  min long movies . for the nighttime measurements , larvae were quickly mounted under a dim red light and imaging was performed in complete darkness . for the ach experiments ( figure  4 ) , each larva was imaged after acute treatment with ach and/or mecamylamine ( within 1  min after drug application ) . for the melatonin and luzindole experiments , larvae were incubated with the drugs for at least 20  min before mounting and imaging . all the experiments were repeated at least twice with larvae from different embryonic batches . for the analysis of closure length distribution , the log10 transformed data set was used in the histograms of figure  3 , and the data are normalized according to the number of larvae imaged in each condition . platynereis zygotes were injected using a zeiss axiovert 40c inverted microscope , equipped with a joystick micromanipulator ( narishige ) and a microinjector ( femtojet , eppendorf ) . injection needles were pooled from glass capillaries ( borosilicate thin wall with filament , 1.0  mm outer diameter , 0.78  mm inner diameter , harvard apparatus ) using a sutter needle pooler . gcamp6s ( chen et  al . , 2013 ) was kindly provided by the genie project , janelia farm research campus , howard hughes medical institute ( addgene plasmid 40753 ) . the gcamp6s coding sequence was subcloned in the pcs2 + vector , and mrna was in  vitro transcribed with the sp6  mmessage mmachine high yield capped rna transcription kit ( ambion ) . gcamp6s mrna was injected in the cd blastomere to a final concentration of 250  g/l . h2b - rfp mrna was co - injected at the same concentration in order to label the cd lineage . for calcium imaging , 48 - 52hpf larvae were mounted on glass bottom culture dishes ( mattek ) in 3% low melting agarose , and maintained in natural seawater . imaging was performed using a zeiss lsm780 microscope , with a 32-ch gaasp detector and a two - photon light source ( chamaleon , coherent ) running at 910 nm . movies ( 248x250 pixels ) were acquired under a 40x oil - immersion objective , for at least one minute and with a temporal resolution ranging from 8.26hz to 16hz . drugs were applied directly to the seawater , and responses were imaged 20  min after application ( or 5  min after application for the mecamylamine experiment in figure  s5 ) . for the calcium imaging experiments during the night gcamp6s movies were analyzed using fiji and r. the cholinergic ciliomotor neuron was identified on the basis of its position within the cd domain and the presence of a contralateral projection . rois ( region of interest ) were manually selected around the cell body and/or the axon of the cholinergic ciliomotor neuron . in each experiment , the same roi was used to compare gcamp6s fluorescence before and after the drug treatments . for the calculation of normalized f / f0 data with a global baseline , f0 was set as the average fluorescence of the 11-frames interval centered on the minimum fluorescence value . for the calculation of normalized f / f0 data with the moving average approach , a sliding window of 0.8 s was used to calculate f0 . for the analysis of peak frequency and peak - to - peak intervals sharp electrode recordings along with simultaneous high - speed imaging were performed on 4060 hpf platynereis larvae . holding pipettes were made from borosilicate glass ( science products gmbh , hofheim ) with an outer diameter ( o.d . ) of 1  mm and were fire polished to minimize damage to the larvae . of 1.5  mm , filled with 3 m kcl , and showed resistances between 15  25 m. to facilitate electrode placement , larvae were digested with 46.7  g / ml of proteinase k for 10 - 15  min . signals were acquired at 20 khz and analyzed using clampfit 10.3 ( molecular devices , union city , ca ) . input resistances of prototroch cells were monitored by delivering small hyperpolarizing currents via the recording electrode and only prototroch cells which displayed resting potentials between 65 to 80  mv and input resistances between 10  25 m were used for analysis . simultaneous high - speed ( 20  hz ) imaging was performed on an andor neo s - cmos camera and analyzed using fiji .