Login processing...

Trial ends in Request Full Access Tell Your Colleague About Jove

Encyclopedia of Experiments

Drosophila Courtship Conditioning: A Method to Test Learning and Memory In Flies


This video describes a classical conditioning assay that tests learning and memory in Drosophila, called courtship conditioning. The assay is based on the reduction of male courtship after experiencing a rejection by a non-receptive premated female. The example protocol shows a setup for the procedure that can be used to assess short- and long-term memory.


This protocol is an excerpt from Koemans et al., Drosophila Courtship Conditioning As a Measure of Learning and Memory, J. Vis. Exp. (2017).

NOTE: In the protocol outlined below, one replicate of collection, training, and testing is described. In order to test the reproducibility of the results, these steps should be repeated in parallel, on multiple days, and with separate groups of flies (Table 1). The protocol is based on a 10 day life cycle from egg to adult, which is normal when rearing flies under constant conditions of 25 °C, 70% humidity, and a 12 h light/dark cycle. All aspects of this protocol assume that the conditions are kept constant throughout the entire assay. Times are indicated as hours before lights turn on (BLO) or after lights turn on (ALO) in the incubator, as this can be conveniently set depending on the researcher's preferred time of day. Use CO2 gas only for the initial collection of naïve male flies and for the collection of premated females. This protocol for courtship conditioning is composed of the following steps:

  1. Establishment of premated female collection cultures
  2. Establishment of cultures for the collection of male test subjects
  3. Preparation of housing blocks
  4. Establishment of mating vials for the production of standardized premated females
  5. Collection of male test subjects
  6. Training
  7. Testing
  8. Video data analysis and statistics

1. Establishment of Premated Female Collection Cultures

  1. Prepare powerfood. Boil 0.8% (w/v) agar, 8% (w/v) yeast, 2% (w/v) yeast extract, 2% (w/v) peptone, 3% (w/v) sucrose, 6% (w/v) glucose, 0.05% (w/v) MgSO4, and 0.05% (w/v) CaCl2 in water for 15 min. Allow the solution to cool to 70 °C before adding 0.05% (w/v) methylparabene (CAUTION: toxic) and 0.5% (v/v) propionic acid (CAUTION: toxic). Mix well by stirring while cooling further to 50 °C to obtain a homogeneous solution.
  2. Before the food solidifies at room temperature, add ~50 mL of powerfood to each 175 mL plastic vial. Allow the food to cool further. Close the vial with a plug.
    NOTE: Powerfood is a specialized food mixture formulated specifically for the production of large numbers of flies, presumably by inducing egg laying. Powerfood is not used to produce male flies that will be used for behavior analysis (step 2) because the atypical diet and potential crowding might influence development.
  3. On day -11 (Table 1), start 5-20 wildtype cultures with approximately 60-100 flies (a mix of males and females) in powerfood vials; these will be used in step 4 to produce standardized premated females. Add a filter paper to each vial to increase the area upon which the larvae can pupate; this will increase the number of flies that can eclose.
  4. Periodically repeat steps 1.1-1.3 throughout the experiment to obtain sufficient newly eclosing flies as input for the "establishment of mating vials for the production of standardized premated females" (step 4).

2. Establishment of Cultures for the Collection of Male Test Subjects

  1. Prepare normal food, made with 0.5% (w/v) agar, 2.75% (w/v) yeast, 5.2% (w/v) corn flour, 11% (w/v) sugar, 0.05% (w/v) methylparabene, and 0.5% (v/v) propionic acid in water, as described in steps 1.1 and 1.2. Close the 175-mL plastic vials with a fly vial plug.
  2. On day -10 (Table 1), place about 10-20 males with approximately 30-75 virgin females (Materials/Equipment Table) in each 175 mL vial containing normal food. Add a filter paper to increase the surface area for pupation and to maximize productivity.
  3. Establish three to six 175 mL vials per genotype to obtain the required number of test subject males.
    NOTE: More vials may be needed, depending on the productivity of the desired genotype.

3. Preparation of Housing Blocks (Figure 2A)

  1. Melt approximately 50 mL of powerfood per housing block in a microwave, or prepare it fresh.
  2. Add 500 µL of powerfood to each well of a 96-well, flat-bottom block using a multidispenser pipette.
  3. Allow the food to solidify at room temperature.
  4. Cover the blocks with PCR adhesive film and use a needle to make at least 4 holes per well to provide fresh air to the flies.
  5. In order to be able to open each well, use a razor blade to cut the adhesive film lengthwise between each row. Leave the film intact on one end of the block.
  6. The blocks can be stored at 4 °C for up to 2 days.
    NOTE: Allow the blocks to re-equilibrate to room temperature prior to use.

4. Establishment of Mating Vials for the Production of Standardized Premated Females

  1. On day -1, remove and discard all adult wildtype flies from premated female collection cultures at 2-5 h BLO.
  2. Collect flies using the aspirator (Figure 2B) from these vials in 2- to 3-h intervals (e.g., at 30 min, 2.5 h, and 5 h ALO) and place them in a new powerfood vial supplemented with a small amount of yeast paste and filter paper.
  3. To avoid crowding and to promote an optimal mating atmosphere, do not transfer more than 150-200 flies to each new vial. Ensure the mating of all females by providing at least 25% males. Ensure that sufficient females are present in the mating vials to accommodate the size of the experiment.
    NOTE: As this is a crucial step in the protocol, make sure that only freshly eclosed flies and no old flies, larvae, or pupae are transferred to the new mating vial.
  4. Incubate these "mating vials" for four days to allow sufficient time for all females to have mated.

5. Collection of Male Test Subjects

  1. On day 1 (Table 1) at 2-3 h BLO, use CO2 to remove all adult flies from the male collection vials (step 2), but let more flies eclose over the next few hours.
  2. Over the next 5-6 h, remove newly eclosed flies every 20-30 min using CO2 and put each male in an individual well of the housing block (step 3) using the aspirator (Figure 2B).
  3. Re-seal the well with the adhesive PCR film.
    NOTE: This is a crucial step in the protocol. The males should be collected frequently. Collected males should be isolated in the housing block close to the time of eclosion, when they demonstrate pale pigmentation and the presence of the meconium in the translucent abdomen.
    NOTE: Gentle use of the aspirator allows the transfer of flies; however, inappropriate use will stress the flies, causing variance in the assay (see the Discussion).
  4. Aim to collect up to 48 males per genotype. This provides a small excess to the maximal number of males needed for the analysis of both naïve and trained conditions, allowing for some loss during later transfer steps.

6. Training

  1. Remove the flies from the mating vial (step 4.2) using CO2 and separate the premated females from the males.
  2. Using the aspirator, add a single anesthetized, premated female to each well in one row of a new housing block.
  3. Using the aspirator and without anesthesia, transfer an individual naïve male from the housing block set up in step 5.2 to the well containing a premated female. After the male is placed into the well, re-seal immediately with the adhesive film; do not allow the male to escape.
    NOTE: Transfer male flies from the aspirator to the housing block by taking advantage of their natural "negative geotaxis" behavior.
  4. Repeat steps 6.2-6.3 until enough male-female pairs are established. Ideally, establish 24 pairs, two full rows of a housing block, per genotype. Leave the remaining naïve males in the original housing block set up in step 5.2.
  5. Leave the male-female pairs undisturbed during the training period (Table 2, Figure 1B).
    NOTE: During this time, the male will court and be rejected by the premated female. For learning and STM, the training period is 1 h and for LTM, the training period is 7-9 h.
  6. End the training (Table 2, Figure 1B) by using an aspirator to gently separate the male from the premated female; do not use anesthesia. Place the separated male in a new housing block.
  7. Use the aspirator to transfer all naïve males gently and without anesthesia from the housing block set up in step 5.2 to a new housing block.
    NOTE: This step is optional for STM and learning, but it is very important for LTM because the flies are housed for an additional 24 h to test LTM.
  8. For STM and LTM, allow the males to rest for 1 h and ~24 h, respectively (Table 2, Figure 1B) before testing (step 7).
  9. For learning, immediately test the trained and naïve males (step 7).

7. Testing

  1. Collect flies from mating vials (step 4.2) using CO2 and separate the premated females from the males.
  2. Let the females recover from the anesthesia for at least 1 h in a vial containing normal food.
  3. Mount the video recorders in advance (Figure 2C), in order to have all equipment ready before the testing starts.
  4. Start the testing according to the different timelines for learning, STM, and LTM (Table 2, Figure 1B). Perform testing immediately after training for learning, 1 h after training for STM, and 24 h after training for LTM.
  5. Using the aspirator, gently transfer an individual male from the resting housing block or from the training housing block if learning is being tested (step 6.7, trained; step 6.8, naïve) to one half of a courtship arena with the divider closed (Figure 2D; see File S1 for a building plan).
    NOTE: The use of the natural "negative geotaxis" behavior should be sufficient to transfer the male flies from the aspirator to the courtship arena.
  6. Quickly but gently move the entry hole to the next arena and repeat step 7.5 until all 18 arenas contain one male.
  7. Using the aspirator and without CO2, add one premated female (collected in step 7.2) to the other half of all 18 arenas.
  8. Carefully place the courtship chamber under the camera, with the opening of the wells facing down (Figure 2C).
  9. Remove the divider of the arenas to allow direct interaction between the males and premated females.
  10. Immediately start recording the behavior for at least 10 min.
    NOTE: When using a two-camera setup, the parallel recording of two courtship plates can be done in overlapping timeframes to maximize efficiency.
  11. Empty the courtship arenas using a hand-held vacuum cleaner and allow the courtship chamber to ventilate before re-use.
  12. Repeat step 7.4-7.11 until the testing of all genotypes and conditions (i.e., naïve and trained) have been completed.

8. Video Data Analysis and Statistics

  1. Calculate the courtship index (CI), defined as the percentage of time that the male courts during the first 10 min of the testing period, for each individual male fly.
    NOTE: This can be done manually by observing stereotypical courtship behavior (Figure 1A) or by using computer software for automated quantification of courtship behavior.
    NOTE: It is recommended to analyze 40-60 males per condition over the course of three days in order to achieve sufficient statistical power and to judge the consistency of the CI data.
  2. Calculate the learning index (LI), defined as the percent reduction in the mean CI of trained males compared to naïve males (LI = (CInaive – CItrained) / CInaive). Evaluate the LI for each day of testing and compare it to the cumulative LI calculated from all testing days combined.
  3. Make a separate two-column tab data file with "Genotype" and "CI" as the headers.
    NOTE: These headings are case sensitive. The name of the genotype for each CI must consist of a description of the genotype followed by an underscore and the training condition (e.g., genotype_N and genotype_LTM, etc., where N = naïve and LTM = long term memory; see Supplemental File S2 for an example). This annotation is essential, as the function analearn will identify trained and naïve flies based on the characters present after the first underscore in the "Genotype" column.
  4. Use the analearn R script (Supplemental File S3) to perform a randomization test to judge the statistical significance of differences between the LI values from different genotypes.
    1. Source the script (Supplemental File S3) into R, which defines a function called "analearn."
      NOTE: The function definition is: analearn <- function(nboot = 10,000, naivelevel = 'N', refmutation = NA, datname = NA, header = TRUE, seed = NA, writeoutput = TRUE).
    2. Start the function by entering "analearn()" in the R command line and selecting the data file to be analyzed (produced in step 8.3) via the pop-up window.
    3. Choose the reference mutation, which is the control genotype, by entering the corresponding number and pressing enter.
      NOTE: After selecting the reference genotype, the script takes several seconds to perform 10,000 bootstrap replicates.
    4. Observe the output table (Table 3), which contains the genotype, learning condition (i.e., learning, STM, or LTM), mean CI naïve, mean CI trained, LI, the difference between the LI of the control compared to the experimental condition (LI dif), the lower limit (LL) and upper limit (UL) of the 95% confidence interval of the LI dif, and the p-value indicating the probability that there is no significant difference.
      NOTE: analearn will store an output text file in the directory where the data file is located. However, the output table also appears in the R-Studio console. The default name is constructed based on the name of the data file provided.
    5. There are several arguments in the analearn function that can be used to alter the default settings of the function to adjust the parameters of the bootstrapping.
      NOTE: "nboot" defines the number of bootstrap replicates and is set to 10,000 by default. This value can be changed into any integer number larger than zero. Table 5 enlists several arguments that can be used to alter the default settings of the function. However, it is not recommended to use data that is produced with a low number of bootstrap replicates.

Subscription Required. Please recommend JoVE to your librarian.

Representative Results

Figure 1
Figure 1: Determination of the Courtship Index and Experimental Overview. (A) Images showing stereotypical male courtship behavior towards a female fly. Different stages of courtship behavior are shown: orientation (I), following (II), wing vibration (extension) and tapping (III), licking (IV), and attempted copulation (V). (B) Schematic overview of training and testing times relative to the incubator light cycle, marked in hours. Training times are indicated with bars, resting periods for STM and LTM are indicated with a dashed line, and the testing start point is indicated as an arrow. Note that the testing time for LTM is the day after training. Please click here to view a larger version of this figure.

Figure 2
Figure 2: Equipment used for the Drosophila Courtship Conditioning Assay. (A) The housing block is a flat, bottom block with 500 µL of powerfood per well. It is sealed with a qPCR adhesive film with at least 4 holes per well that were created using a syringe needle with a 0.8 mm diameter. Individual rows are cut lengthwise into strips using a razor blade to allow opening and closing. (B) The aspirator is required for the gentle transfer of male and female flies without the use of anesthesia. The inset shows the tip of the aspirator, closed with a piece of cotton to keep the flies within the tip. (C) Setup of a two-camera system for the simultaneous recording of two courtship chambers. (D) A courtship chamber with 18 arenas. Sliding entry holes are used to place the flies in the arenas. The white dividers can be simultaneously opened to initiate interaction between the males and females. Please click here to view a larger version of this figure.

Table 1: Example Timeline for Testing LTM over Three Replicates on Individual Days.

