Context-dependent control of behavior in Drosophila

The representation of contextual information peripheral to a salient stimulus is central to an animal ’ s ability to correctly interpret and flexibly respond to that stimulus. While the com-putations and circuits underlying the context-dependent modulation of stimulus-response pairings have typically been studied in vertebrates, the genetic tractability, numeric simpli-fication, and well-characterized connectivity patterns of the Drosophila melanogaster brain have facilitated circuit-level in-sights into contextual processing. Recent studies in flies reveal the neuronal mechanisms that create flexible context-dependent behavioral responses to sensory events in condi-tions of predation threat, feeding regulation, and social interaction. finds that movement and motivation are dynamically enco- ded in a context-dependent manner by dopimanergic neurons (DANs) in the fly mushroom body, on-going and future odor pursuit behavior. straight-forward by P9 and BPN, respectively. P9 input from courtship neurons and visual projections This study elucidates a neural circuit in which the mating status of female flies is integrated with auditory responses to male courtship song in order to guide female mating choice in a context-dependent manner. Virgin female flies are sexually receptive to courting males, while mated females are less receptive. characterize a neuralcircuit thatcoordinates mating withegg laying, that female flies only lay eggs after mating – the neuron that controls oviposition is disinhibited after copulation.


Introduction
We take in the world through our senses and often have strong reactions to important sensory cues. However, any given sensory cue considered in isolation is likely to be ambiguous with respect to how it should be interpreted, and an animal would be at risk were it to always respond identically to the same cue. Instead, the encoding of the context around a stimulus is what allows animals to appropriately and flexibly adapt their behavior to suitably respond to events. Take, for example, a driver's response to a green stoplight turning yellow. A driver far from the intersection and in no hurry will brake. A driver close to the intersection or running late will accelerate to get through. In this case, the same sensory cue (green to yellow light change) leads to a different behavioral response (braking or accelerating) depending on contextual information, which in this case includes both additional information about the external environment (distance from the intersection) and the driver's emotional state (relaxed or anxious). This type of context-dependent response, contingent on both the individual's sensorimotor environment and emotional state, is critical for properly interpreting sensory stimuli and choosing appropriate reactions. Despite its importance, the neuronal circuits in which context is represented in the brain, and through which the encoding of context allows an animal to flexibly link stimuli and behavioral responses, remain poorly understood.
One challenge in studying the neural mechanisms underlying contextual processing is that it can be difficult to demarcate what constitutes a "context." Typically, context-dependent processing has been studied in vertebrates (frequently humans), and the word "context" itself has strong cognitive connotations [1]. Additionally, context has largely been defined within well-controlled experiments, in which there is a clear primary sensory cue (e.g., electric shock) separated from other information available to the animal (e.g., location or social milieu). This suggests that a given context might be a distinct percept, represented by activity patterns in specific sets of neurons in the brain. However, in natural settings the stimulus and context are generally less obviously separable. The bugle of a bull elk is both a highly attractive stimulus to a cow elk and an important component of the cues that signify the "rut season" context to her [2]. On a more cognitive level, to a human the elk bugle may signify the "autumn" context.
For the purposes of this review, we broadly and functionally define context as any combination of internal and external extra-stimulus information that modifies a stimulus-behavior pairing. In natural circumstances, contexts are rich, commonly involving multiple aspects of these internal and external components. However, in laboratory experiments aiming to find neural correlates, "context" is often simplified to a single factor, such as location in a maze or locomotor status. Thus, following our broad definition, the internal state of the animaldor any subcomponent thereof, including locomotor or behavioral state, emotional state, hunger state, etc., as well as the animal's history as stored in memorydmay serve as a context, and hereafter internal state alone is sometimes used as a stand-in for context.
What then might we expect to see when we look for context and its integration with sensorimotor control at the neural circuit level? Mammalian studies find explicit neural representations of context in the hippocampus and medial prefrontal cortex circuits, areas of the brain associated with memory and learning, and cognition and sociability, respectively [1,3]. This contextual representation is separate from perceptual representations of individual contextual elements. In other words, the context of "school" is represented separately in the brain from the perception of desks, books, and a white board. On the other hand, generalized neuromodulatory release, such as the release of adrenaline when we find ourselves in a stressful emergency situation, is also often interpreted as a proxy for context [4]. Even for simplified contexts, however, it has been challenging to study the neural mechanisms underpinning how contextual information is used to guide behavioral responses, as in mammals this process can involve billions of neurons ranging from the sensory periphery to higher cortical areas [5,6].
Drosophila melanogaster, commonly known as the fruit fly, has recently emerged as a suitable model to study the cellular and circuit mechanisms of cognitive processes because of its tractable brain size (w100,000 neurons) [7], genetically accessible identifiable neurons [8,9], extensively characterized connectome [7,10], and advanced genetic [11], physiological [12e14], and behavior quantification [15e17] tools. In this review, we examine work from the last five years on contextually modified behaviors in Drosophila and their circuit representations. We primarily focus on circuit motifs that mediate the encoding of context and provide flexibility to behavioral output. However, in flies, neuromodulatory signals also play a central role in the representation of internal state [18,19] and context-based reinforcement cues [20]. Drosophila studies have progressed rapidly to reveal how commonly flies build, interpret, and use context to modify their innate behaviors. We review these here for three contexts in which a picture is emerging of the neural motifs underpinning contextual processing: predation threat, feeding regulation, and social interaction.

