Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

  • Article
  • Published:

Automated monitoring and analysis of social behavior in Drosophila

This article has been updated


We introduce a method based on machine vision for automatically measuring aggression and courtship in Drosophila melanogaster. The genetic and neural circuit bases of these innate social behaviors are poorly understood. High-throughput behavioral screening in this genetically tractable model organism is a potentially powerful approach, but it is currently very laborious. Our system monitors interacting pairs of flies and computes their location, orientation and wing posture. These features are used for detecting behaviors exhibited during aggression and courtship. Among these, wing threat, lunging and tussling are specific to aggression; circling, wing extension (courtship 'song') and copulation are specific to courtship; locomotion and chasing are common to both. Ethograms may be constructed automatically from these measurements, saving considerable time and effort. This technology should enable large-scale screens for genes and neural circuits controlling courtship and aggression.

This is a preview of subscription content, access via your institution

Access options

Buy this article

Prices may be subject to local taxes which are calculated during checkout

Figure 1: Imaging setup for genetic screens in Drosophila.
Figure 2: Detection and tracking of fruit flies.
Figure 3: Detectable actions.
Figure 4: Performance of action detection.
Figure 5: Genetic and environmental influences on aggressive and courtship behavior.

Similar content being viewed by others

Change history

  • 22 March 2009

    NOTE: In the version of this article initially published online, an attribution was omitted. The observation that genetic feminization of cholinergic neurons increases aggression was originally reported in abstract form (Y.B. Chan and E.A. Kravitz, Cold Spring Harbor Laboratory Neurobiology of Drosophila Abstracts, 42, 2005). The error has been corrected for the print, PDF and HTML versions of this article.


  1. Manoli, D.S. et al. Male-specific fruitless specifies the neural substrates of Drosophila courtship behaviour. Nature 436, 395–400 (2005).

    Article  CAS  Google Scholar 

  2. Demir, E. & Dickson, B.J. fruitless splicing specifies male courtship behavior in Drosophila. Cell 121, 785–794 (2005).

    Article  CAS  Google Scholar 

  3. Stockinger, P., Kvitsiani, D., Rotkopf, S., Tirian, L. & Dickson, B.J. Neural circuitry that governs Drosophila male courtship behavior. Cell 121, 795–807 (2005).

    Article  CAS  Google Scholar 

  4. Vrontou, E., Nilsen, S.P., Demir, E., Kravitz, E.A. & Dickson, B.J. fruitless regulates aggression and dominance in Drosophila. Nat. Neurosci. 9, 1469–1471 (2006).

    Article  CAS  Google Scholar 

  5. Manoli, D.S., Meissner, G.W. & Baker, B.S. Blueprints for behavior: genetic specification of neural circuitry for innate behaviors. Trends Neurosci. 29, 444–451 (2006).

    Article  CAS  Google Scholar 

  6. Callaway, E.M. A molecular and genetic arsenal for systems neuroscience. Trends Neurosci. 28, 196–201 (2005).

    Article  CAS  Google Scholar 

  7. Luo, L., Callaway, E.M. & Svoboda, K. Genetic dissection of neural circuits. Neuron 57, 634–660 (2008).

    Article  CAS  Google Scholar 

  8. Suh, G.S. et al. A single population of olfactory sensory neurons mediates an innate avoidance behaviour in Drosophila. Nature 431, 854–859 (2004).

    Article  CAS  Google Scholar 

  9. Katsov, A.Y. & Clandinin, T.R. Motion processing streams in Drosophila are behaviorally specialized. Neuron 59, 322–335 (2008).

    Article  CAS  Google Scholar 

  10. de Bono, M. & Maricq, A.V. Neuronal substrates of complex behaviors in C. elegans. Annu. Rev. Neurosci. 28, 451–501 (2005).

    Article  CAS  Google Scholar 

  11. Skrzipek, K.H., Kroner, B. & Hager, H. Inter-male aggression in Drosophila melanogaster—laboratory study. J. Comp. Ethol. 49, 87–103 (1979).

    Google Scholar 

  12. Hoffmann, A.A. A laboratory study of male territoriality in the sibling species Drosophila melanogaster and D. simulans. Anim. Behav. 35, 807–818 (1987).

    Article  Google Scholar 

  13. Chen, S., Lee, A.Y., Bowens, N.M., Huber, R. & Kravitz, E.A. Fighting fruit flies: a model system for the study of aggression. Proc. Natl. Acad. Sci. USA 99, 5664–5668 (2002).

    Article  CAS  Google Scholar 

  14. Kravitz, E.A. & Huber, R. Aggression in invertebrates. Curr. Opin. Neurobiol. 13, 736–743 (2003).

    Article  CAS  Google Scholar 

  15. Greenspan, R.J. & Ferveur, J.F. Courtship in Drosophila. Annu. Rev. Genet. 34, 205–232 (2000).

    Article  CAS  Google Scholar 

  16. Wehrhahn, C., Poggio, T. & Bülthoff, H. Tracking and chasing in houseflies (Musca). Biol. Cybern. 45, 123–130 (1982).

    Article  Google Scholar 

  17. Branson, K. & Belongie, S. Tracking multiple mouse contours (without too many samples). IEEE Computer Vision and Pattern Recognition 1, 1039–1046 (2005).

    Google Scholar 

  18. Khan, Z., Balch, T. & Dellaert, F. MCMC-based particle filtering for tracking a variable number of interacting targets. IEEE Trans. Pattern Anal. Mach. Intell. 27, 1805–1819 (2005).

    Article  Google Scholar 

  19. Veeraraghavan, A., Chellappa, R. & Srinivasan, M. Shape-and-behavior encoded tracking of bee dances. IEEE Trans. Pattern Anal. Mach. Intell. 30, 463–476 (2008).

    Article  Google Scholar 

  20. Fry, S.N., Rohrseitz, N., Straw, A.D. & Dickinson, M.H. TrackFly: virtual reality for a behavioral system analysis in free-flying fruit flies. J. Neurosci. Methods 171, 110–117 (2008).

    Article  Google Scholar 

  21. Wolf, F.W., Rodan, A.R., Tsai, L.T. & Heberlein, U. High-resolution analysis of ethanol-induced locomotor stimulation in Drosophila. J. Neurosci. 22, 11035–11044 (2002).

    Article  CAS  Google Scholar 

  22. Valente, D., Golani, I. & Mitra, P.P. Analysis of the trajectory of Drosophila melanogaster in a circular open field arena. PLoS ONE 2, e1083 10.1371/journal.pone.0001083 (2007).

    Article  PubMed  PubMed Central  Google Scholar 

  23. Hoyer, S.C. et al. Octopamine in male aggression of Drosophila. Curr. Biol. 18, 159–167 (2008).

    Article  CAS  Google Scholar 

  24. Wang, L., Dankert, H., Perona, P. & Anderson, D.J. A common genetic target for environmental and heritable influences on aggressiveness in Drosophila. Proc. Natl. Acad. Sci. USA 105, 5657–5663 (2008).

    Article  CAS  Google Scholar 

  25. Dierick, H.A. A method for quantifying aggression in male Drosophila melanogaster. Nat. Protoc. 2, 2712–2718 (2007).

    Article  CAS  Google Scholar 

  26. Bishop, C.M. Pattern Recognition and Machine Learning (Springer, New York) p. 738 (2007).

    Google Scholar 

  27. Johns, D.C., Marx, R., Mains, R.E., O'Rourke, B. & Marban, E. Inducible genetic suppression of neuronal excitability. J. Neurosci. 19, 1691–1697 (1999).

    Article  CAS  Google Scholar 

  28. Ferveur, J.F., Stortkuhl, K.F., Stocker, R.F. & Greenspan, R.J. Genetic feminization of brain structures and changed sexual orientation in male Drosophila. Science 267, 902–905 (1995).

    Article  CAS  Google Scholar 

  29. Certel, S.J., Savella, M.G., Schlegel, D.C.F. & Kravitz, E.A. Modulation of Drosophila male behavioral choice. Proc. Natl. Acad. Sci. USA 104, 4706–4711 (2007).

    Article  CAS  Google Scholar 

  30. Otsu, N. A threshold selection method from gray level histograms. IEEE Trans. Syst. Man Cybern. 9, 62–66 (1979).

    Article  Google Scholar 