General Collect Train Test
day -11 Start premated female collection cultures (step 1.3)
day -10 Start cultures for the collection of male test subjects (step 2.2)
day 1 rep. 1
day 2 rep. 2
day 3 rep. 3
day 4 rep. 4 rep. 1
day 5 rep. 2 rep. 1
day 6 rep. 3 rep. 2
day 7 rep. 4 rep. 3
day 8 rep. 4
day 9 Video data analysis and statistics (step 8)
rep = repeat

Table 2: Training Duration, Training Times, and Testing Times for Learning, STM, and LTM

Learning STM LTM
Training time 1 h. 1 h. 8 h.
Resting time 0 h. 1 h. ~ 24 h.
start training 0 h. ALO 0 h. ALO 4 h. BLO
stop training 1 h. ALO 1 h. ALO 4 h. ALO
start test 1 h. ALO 2 h. ALO 0 h. ALO (next day)
ALO = after lights turn on, BLO = before lights turn on, STM = short term memory, LTM = long term memory

Table 3: Statistical Data Produced from the Analearn Script.
Statistical data produced from the analearn script. The output file of the bootstrapping R-script containing the genotype, learning condition (i.e., learning, STM, or LTM), mean CI naïve, mean CI trained, LI, difference between LI of the control compared to experimental condition (LI dif), the lower limit (LL) and upper limit (UL) of the 95% confidence interval of LI dif, and the p-value indicating the probability that there is no significant difference.

Genotype Learning CI CI LI LI Lower limit Upper limit p-value
condition naive trained difference (95% conficence interval) (95% conficence interval)
Control STM 0.467 0.116 0.752 NA NA NA NA
Dhap-at-RNAi STM 0.699 0.257 0.633 0.119 -0.03 0.265 0.116
Control LTM 0.59 0.384 0.348 NA NA NA NA
Dhap-at-RNAi LTM 0.697 0.65 0.068 0.28 0.103 0.446 0.003

Supplemental File S1: Building plan of a courtship chamber. The file can be opened with any application that allows .stp extensions (CAD-files). Please click here to download this file.

Supplemental File S2: Example of an Input File for the Analearn Script. Please click here to download this file.

Supplemental File S3: The Analearn.R Script. The file can be opened with R-studio. Please click here to download this file.

Subscription Required. Please recommend JoVE to your librarian.


Name Company Catalog Number Comments
P{KK101437}VIE-260B VDRC 101437 Dhat-at-RNAi in 60100 background
P{KK108109}VIE-260B - - Control-RNAi in 60100 background (gift from K. Keleman)
w+, UAS-dcr2/yhh;;elav-Gal4 (III) - - panneuronal driver line
Containers for plant tissue culture VWR 960177 175 mL plastic vials
Folded filters Whatman 10311643 Filter paper to enlarge area flies can pupate on
Flat-bottom blocks (96-wells) Qiagen 19579 Used for housing blocks
MicroAmp Clear Adhesive Film Applied Biosystems 4306311 PCR adhesive film as lid on flat-bottom blocks
Razor blade - - Any sharp will do
Needle - - 0.8 mm diameter
Aspirator - - Cut a 1mL pipet tip with scissors in order to have two pieces. The narrow tip of the pipettip is placed as fly entrance in a ~80 cm flexible hose. To prevent a fly from getting in the hose, a normal piece of cotton or small mesh gaze is placed in between the tip and the hose. The other half of the pipettip can be used as mouth piece at the end of the hose.
Courtship chambers - - file S1 can be opened with indicated CAD software
Camcorder Sony - camera specification: >4M pixels, full HD.
For manual quantification, any simple video recording device has the potential to produce a video of sufficient quality to observe courtship behavior accurately. For automated quantification, there will likely be different requirements depending on the software to be used, and users should investigate this thoroughly if automated quantification is desired.
Name Company Catalog Number Comments
power food
Agar Sigma A7002
Yeast Bruggeman -
Yeast extract MP biomedicals 0210330391
Peptone Sigma P6838
Sucrose Sigma S9378
Glucose Sigma G7021
MgSO4 Sigma M2643
CaCl2 Merck 1023780500
Methylparabene (CAUTION) Sigma H5501
Propionic acid (CAUTION) Sigma P1386
Demineralized water -
Yeast paste - yeast grains and water mixture in a 1:1 ratio
Name Company Catalog Number Comments
normal food
Agar MP biomedicals 215017890
Yeast bruggeman -
Corn flour de Molen -
Sugar de Molen -
Methylparabene (CAUTION) Sigma H5501
Propionic acid (CAUTION) Sigma P1386
Demineralized water -


<em>Drosophila</em> Courtship Conditioning: A Method to Test Learning and Memory In Flies
Play Video

Source: Koemans, T. S., et al. Drosophila Courtship Conditioning As a Measure of Learning and Memory. J. Vis. Exp. (2017).

View Video

Get cutting-edge science videos from JoVE sent straight to your inbox every month.

Waiting X
Simple Hit Counter