Predation threat
The correct identification of, and appropriate response to, predation threats are critical nervous system functions. Whether a particular sensory stimulus constitutes a threat, and, if so, what the best behavioral response to the threat should be, depends strongly on context. The most salient cue generated by a predatory attack is a looming stimulus, the rapid and non-linear expansion of a dark shadow on the retina. However, even though all attacks generate a looming cue as the predator approaches, not all looming cues signify a predator. Similar visual expansion occurs when a non-threatening animal approaches, such as a conspecific that might be a desirable mate, or when the fly itself approaches an object by its own self-motion ( Figure 1a) [21]. How can the fly disambiguate these circumstances to enact an appropriate behavior: flee, court, or land on the object producing the looming cues?
Recent studies of the mechanisms underlying fly escape behavior choices have led to a comprehensive model of how flies integrate a set of contextual cues to respond flexibly and appropriately to looming. The simplest strategy used by the fly nervous system is to detect two different features of the looming stimulus, rather than having a single looming detector. This allows one looming feature to effectively provide "context" in which to interpret the other. In the fly, the retinal size and expansion velocity of an approaching predator, or predator-mimicking visual looming stimulus, are separately encoded in the feature-detecting visual projection neurons LPLC2 [22,23] and LC4 [24], respectively. These two neuronal types are the primary visual input to the Giant Fiber (GF) command-like descending neuron, whose response to a looming stimulus is the weighted linear sum of the LPLC2 and LC4 input [23]. If the GF membrane potential reaches threshold and the GF fires a single action potential, the fly performs a "short-mode" takeoff that rapidly gets it into the air but leads to aerial tumbling. If the looming cue is not expanding quickly enough, because it is a slow attack or not a predator, then the GF does not fire an action potential and other descending pathways mediate a slower but steadier "long-mode" takeoff, or alternate behavior such as "freezing" [25] or walking backwards [26]. The fly's walking speed [25] and social interactions with conspecifics [27] are also contextual information that flies process simultaneously with looming to adapt their motor responses appropriately.
In addition to this contextual integration in the feedforward processing of visual looming stimuli, a further motif in the fly nervous system that provides contextual information is the feedback of motor signals onto descending motor pathways. In general, motor feedback onto visual neurons projecting from the optic lobe to the central brain is well documented and thought to quantitatively cancel out visual flow from self-motion [13,28] or enhance directional selectivity of optic flow sensing neurons [29,30]. Descending neurons (DNs) connecting the brain to the insect ventral nerve cord (VNC) are also known to be multimodal with a strong motor component [10,31,32]. In Drosophila, it has recently been shown that both flight motor signals and release of the neuromodulator octopamine, which correlates with flight [33], impinge on two bilateral pairs of DNs whose activity drives a landing response [21]. These flight signals gate the transmission of visual signals in these neurons [21]. The result is that only the behavior (landing or takeoff) appropriate to the current context (flying or perching) is coupled to visual drive from looming cues (Figure 1b). This example raises the hypothesis that DNs may occupy a key regulatory position in sensorimotor control due to their relatively small numbers (w1000 DNs [10] connect the w100,000 brain [7] and w30,000 VNC [34] neurons) and central position within the sensorimotor watershed. In particular, they may be a locus where information about different locomotor contexts is integrated to effectively turn motor pathways for specific behaviors "on" or "off " depending on their suitability. Future research should focus on testing this hypothesis broadly across the DN population and on examining how interaction between descending pathways may further contribute to contextspecific gating of behaviors.