Download references


We thank K. Watanabe and A. Hergarden for helping prepare the flies, assays, taking video footage of flies as well as collecting ground-truth data. This work was supported by a National Science Foundation Frontiers in Integrative Biological Research grant to M.J. Dickinson, D.J.A. and E. Isacoff, a National Science Foundation National Institutes of Health grant to P.P. and M.J. Dickinson, and a postdoctoral fellowship of the Alexander von Humboldt-Foundation to H.D. We thank M. Heisenberg for sponsoring H.D. in Germany and for sharing information and data regarding aggression arenas and automated assays.

Author information

Authors and Affiliations


Corresponding authors

Correspondence to David J Anderson or Pietro Perona.

Supplementary information

Supplementary Text and Figures

Supplementary Figures 1–6, Supplementary Tables 1–9, Supplementary Methods (PDF 3305 kb)

Supplementary Video 1

High-resolution movie clip of a lunge (top view), complementing Figure 3a. (MOV 47 kb)

Supplementary Video 2

Movie clip of body and wing tracking during a lunge. (MOV 251 kb)

Supplementary Video 3

High-resolution movie clip of tussling (top view), complementing Figure 3b. (MOV 141 kb)

Supplementary Video 4

High-resolution movie clip of a wing threat (side view), complementing Figure 3c. (MOV 86 kb)

Supplementary Video 5

Movie clip of body and wing tracking during a wing threat. (MOV 564 kb)

Supplementary Video 6

High-resolution movie clip of wing extension and circling (top view), complementing Figure 3e. (MOV 185 kb)

Supplementary Video 7

Movie clip of body and wing tracking during wing extension and circling. (MOV 2009 kb)

Supplementary Video 8

High-resolution movie clip of copulation (side view), complementing Figure 3d. (MOV 762 kb)

Supplementary Video 9

High-resolution movie clip of copulation with wing extension and circling (top view), complementing Figure 3d. (MOV 259 kb)

Supplementary Video 10

High-resolution movie clip of chasing (top view), complementing Figure 3f. (MOV 742 kb)

Supplementary Software

Source code of “Caltech Automated Drosophila Aggression-Courtship Behavioral Repertoire Analysis (CADABRA)”. (ZIP 3904 kb)

Rights and permissions

Reprints and permissions

About this article

Cite this article

Dankert, H., Wang, L., Hoopfer, E. et al. Automated monitoring and analysis of social behavior in Drosophila. Nat Methods 6, 297–303 (2009).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing