Tracking Drosophila Larval Behavior in Response to Optogenetic Stimulation of Olfactory Neurons


Your institution must subscribe to JoVE's Neuroscience section to access this content.

Fill out the form below to receive a free trial or learn more about access:


Enter your email below to get your free 10 minute trial to JoVE!

By clicking "Submit", you agree to our policies.



This protocol analyzes navigational behavior of Drosophila larva in response to simultaneous optogenetic stimulation of its olfactory neurons. Light of 630 nm wavelength is used to activate individual olfactory neurons expressing a red-shifted channel rhodopsin. Larval movement is simultaneously tracked, digitally recorded, and analyzed using custom-written software.

Cite this Article

Copy Citation | Download Citations

Clark, D. A., Kohler, D., Mathis, A., Slankster, E., Kafle, S., Odell, S. R., et al. Tracking Drosophila Larval Behavior in Response to Optogenetic Stimulation of Olfactory Neurons. J. Vis. Exp. (133), e57353, doi:10.3791/57353 (2018).


The ability of insects to navigate toward odor sources is based on the activities of their first-order olfactory receptor neurons (ORNs). While a considerable amount of information has been generated regarding ORN responses to odorants, the role of specific ORNs in driving behavioral responses remains poorly understood. Complications in behavior analyses arise due to different volatilities of odorants that activate individual ORNs, multiple ORNs activated by single odorants, and the difficulty in replicating naturally observed temporal variations in olfactory stimuli using conventional odor-delivery methods in the laboratory. Here, we describe a protocol that analyzes Drosophila larval behavior in response to simultaneous optogenetic stimulation of its ORNs. The optogenetic technology used here allows for specificity of ORN activation and precise control of temporal patterns of ORN activation. Corresponding larval movement is tracked, digitally recorded, and analyzed using custom written software. By replacing odor stimuli with light stimuli, this method allows for a more precise control of individual ORN activation in order to study its impact on larval behavior. Our method could be further extended to study the impact of second-order projection neurons (PNs) as well as local neurons (LNs) on larval behavior. This method will thus enable a comprehensive dissection of olfactory circuit function and complement studies on how olfactory neuron activities translate in to behavior responses.


Olfactory information in a Drosophila larva's environment is sensed by only 21 functionally distinct ORNs, the activities of which ultimately determine larval behavior1,2,3,4. Yet, relatively little is known about the logic by which sensory information is encoded in the activities of these 21 ORNs. There is thus a need to experimentally measure the functional contributions of each larval ORN to behavior.

Although the sensory response profile of the entire repertoire of Drosophila larval ORNs has been studied in detail1,4,5, the contributions of individual ORNs to the olfactory circuit and thereby to navigational behavior remain largely unknown. Difficulties in larval behavior studies, so far, arise due to the inability to spatially and temporally activate single ORNs. A panel of odorants that specifically activate 19 of the 21 Drosophila larval ORNs was recently described1. Each odorant in the panel, at low concentrations, elicits a physiological response only from its cognate ORN. However, at higher concentrations that are normally used for conventional behavior assays, each odorant elicits physiological responses from multiple ORNs1,5,6. Further, odorants in this panel have varied volatilities that complicate interpretation of behavior studies that depend on formation of stable odor gradients7,8. Finally, naturally occurring odor stimuli have a temporal component that is difficult to replicate under laboratory conditions. It is therefore important to develop a method that can measure larval behavior while simultaneously activating individual ORNs in a spatial and temporal manner.

Here, we demonstrate a method that has advantages over previously described larval tracking assays1,8. The tracking assay described in Gershow et al. uses electronically controlled valves to maintain a stable gradient of odor in the behavior arena8. However, due to the level of complex engineering involved to build the odor stimulus setup, this method is difficult to replicate in other laboratories. Further, the issues related to using odorants to specifically activate single ORNs remain unresolved. The tracking assay described in Mathew et al. uses a simpler odor delivery system, but the resulting odor gradient is dependent on the volatility of test odorant and is unstable for long durations of the assay1. Thus, by replacing odor stimuli with light stimuli, our method has the advantages of specificity and precise temporal control of ORN activation and is not dependent on formation of odor gradients of different strengths.

Our method is easy to set up and is appropriate for researchers interested in measuring aspects of Drosophila larval navigation. This technique could be adapted to other model systems provided that the researcher is able to drive the expression of CsChrimson in their favorite system's neuron(s) of choice. CsChrimson is a red-shifted version of channel rhodopsin. It is activated at wavelengths that are invisible to the larva's phototaxis system. We are therefore able to manipulate the activity of neurons with specificity, reliability, and reproducibility9. By modifying the custom written software to account for size changes of the subjects, this method could easily be adapted for crawling larvae of other insect species.

Subscription Required. Please recommend JoVE to your librarian.


1. Building a Behavior Arena and Preparing Hardware to Enable Optogenetic Stimulation in the Behavior Arena

  1. To build a light-deprived behavior arena, construct a box with a dimension of 89 x 61 x 66 cm3 (35" L x 24" W x 26" H) made of black colored plexiglass acrylic sheets (3 mm thick) (see Table of Materials). Materials to build such a box should be available at local hardware stores. Place this box on a table-top in the behavior room (Figure 1A).
  2. Mount a monochrome USB 3.0 CCD camera fitted with an IR long-pass 830 nm filter and an 8 mm F1.4 C-mount lens (see Table of Materials) to the center of the ceiling of the black box. Place two infra-red LED strips (see Table of Materials) on the table-top in order to illuminate the larvae in the dark arena (Figure 1A).
  3. To build the LED platform, obtain a 22 cm × 22 cm square Aluminum plate (preferably spray painted with a matte black finish to eliminate any reflections). In the center of the plate, using a metal cutter, cut a hole that is large enough to fit around the CCD camera.
  4. Cover the metal plate with red LED strip lights (see Table of Materials). Solder LED light strip wires in series and feed the strip wires into an optocoupler relay controlled by a Raspberry Pi 2B microprocessor (see Table of Materials) (Figure 1B and 2).
  5. Install and configure Ubuntu Mate/Raspian Jesse/Linux based operating system on the Raspberry Pi processor before connecting the optocoupler relay to the LED strips. Attach a power supply to power the LED strips and the optocoupler (Figure 2) (see Table of Materials). Mount the LED platform around the CCD camera (Figure 1B).
    NOTE: Ubuntu Mate v16.04 operating system is freely available. A set of simple Python based commands can be easily adapted to program patterns of LED light stimuli (see file of syntax).
  6. Ensure homogenous irradiance at various points in the behavior arena. Measure the absolute irradiance at the surface of the arena with the help of a Spectrometer and determine it to be ~1.3 W/m2 throughout the surface of the arena.
    NOTE: At this intensity, no significant changes were observed in temperature over the course of the experiments. Another study10 used a higher irradiance of ~1.9 W/m2 and observed no changes in temperature over the course of the experiments.

2. Preparation of Drosophila Larvae for Behavior Analyses

  1. Maintain the flies on standard fly food (see Table of Materials) at 25 °C, 50-60% RH, and a 12 h/12 h light/dark cycle.
  2. In order to express CsChrimson in a single pair of ORNs, cross virgin females from a UAS-IVS-CsChrimson line to males from an OrX-Gal4 line ('X' corresponds to one of 21 larval odor receptor (Or) genes that are uniquely expressed in each of 21 pairs of ORNs)9,11.
    1. Alternately, in order to express CsChrimson in all 21 larval ORNs, cross virgin females from a UAS-IVS-CsChrimson line to males from an Orco-Gal4 line ('Orco' is the co-receptor that is expressed in all 21 ORNs).
    2. Use UAS-IVS-CsChrimson line by itself as a control in these experiments.
      NOTE: The fly stocks listed here are all available at the Bloomington Drosophila Stock Center (see Table of Materials).
  3. Once male and female flies in a cross are allowed to mate and lay eggs for 48 h, transfer adults to a fresh vial.
    1. To the surface of the food vial containing eggs, add 400 µL of a mixture containing 400 µM all-trans retinal (ATR) dissolved in Dimethyl sulfoxide (DMSO) and 89 mM sucrose dissolved in distilled water.
      NOTE: The small amount of sucrose promotes larval feeding of the ATR solution. ATR is a cofactor required for upregulating of CsChrimson expression9,10. ATR is light sensitive.
    2. Once ATR is added to the food vials containing eggs, incubate the vials in the dark for an additional 72 h.
      NOTE: While this study and the above two studies have not observed effects on larval behavior due to ATR feeding, it is recommended controlling for the effects of ATR feeding by subjecting test lines to the same amount of the above mixture that does not contain ATR.
  4. Extract third-instar larvae (~120 h after egg laying) from the surface of fly food by floating them using a high density (15%) sucrose solution. Using a P1000 micropipette separate the larvae floating on the surface of the sucrose solution into a 1000 mL glass beaker.
  5. Wash larvae 3–4 times by exchanging 800 mL fresh distilled water in the glass beaker each time. Allow larvae to rest for 10 min before subjecting them to the behavior assay.

3. Behavior Assay

  1. Maintain consistent temperature (between 22–25 °C) and humidity (between 50 and 60% RH) in the behavior room.
  2. Prepare larval crawling medium by pouring 150 mL of melted agarose (1.5%) into a 22 cm x 22 cm square Petri dish. One Petri dish is poured for each trial of the assay, 8–10 trials per experiment. Allow agarose to solidify and cool for 1–2 h in the Petri dishes before using them in the behavior assay.
    1. Transfer no more than 20 of the prepped third-instar larvae to the center of Petri dish (Figure 1C). Cover the Petri dish with its lid. Place the Petri dish in the behavior arena under the CCD camera.
      NOTE: Depending on the experiment, behavior assays are typically carried out for 3–5 min. If an odorant is used in the assay to provide guidance cues, it has been observed that the resulting odor gradient remains stable for approximately 5 min1. Longer assay times are not recommended. Deleterious effects on larvae due to dehydration or from prolonged 630 nm red-light exposure have not been observed within these time points.
  3. Turn ON the 850 nm infra-red LED light source to visualize larvae in the video. Start the CCD camera to record larval movement.
  4. Using the software associated with the Raspberry Pi processor, program the procedure to administer appropriate patterns of red light stimulation.
    NOTE: A set of simple Python based commands can be easily adapted to program patterns of LED light stimuli (see file of syntax).

4. Data Processing and Analysis

  1. Import the recorded video of each trial into any available programming software like Matlab.
  2. Obtain XY coordinates of every larva in a movie as a function of time. Based on limits of the tracking software, 15–20 third-instar larvae can be tracked in a single movie1,8.
    NOTE: A set of simple Matlab codes ('Tracklarva') that can be easily adapted to suit appropriate conditions (see file of syntax) is provided. This program combines all trials in an experiment and outputs the XY coordinates of every larva for the entire duration of the assay (see code syntax below). Alternately, one could use several open-source based programs that are freely available for researchers. E.g. JAABA (
  3. Use the generated XY coordinates to plot larval trajectories and to further analyze larval locomotion.
    1. For behavior analyses, use navigational statistics such as speed, path curvature, heading angle, to segment individual larval trajectories into alternating sequences of runs and turns.
    2. Runs are defined as continuous periods of forward movement. Turns separate successive runs. Turns are flagged when changes to trajectory orientation angles were >45° (see file of syntax).
  4. Calculate average values for run speed, run length, run direction, and other parameters as required.
    NOTE: A set of simple syntax to extract 'runs' and 'stops' from larval trajectories is provided (see file of syntax). Simple Matlab or Excel based functions can be applied to the extracted data to calculate values for 'run speed', 'run length' etc.
  5. Represent data for each behavioral metric as mean ± SEM.

Subscription Required. Please recommend JoVE to your librarian.

Representative Results

To demonstrate the specificity of ORN activation, our method was successfully applied to determine the impact of two different ORN (ORN::7a & ORN::42a) (ORNs expressing either Or7a or Or42a) activation on larval behavior (Figure 3). Consistent with recent studies that individual larval ORNs are functionally distinct1,10,13, our representative data demonstrates that when ORN::7a expressing CsChrimson was stimulated by light, there was a significant decrease in run length compared to control animals. Conversely, when ORN::42a expressing CsChrimson was stimulated by light, there was a significant increase in run length compared to control animals (Figure 3). The collective data analyzed from ~100-120 larval tracks were obtained from (n = 8) trials performed for each genotype. The error bars represent SEM. While we describe only a single behavior parameter (run length) here, we note that each larval track can be further analyzed to calculate parameters for speed, path curvature, and body bends1,8,13,14,15. More parameters related to directionality such as heading angle, run length and run speed toward and away from odors can be obtained if an odor source is provided on one side of the arena1,8,13.

To demonstrate our method's ability to alter the temporal patterns of ORN activation, we varied our stimulus to alternate between lights OFF and ON. We subjected larvae expressing UAS-CsChrimson in ORN::42a to three different temporal patterns of light stimuli during the lights ON period (0.04 Hz, 1 Hz, and Constant). We then measured changes in behavioral parameters that happen during lights OFF → ON phase and during lights On → OFF phase. We found that for ORN::42a, different temporal patterns of light stimulation elicited different behavioral responses (Figure 4). Such changes were not observed in control larvae that do not express UAS-CsChrimson in any ORNs. These results highlight the importance of understanding how temporal patterns of ORN activation contribute to animal behavior.

Figure 1
Figure 1: Behavior arena and larval crawling medium. (A) Front view of the black-box behavior arena. The open door of the arena reveals a CCD camera suspended from the ceiling of the box. (B) Bottom view of a metal platform containing red LED light strips used for optogenetic stimulations is mounted around the CCD camera. (C) Top view of the larval crawling medium used in the assay. Prior to start of recording larval movement, ~20 washed larvae are laid along the center of a 22 cm x 22 cm Petri dish layered with 1.5% agarose. The Petri dish containing larvae is placed in the center of the arena under the CCD camera and in between two infra-red LED light strips that are used as a light source for the camera. Please click here to view a larger version of this figure.

Figure 2
Figure 2: Optogenetics setup. An infographic showing the electronic arrangement for the optogenetics setup. Briefly, LED light (630 nm) strips are connected in series and wires from the strips are fed into an optocoupler connected to a raspberry PI 2B microprocessor. Both the LED light strips and the optocoupler are powered by a power supply. Please click here to view a larger version of this figure.

Figure 3
Figure 3: Impact of light activation of individual ORNs on larval behavior. Run length of larvae expressing CsChrimson in ORN::7a and ORN::42a were differently affected compared to control larvae upon light activation. Each bar represents average RI ± SEM (n = 8). Run length of larvae when ORN::7a was activated was significantly lower than control. Run length of larvae when ORN::42a was activated was significantly higher than control. Bars represent mean ± SEM (n = 8, Student t-test; "*" is p <0.05, "**" is p <0.001). Please click here to view a larger version of this figure.

Figure 4
Figure 4: Impact of different temporal patterns of ORN activation on larval behavior. (A) Three temporal patterns of stimuli used for activating ORNs. Stimulus a: 1 min constant light during, Stimulus b: 0.04 Hz light stimulation, Stimulus c: 1 Hz light stimulation during LED ON period in minute 2. (B) Larvae were subjected to the three different patterns of light stimuli described in A. Each dot represents the change in larval behavior, under each pattern of light stimuli, when light activation is switched from ON to OFF. Change in 'run length' (Av. run length (OFF) - Av. run length (ON)) is plotted on the X-axis. Change in 'run speed' (Av. run speed (OFF) - Av. run speed (ON)) is plotted on the Y-axis. The left graph (grey dots) represents measurements from control larvae and the right graph (red dots) represents measurements from larvae expressing CsChrimson in ORN::42a. Please click here to view a larger version of this figure.

Final Code PDF
Supplemental file of syntax: A set of simple Matlab codes ('Tracklarva') that can be easily adapted to suit appropriate conditions. Please click here to download this file.

Subscription Required. Please recommend JoVE to your librarian.


Here, we described a method that allows for the measurement of Drosophila larval behavior in response to simultaneous optogenetic activation of olfactory neurons. Previously described larval tracking methods1,8 use different odor delivery technology to activate ORNs. However, these methods cannot control for either the specificity or temporal patterns of ORN activation. Our method overcomes these deficits by using light stimuli instead of odor stimuli for more precise control of ORN activation.

The materials needed to build the behavior arena can be easily obtained at the local hardware store and requires minimal effort at assembly. The electronics needed to prepare the optogenetics module are also easily available and constructed. The method described here uses red light to activate a red-shifted channel rhodopsin (CsChrimson) expressed in specific neurons. The resulting larval behavior in response to the corresponding ORN activation is recorded using a CCD camera and measured using custom written software that is provided here. Our method allows researchers to ask answers to several questions that were not possible before: 1) what is the impact of different olfactory stimulus patterns on the animal's ability to navigate toward an odor? 2) similar to ON-center and OFF-center ganglion cells in mammalian retina16, are there ORNs that respond specifically to a decrease in olfactory stimuli in addition to ORNs that respond to an increase in olfactory stimuli? Finally, our method permits a variety of future applications, including measuring the impact of downstream neurons in the olfactory circuit (PNs and LNs) to larval navigation.

While there are several advantages to our method, we acknowledge certain limitations. It is unclear whether concentration effects observed with odorants can be easily replicated using this system. While our present setup does not allow this, the optogenetics module could be easily modified to accommodate increases or decreases in the intensity of the light stimulus. In the future, we will check to see whether changing intensity of light stimulus mimics concentration effects of odorants. Simple fly genetic techniques can be used to express CsChrimson in either all 21 pairs of ORNs (using Orco-Gal4) or in a single pair of ORNs (using individual Or-Gal4s). However, complicated genetics would be required to express CsChrimson in '1 < n < 21' neurons. Due to this, it would be difficult to replicate the effects observed with odor mixtures where individual components of the mixture elicit responses from more than one ORN. Even though larval navigational behavior is considered to be a low dimensional behavior, we acknowledge that our larval tracking program could be further improved in the future by considering additional behavioral descriptors based on animal posture (e.g. probability of head turns, body bends etc.)8,17. Our study was restricted to first order sensory neurons in the larva. Further investigation is required before our method can be applied to second order projection neurons and local neurons that are embedded in the brain lobe region of the brain18.

In summary, our method offers the ability to dissect the function of every ORN in the simple, tractable olfactory circuit of the Drosophila larva. By doing so, our method will enable development of more precise computational models that describe how odor signals are translated into different behavioral outputs.

Subscription Required. Please recommend JoVE to your librarian.


The authors have nothing to disclose.


This work was supported by startup funds from the University of Nevada, Reno and by NIGMS of the National Institute of Health under grant number P20 GM103650.


Name Company Catalog Number Comments
Video camera to capture larval movement
CCD Camera  Edmund Optics 106215
M52 to M55 Filter Thread Adapter Edmund Optics 59-446
2" Square Threaded Filter Holder for Imaging Lenses  Edmund Optics 59-445
RG-715, 2" Sq. Longpass Filter Edmund Optics 46-066
Electronics for optogenetic setup
Raspberry Pi 2B RPI2-MODB-V1.2
3 Channel programmable power supply 9SIA3C62037092
8 Channel optocoupler relay 6454319
630nm Quad-row LED strip lights red3528-450-reel
850nm LED strips wp-4000K-CC5050-60x2-kit
Matlab Mathworks Inc.
Ubuntu MATE v16.04 Nubuntu
Other items
Plexiglass black acrylic Home Depot MC1184848bl
Fly food and other reagents
Nutrifly fly food Genesee Scientific 66-112
Agarose powder Genesee Scientific 20-102
22cm X 22cm square petri-dish VWR Inc. 25382-327
DMSO Sigma-Aldrich D2650
Sucrose Sigma-Aldrich 84097
All trans-retinal Sigma-Aldrich R2500
UAS-IVS-CsChrimson  Bloomington Drosophila Stock Center 55134
Orco-Gal4 Bloomington Drosophila Stock Center 26818
Or42a-Gal4 Bloomington Drosophila Stock Center 9970
Or7a-Gal4 Bloomington Drosophila Stock Center 23907



  1. Mathew, D., et al. Functional diversity among sensory receptors in a Drosophila olfactory circuit. Proceedings of the National Academy of Sciences of the United States of America. 110, 2134-2143 (2013).
  2. Ramaekers, A., et al. Glomerular maps without cellular redundancy at successive levels of the Drosophila larval olfactory circuit. Current biology : CB. 15, 982-992 (2005).
  3. Couto, A., Alenius, M., Dickson, B. Molecular, anatomical, and functional organization of the Drosophila olfactory system. Current biology : CB. 15, 1535-1547 (2005).
  4. Kreher, S. A., Kwon, J. Y., Carlson, J. R. The molecular basis of odor coding in the Drosophila larva. Neuron. 46, 445-456 (2005).
  5. Kreher, S. A., Mathew, D., Kim, J., Carlson, J. R. Translation of sensory input into behavioral output via an olfactory system. Neuron. 59, 110-124 (2008).
  6. Hallem, E. A., Carlson, J. R. Coding of odors by a receptor repertoire. Cell. 125, 143-160 (2006).
  7. Monte, P., et al. Characterization of the larval olfactory response in Drosophila and its genetic basis. Behav Genet. 19, 267-283 (1989).
  8. Gershow, M., et al. Controlling airborne cues to study small animal navigation. Nature methods. 9, 290-296 (2012).
  9. Klapoetke, N. C., et al. Independent optical excitation of distinct neural populations. Nature methods. 11, 338-346 (2014).
  10. Hernandez-Nunez, L., et al. Reverse-correlation analysis of navigation dynamics in Drosophila larva using optogenetics. eLife. 4, (2015).
  11. Brand, A. H., Perrimon, N. Targeted gene expression as a means of altering cell fates and generating dominant phenotypes. Development. 118, 401-415 (1993).
  12. Kabra, M., Robie, A. A., Rivera-Alba, M., Branson, S., Branson, K. JAABA: interactive machine learning for automatic annotation of animal behavior. Nature methods. 10, 64-67 (2013).
  13. Newquist, G., Novenschi, A., Kohler, D., Mathew, D. Differential contributions of Olfactory Receptor Neurons in a Drosophila olfactory circuit. eNeuro. 3, (2016).
  14. Schulze, A., et al. Dynamical feature extraction at the sensory periphery guides chemotaxis. eLife. 4, (2015).
  15. Tastekin, I., et al. Role of the Subesophageal Zone in Sensorimotor Control of Orientation in Drosophila Larva. Current Biology. 25, 1448-1460 (2015).
  16. Famiglietti, E. V., Kolb, H. Structural basis for ON-and OFF-center responses in retinal ganglion cells. Science. 194, 193-195 (1976).
  17. Luo, L., et al. Bidirectional thermotaxis in Caenorhabditis elegans is mediated by distinct sensorimotor strategies driven by the AFD thermosensory neurons. Proceedings of the National Academy of Sciences of the United States of America. 111, 2776-2781 (2014).
  18. Berck, M. E., et al. The wiring diagram of a glomerular olfactory system. eLife. 5, (2016).



    Post a Question / Comment / Request

    You must be signed in to post a comment. Please or create an account.

    Usage Statistics