Feeding regulation
Another critical function of the nervous system is to ensure that animals obtain an appropriate amount of food to survive and reproduce. Choosing whether, when, and what to eat is a delicate balance of risks and rewards, such as the availability and nutritional value of food and the animal's hunger state. Many sensory stimuli that signal the presence of food may also indicate the presence of predators or parasites. For example, carbon dioxide (CO 2 ) is a major biproduct of yeast fermentation that signals the location of this preferred food source to flies but also attracts wasps that parasitize Drosophila. Flies have long been documented to avoid CO 2 at both high and low concentrations [35], raising the paradox of how they overcome this aversion to consume yeast. Recently, van Breugel et al. have resolved this puzzle with the discovery that CO 2 becomes attractive to flies when they are flying or walking in a foraging context (Figure 2a) [36]. The IR25a ionotropic receptor is required for CO 2 attraction behavior, while aversion is mediated by separate channels in chemosensory neurons expressing the Gr21a, Gr63a and IR64a receptors [37,38]. Thus, the valence of the CO 2 cue is processed in context-gated labeled lines (Figure 2b). The exact mechanism by which the CO 2 "attraction" or "aversion" pathway gains dominance is unknown, but may be dependent on the time-course of the behavior [39].
Similarly the valence of visual objects can be switched by contextual olfactory cues. For example, flying Drosophila usually avoid small visual objects [40] but may approach them in the presence of an attractive food odor. It is believed that this attraction is mediated through an odorinduced release of octopamine by Tdc2 neurons. This modulates activity in the visual motion pathways, including directionally-selective T4/T5 and visual projection neurons in the lobula plate of the fly optic lobe, to increase the saliency of small objects [41]. Contextual information about the valence of environmental odor and the fly's hunger state is also fed into the fly's reward system, the dopaminergic neurons in the fly's mushroom body. These neurons are actively tuned by odor and satiety state information on a moment-to-moment basis, possibly to reward the fly for foraging in the presence of food odor cues, but only when hungry [20].
Another way flies regulate their feeding behavior is to weigh the nutritional value of food against their hunger state and competing survival drives. This requires them to evaluate food-generated sensory cues in the context of their internal state. Neural activity in ingestion neurons (IN1) increases when hungry flies ingest Context-gated pathways determine valence of CO 2 odor and behavioral response. (a) CO 2 can signal the presence of a food source, but can also signal danger [36]. When engaging in a foraging-like behavior (i.e., flight or fast walking), flies are attracted to carbon dioxide (CO 2 ) (top), however if flies are in a low activity state, CO 2 is aversive (bottom). (b) The IR25a ionotropic receptor, expressed by neurons on the third antennal segment, senses CO 2 . IR25aexpressing neurons mediate attraction to CO 2 [36]. It is not known which glomerulus these neurons project to. Aversion to CO 2 is mediated by a separate channel via ab1C olfactory neurons that co-express the chemosensory receptors Gr21a and Gr63a, and project to the V glomerulus [37]. At high CO 2 concentrations, chemosensory neurons expressing IR64a receptors that project to the DC4 glomerulus also mediate CO 2 avoidance behavior [38]. Adapted from Ref. [36].
sucrose [42]. However, IN1 neurons respond less strongly to sugar ingestion in sated flies, suggesting that a representation of hunger state is already integrated in the IN1 neurons that link taste and feeding circuits. The integration of hunger context with feeding regulation can go awry when flies are on a high-sugar diet. In this case, they over eat and become obese due to developed taste deficits [43]. Hunger is also a critical contextual signal integrated with food quality during a male fly's choice of whether to mate or feed [44]. Taken together, these studies indicate that the fly incorporates contextual information about whether it is foraging or hungry to interpret whether odor and food cues are attractive or aversive. Integration of this contextual information can occur at the sensory periphery, as with the separate olfactory channels for CO 2 sensing [36] or in higher order neuropil of the central brain [45].

Social interaction
The neural circuits most often studied and associated with the context-dependent control of behavior in Drosophila are those that govern male courtship, mating, and aggression. During social interactions male flies must use context to accurately identify potential mates (receptive female conspecifics) and rebuff competition (conspecific males). Further, once an appropriate female has been identified, males must effectively respond to the contextual cues provided by the female in order to successfully copulate. Finally, males must weigh their own internal mating drive against the availability of mating partners, so that they only court receptive females when their own reproductive capacity is high.
Central to the contextual processing of social cues is the encoding of the arousal state of the fly. In Drosophila males, approximately 20 neurons (the P1 neurons) that encode the courtship arousal state have been identified [46,47]. One way to consider this set of P1 neurons in males is as a "switch". To determine when to turn the switch d and hence the courtship state d "on," the P1 neurons integrate visual [48,49] and chemosensory [50e52] input about the presence of a suitable mate. When these stimuli reach a threshold, the P1 neurons are activated and permissively gate sensorimotor pathways from the visual system to descending neurons that guide courtship behaviors [53], including courtship song [54,55] and female pursuit [48]. In support of this switch-like role, artificial activation of P1 neurons is sufficient to induce males to court highly abstracted mate replicas, such as moving pieces of rubber band that are of similar size to a female fly [55]. Male aggression is also mediated by activity in P1 neurons [56,57]. The persistence of both the courtship and aggression states is dependent on the activity of pCd neurons, which are downstream of P1 neurons [58]. Thus, P1 neurons mechanistically act as an integrator "switch" that persistently promotes a suite of related social behaviors in response to social context.
Recent studies have focused on how context modulates the activity of the P1 switch, so that the presence of an appropriate mate leads males to perform the most advantageous behaviors. The activity of P1 neurons is observed to be inhibited after mating by a decrease in dopamine-mediated mating drive [59,60] or by the identification an unsuitable mate [61,62]. Thus, P1 activity dynamically encodes a male's arousal state, facilitating the contextual processing of complex social interactions.
Once a male fly has found a potential mate and entered the courtship state, it must appropriately and flexibly interact with a female fly in order to successfully copulate. Recent work has revealed some of the local contextual cues that flies use in this interaction. For example, the type of courtship song that a male fly uses to attract a female is dependent on the distance between the flies and the male's velocity, with males more often opting for the louder "pulse" song mode when farther from the female and moving rapidly. The choice of song mode is actively modulated by P1 drive to the pIP10 descending neurons that produce song [63]. Additionally, the level of sexual arousal in male flies gates their pursuit behavior. P1-mediated arousal dynamically modulates pursuit by controlling the signal gain of LC10a visual neurons [64], increasing the saliency of potential mates. Additionally, arousal state is integrated with visual information from LC9 visual neurons in DNp09 descending neurons to permit a locomotor walking program, ipsilateral turning, used in pursuit [65].
Reciprocal context-dependent circuits for control of social behaviors are seen in Drosophila females. In a switch-like circuit similar to that in male flies, the mating status, receptivity and arousal level of female flies is persistently encoded in the PC1 neurons [66,67]. The mating state of female flies determines their receptivity to male flies and thus their behavioral response to male courtship cues. For example, descending neurons that control vaginal plate opening, and thereby copulation, integrate mating status encoded in PC1 neurons with excitatory input from neurons specifically tuned to the male courtship song (Figure 3) [68]. Further, mating status-encoding activity in PC1 neurons gates egg laying behavior, such that females only lay eggs after mating [69]. A neural circuit that mediates female rejection of males does not involve PC1, but rather is a parallel circuit in which female mating status (encoded by sensory neurons in the uterus) and input from auditory neurons that encode male song is integrated in descending neurons that control ovipositor extrusion [70]. Thus, mated females extrude their ovipositor when courted by males, deterring mating. Additionally, neural pathways originating in the abdomen suppress female receptivity after copulation [71] and increase the female defensive response [72]. Finally, also in common with the mechanisms seen in males, a subset of PC1 neurons drives female aggressive behaviors [73,74].
In summary, the male P1 and female PC1 switches provide a mechanism by which elements of complex and dynamic contexts, including both interoceptive information (e.g. mated state, motivational drive, and locomotor activity) and external cues (e.g. suitability, receptiveness and behavior of potential mates), are integrated in order to gate sensorimotor courtship and mating behaviors.

Conclusions and future directions
Currently, exceptional opportunities exist to investigate cognitive processing in Drosophila. With the full connectome of male and female fly brains and ventral nerve cords becoming available in the near future and increasing knowledge of synaptic valence and connectivity [75], there is optimism that the neural circuits underpinning cognitive processes will be revealed. In the case of context-dependent control of behavior, the neuronal mechanisms that mediate contextual processing from stimulus transduction to motor output may be fully understood. As knowledge of these mechanisms grows, the boundary between "stimulus" and "context" will become increasingly blurred, as context will cease to be a gestalt composed of obscure interoceptive and exteroceptive sensory cues (e.g., "foraging" or "social isolation"), but instead will consist of a number of discrete, well defined sensory stimuli encoded in known neural pathways whose mechanistic purpose within stimulus-response circuits is delineated.
Further, in ethological conditions, flies actively engage with a changing environment. Thus in the real world a "context" is not a static external stimulus, as often used in the lab, but a set of continuously changing variables. As emerging behavioral, genetic, and physiological VPO is mediated by activity in female-specific descending neurons (vpoDNs), which receive excitatory input (black arrows) from auditory neurons tuned to D. melanogaster song (vpoENs) and inhibitory input (black lines with bars) from neurons broadly tuned to courtship songs of many Drosophila species (vpoINs), providing a mechanism for D. melanogaster vpoDNs to be inhibited by the courtship song of other species [68]. The mated state of female flies is signaled by an ascending pathway that is inhibited by the presence of male seminal fluid peptide (sex peptide) in the female reproductive organs. Sex peptide is sensed by and attenuates the activity of sex peptide sensory neurons (SPSNs) in the uterus that ascend through the sex peptide abdominal ganglion (SAG), and provide input to the PC1 neuron that encodes the arousal state of female flies [77]. Adapted from Ref. [68].
techniques make laboratory-based paradigms more sophisticated, it is becoming possible to quantify neural activity during richer contextual situations. Ultimately, the distinction between stimulus and context might be unwarranted when we are able to model "closed-loop" processing of continuously changing stimuli. Drosophila hold a promise for resolving abstract concepts such as "context" at a cellular level, and future work should continue to make use of the connectome to advance our understanding of how known contextual processing motifs interact with sensorimotor pathways to enable complex and dynamic behavioral choices in ethological conditions.

Conflict of interest statement
Nothing declared.
. Zolin A, Cohn R, Pang R, Siliciano AF, Fairhall AL, Ruta V: Context-dependent representations of movement in Drosophila dopaminergic reinforcement pathways. Nat Neurosci 2021:1-12. This study finds that movement and motivation are dynamically encoded in a context-dependent manner by dopimanergic neurons (DANs) in the fly mushroom body, influencing on-going and future odor pursuit behavior.

21
. Ache JM, Namiki S, Lee A, Branson K, Card GM: State-dependent decoupling of sensory and motor circuits underlies behavioral flexibility in Drosophila. Nat Neurosci 2019, 22: 1132-1139. Using whole-cell recordings in behaving flies, the authors demonstrate that activity in two descending neurons (DNs) that control landing behavior is gated by the locomotor state of the fly, such that the DNs are most active when the fly is flying. Further, the authors show that octopamine exposure encodes the flying context in one DN, while this context is likely encoded in sensorimotor feedback signals in the other DN.