Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2022 Nov 1.
Published in final edited form as: Nature. 2021 Oct 13;599(7884):262–267. doi: 10.1038/s41586-021-03962-w

Neural control of affiliative touch in prosocial interaction

Ye Emily Wu 1,2, James Dang 1,2, Lyle Kingsbury 1, Mingmin Zhang 1, Fangmiao Sun 1, Rongfeng K Hu 1, Weizhe Hong 1
PMCID: PMC8605624  NIHMSID: NIHMS1750892  PMID: 34646019

Abstract

The ability to help and care for others fosters social cohesiveness and is vital to the physical and emotional well-being of social species including humans1-3. Affiliative social touch, such as allogrooming, is a major type of prosocial behavior that provides comfort to others1-6. It serves to establish and strengthen social bonds between animals and can help console distressed conspecifics. However, the neural circuits that promote prosocial affiliative touch have remained elusive. Here, we show that mice exhibit affiliative allogrooming behavior toward distressed partners, providing a consoling effect. The increase in allogrooming occurs in response to different types of stressors and can be elicited by olfactory cues from distressed individuals. Using microendoscopic calcium imaging, we find that neural activity in the medial amygdala (MeA) responds differentially to naive and distressed conspecifics and encodes allogrooming behavior. Through intersectional functional manipulations, we establish a direct causal role of the MeA in controlling affiliative allogrooming and identify a select, tachykinin-expressing subpopulation of MeA GABAergic neurons that promote this behavior through their projections to the medial preoptic area (MPOA). Together, our study demonstrates that mice display prosocial comforting behavior and reveals a neural circuit mechanism that underlies the encoding and control of affiliative touch during prosocial interactions.


Helping and caring for others forms the ethos of our social lives—without these actions, we risk a loss of kinship, community, and our own well-being. Amidst the wide diversity of social species, humans and other animals display prosocial behaviors, such as comforting, helping, and resource sharing, to support other individuals’ emotions, goals, and/or material needs1-3. While these behaviors are often driven by empathy, prosocial behaviors go beyond basic sensing and sharing of others’ affective states by directing an active and targeted behavioral response to other individuals in need1-3. Yet, the neural mechanisms of how animals behave to help and benefit others remain largely unclear.

Affiliative social touch, such as allogrooming, serves as a common form of prosocial comforting behavior that can provide a pleasant experience to others and often occurs in the context of consolation to alleviate stress in the recipient3-6. Allogrooming (grooming behavior directed toward another individual) plays a vital role in building and strengthening social bonds throughout a wide range of social species, such as birds, rodents, canids, equids, and primates3-6. In humans, related forms of social touch, such as patting, caressing, and hugging, tend to serve a similar function and are of vital importance to our social life4,6. However, little is known about the neural circuits that encode and promote affiliative touch during prosocial interactions.

Prosocial comforting behavior in mice

In rodents, increased allogrooming toward distressed conspecifics has been observed in two monogamous vole species7,8, but it is unclear whether mice exhibit allogrooming as a comforting behavior. To explore whether mice display affiliative allogrooming in a prosocial context, we examined direct interactions between naïve subjects and their co-housed partners that were subjected to a stressor (Fig. 1a, Methods). Interestingly, while subjects only exhibited occasional allogrooming toward unstressed partners, this behavior was substantially increased toward distressed partners, with a longer duration and shorter onset latency (Fig. 1b-g, Extended Data Fig. 1a-f, Supplementary Video 1). This increase in allogrooming was observed in both male and female subjects (Extended Data Fig. 1a-f, Supplementary Note 1). In contrast, self-directed grooming did not increase during the same period (Fig. 1h, Extended Data Fig. 1g), arguing against a non-specific increase in generic grooming behavior.

Fig. 1. Mice display prosocial comforting behavior.

Fig. 1.

a, Schematic of prosocial interaction assay. b, Example raster plots showing allogrooming and self-grooming during prosocial interaction. c, Time-courses of cumulative allogrooming duration of subjects and partners after partners experience foot-shocks. Mean ± s.e.m. dh, Total duration (d), onset latency (e), total bout number (f), and average per-bout duration (g) of allogrooming and total duration of self-grooming (h) exhibited by subjects interacting with unstressed (control) or foot-shocked partners. i, j, Total allogrooming duration and total number of social approaches toward subjects exhibited by unstressed or foot-shocked partners. kn, s, t, Total allogrooming duration of subjects and partners after partners experience forced swim (k, l) or acute restraint (m, n), or after odor transfer from a naïve or stressed donor to partners (s, t). o, Schematic of CNN-RNN framework for classifying behaviors. p, q, Performance of binary (p) and four-way multi-class (q) classification of allogrooming, sniffing, self-grooming, or other behaviors. r, t-SNE visualization showing separation of different behaviors based on spatiotemporal features. u, v, Evaluation of stress-relieving effect of prosocial interaction using the open field test. Heatmaps show partners’ average occupancy at different locations. w, x, Fraction of time partners spent in corners of the open field. In b-x, subjects are males; see Extended Data Fig. 1 for female subjects. Boxplots: median, quartiles, 1.5× interquartile range (IQR) and outliers. ***P < 0.001, **P < 0.01, *P < 0.05. For details of statistical analyses and sample sizes, see Supplementary Table 1.

We also examined the behavior displayed by stressed partners. These animals showed no increase in allogrooming compared to separation-only controls (Fig. 1i, Extended Data Fig. 1h) and their level of allogrooming was substantially lower than that of subjects (two-sided Wilcoxon signed-rank test, P = 0.0001 in males and 0.0078 in females). This suggests that allogrooming is a unidirectional behavioral response of subjects toward stressed partners, as opposed to a general behavioral response to animals’ own stress. Moreover, stressed partners exhibited decreased social approach toward subjects compared to controls (Fig. 1j, Extended Data Fig. 1i), suggesting that increased allogrooming by subjects was not solicited by stressed partners. Furthermore, we found no significant correlation between partners’ self-grooming and subjects’ allogrooming towards partners (Pearson correlation R2 = 0.01, P = 0.79), suggesting that increased allogrooming was unlikely driven by partners’ own self-grooming.

To determine whether increased allogrooming occurs in response to different types of stressors, we subjected partners to stressful experiences induced by forced swim or acute restraint procedures (Methods). Subjects, but not stressed partners, displayed a significant increase of allogrooming under both conditions (Fig. 1k-n), suggesting that the display of allogrooming can be generalized to different kinds of acute stressors (Supplementary Note 2).

We next examined whether allogrooming contains characteristic spatiotemporal features that can be reliably recognized using machine learning methods. We implemented a deep convolutional neural network (CNN) model (Google Inception v3) to extract unsupervised spatial features (as opposed to pose estimations), and used a LSTM-based recurrent neural network (RNN) to extract temporal features and classify behaviors in sequences of frames (Fig. 1o, Extended Data Fig. 2a). Using this framework, allogrooming, sniffing, and self-grooming events can be reliably classified (Fig. 1p, q, Extended Data Fig. 2b-f). To visualize the high-dimensional features in a semi-unsupervised manner, we performed t-distributed stochastic neighbor embedding (t-SNE) on the spatiotemporal features generated from the LSTM layer, and observed an overall separation of allogrooming, sniffing, and self-grooming (Fig. 1r). Thus, allogrooming is associated with characteristic spatiotemporal features that are separable from other social and nonsocial behaviors.

As olfactory cues emitted by stressed individuals can mediate the social transmission of stress in rodents9, we explored whether olfactory cues also play a role in promoting allogrooming toward stressed partners. We transferred olfactory cues from a stressed donor mouse (or a naïve donor as control) to a naïve partner via an anogenital swab. Strikingly, odors transferred from stressed donors led to increased allogrooming by subjects toward partners compared to odors from naïve donors (Fig. 1s), while allogrooming by partners showed no difference (Fig. 1t). This suggests that olfactory cues from stressed individuals can elicit allogrooming from other conspecifics.

Finally, we examined whether this interaction may generate a calming effect in stressed animals. The level of anxiety behavior of stressed partners reunited with subjects was significantly lower than that of the stressed partners that stayed alone (Fig. 1u-w), suggesting that interaction with naïve subjects produces a stress-reducing effect on stressed partners. We next performed a similar experiment but placed a perforated barrier between the animals during reunion (Methods). The presence of the divider abolished the stress-relieving effect, leading to similarly increased stress levels in foot-shocked partners in both the presence and absence of naïve subjects (Fig. 1x). These suggest that the mitigation of stress in partners requires close physical contact between the animals and is not merely due to the presence of naïve subjects in the vicinity. Together, our findings indicate that mice display prosocial comforting behavior toward distressed conspecifics.

Neural dynamics in prosocial interaction

The neural circuits that mediate adult-directed, affiliative social behavior such as prosocial touch remain largely unknown7,10. The MeA is embedded in a highly connected social brain network and receives inputs from the olfactory system11-18 (Extended Data Fig. 3i). Using in vivo microendoscopic calcium imaging, we recorded neural activity of individual MeA neurons during free interaction with unstressed or stressed conspecifics (Fig. 2a-c, Supplementary Video 2). We found that subsets of MeA neurons showed significant responses to unstressed or stressed mice, with a fraction of them responding specifically to unstressed or stressed mice but not both (Fig. 2d, e). Moreover, neural responses toward unstressed and stressed animals could be decoded at the population level (Fig. 2h). Interestingly, neurons activated by stressed conspecifics showed a higher level of activity compared to neurons activated by unstressed conspecifics (Fig. 2f, g, Methods), indicating a different and stronger neural response to stressed conspecifics.

Fig. 2. MeA neural dynamics during prosocial interaction.

Fig. 2.

a, Schematic of microendoscopic imaging. b, Example image showing GCaMP7f expression in the MeA. Scale bar, 100 μm. c, Single neurons extracted in an example field of view. d, Percentages of cells activated by unstressed and/or stressed conspecifics. e, Heatmaps showing average responses of example cells activated specifically by unstressed or stressed conspecifics (but not both) aligned to onset of sniffing toward different conspecifics. f, g, Responses of unstressed or stressed conspecific-activated (but not both-activated) neurons during sniffing of unstressed or stressed animals, respectively (f) and mean ΔF/F (z-scored) during 0–3 s following sniffing onset (g). h, Performance of decoder classification of sniffing toward unstressed versus stressed conspecifics using population activity. i, Percentages of cells responding during allogrooming and/or sniffing and their spatial locations in an example field of view. j, Example calcium traces of allogrooming- and sniffing-activated cells showing increased single-neuron activity during allogrooming or sniffing toward stressed conspecifics. k, Heatmap showing average responses of example allogrooming-activated cells aligned to allogrooming onset. l, Average responses of allogrooming- and sniffing-activated cells during each behavior. m, Decoder prediction of each behavior using population activity overlaid with ground truth. n, Time-courses of decoder performance. o, PC projections of different behavioral events from one example session. Cross lines, mean ± s.d. p, Performance of decoder classification of different behavior pairs. Time 0: behavior onset. f, g, l, n, mean ± s.e.m. Boxplots: median, quartiles, 1.5× IQR, and outliers. ***P < 0.001, *P < 0.05. For details of statistical analyses and sample sizes, see Supplementary Table 1.

We next explored whether allogrooming is encoded by MeA neural activity. While 41% of MeA neurons significantly responded during sniffing behavior (Fig. 2e, i, j, l, Extended Data Fig. 3b, d), 16% of MeA neurons showed significant responses during allogrooming, with 9% responding only to allogrooming but not sniffing (Fig. 2i-l, Extended Data Fig. 3a-d). Neurons that are specifically activated during allogrooming showed minimal response during sniffing and vice versa (Fig. 2l), suggesting that activity changes in allogrooming-responsive neurons are not a general response to social sensory cues but contain an allogrooming-specific component. There is no anatomical clustering of allogrooming- or sniffing-responsive cells (Fig. 2i, Extended Data Fig. 3e). While a fraction of neurons were active during self-grooming (Extended Data Fig. 3f, g), consistent with the role of MeA in self-grooming17, these neurons showed no higher-than-chance overlap with those activated during allogrooming or sniffing (Extended Data Fig. 3h). Using linear decoders, we found that allogrooming, sniffing, or self-grooming could be each predicted from population activity (Fig. 2m), with time-courses that peaked during the execution of behavior (Fig. 2n), suggesting that each behavior is robustly encoded at the population level.

Lastly, we examined whether encoding of allogrooming in the MeA was distinct from encoding of other behaviors which may involve similar sensory cues (sniffing) or motor patterns (self-grooming). Principal component analysis based on neural responses during behavior yielded components that separated different behavior types (Fig. 2o, Extended Data Fig. 4a-d). We confirmed that this separation was insensitive to manual annotation of behavior (Extended Data Fig. 2g, h). Moreover, decoders can discriminate between pairs of behaviors (Fig. 2p, Extended Data Fig. 4f-i), or between all three behavior types (Extended Data Fig. 4e), suggesting that MeA neurons encode allogrooming, sniffing, and self-grooming behaviors in distinct patterns of population activity. Interestingly, population activity around the onset of allogrooming could predict the duration of allogrooming (Extended Data Fig. 4j-n), suggesting a potential causal link between MeA activity and allogrooming behavior.

MeATac1∩Vgat neurons drive allogrooming

GABAergic (Vgat+) neurons in the MeA play important roles in social behavior13,17,18. To determine whether these neurons are essential for native allogrooming, we first performed optogenetic inhibition using GtACR2 during allogrooming toward stressed partners (Fig. 3a-d). Photoinhibition in GtACR2 animals led to a significant reduction in allogrooming duration in an acute, time-locked manner compared to sham or EYFP controls (Fig. 3c, d, Methods). To determine whether MeAVgat neurons are active during natural allogrooming, we recorded Ca2+ dynamics in these neurons using fiber photometry (Fig. 3e). Indeed, MeAVgat neurons showed an elevated Ca2+ signal during allogrooming (Fig. 3f-h). These results support a functional requirement for MeAVgat neurons in natural allogrooming.

Fig. 3. MeATac1 neurons underlie allogrooming.

Fig. 3.

a, e, k, Schematics of GtACR2 inhibition (a, k), fiber photometry recording (e), and ChR2 activation (k) in various MeA subpopulations. b, Example image showing GtACR2 expression in Vgat-Cre animals. Scale bar, 200 μm. c-d, Example raster plots (c) and duration (d) of allogrooming during real and sham photoinhibition (5-s) of MeAVgat neurons in control and GtACR2 animals. f-h, Example heatmaps (f) and average traces (g) showing Ca2+ signal changes aligned to allogrooming bouts and mean ΔF/F following allogrooming onset (h) in GCaMP or EYFP control animals. Time 0: allogrooming onset. i, j, Expression of Tac1, Sst, and Cck mRNAs in the MeA (i) and overlaps between pairs of markers (j). Scale bar, 50 μm. l, m, n, Allogrooming probability (l) and duration (m, n) during activation (15-s) of MeATac1, MeASst, and MeACck neurons in ChR2 animals (l, m) and during real and sham photoinhibition (5-s) of MeATac1 neurons in control and GtACR2 animals (n). l, Blue areas: light illumination duration; time 0: illumination onset. g, j, mean ± s.e.m. Boxplots: median, quartiles, 1.5× IQR, and outliers. ***P < 0.001. For details of statistical analyses and sample sizes, see Supplementary Table 1.

We next asked whether regulation of allogrooming is a general function of the MeAVgat population as a whole or is mediated by one or more select subpopulations. Recent single-cell RNA sequencing studies have uncovered the molecular profile of MeA GABAergic neurons18. These neurons express Sst (somatostatin), but not two other major GABAergic markers in the cortex, Pvalb and Vip18. In addition, they express several other neuropeptide genes, such as Tac1 (tachykinin) and Cck (cholecystokinin)18. Here, we focused on three neuropeptide genes Sst, Tac1, and Cck, which marked three largely separable neuronal subpopulations in the MeA (Fig. 3i, j, Supplementary Note 3).

Interestingly, optogenetic activation of the Tac1+, but not Sst+ or Cck+, population using ChR2 induced allogrooming in both males and females (Fig. 3k-m, Extended Data Fig. 5a-c, g, i-k, o), suggesting that MeATac1 neurons constitute a specific subpopulation that promotes allogrooming. Furthermore, GtACR2-mediated silencing of MeATac1 neurons caused a significant decrease in allogrooming duration compared to controls (Fig. 3n), suggesting that activity of MeATac1 neurons is required for allogrooming.

Activation of MeATac1 neurons, but not the other subpopulations, also elicited self-grooming (Extended Data Fig. 5d-f, h, l-n, p). Previous studies showed that MeA glutamatergic neurons, but not GABAergic neurons, promote self-grooming17. Given that Tac1 is also expressed in a subset of glutamatergic neurons in the MeA18, we hypothesized that the glutamatergic subset of MeATac1 neurons mediates self-grooming, whereas GABAergic MeATac1 neurons promotes allogrooming. To specifically target GABAergic MeATac1 neurons, we applied an intersectional approach wherein we expressed Cre- and Flp-dependent ChR2 (Con/Fon-ChR2) or EYFP (Con/Fon-EYFP) in Tac1-Cre/Vgat-Flp animals (Fig. 4a, d). We confirmed that Con/Fon-EYFP was expressed only in double-positive Tac1-Cre/Vgat-Flp animals but not in single-positive or double-negative animals (Fig. 4a) and that 95% of the cells expressing Con/Fon-EYFP are both Tac1+ and Vgat+ (Fig. 4b, c). Consistent with our hypothesis, activating MeATac1∩Vgat neurons robustly induced allogrooming toward stressed partners in both male and female subjects, but did not elicit self-grooming (Fig. 4e-g, Extended Data Fig. 6a-g, Supplementary Video 3, Supplementary Note 4). While optogenetic stimulations in ChR2 subjects also induced allogrooming toward unstressed partners, the duration of allogrooming was longer when partners were stressed (Fig. 4e, g). These observations suggest that, similar to the increase of natural allogrooming toward stressed conspecifics, allogrooming elicited by optogenetic activation of MeATac1∩Vgat neurons was elevated in the context of conspecific stress (Supplementary Note 5).

Fig. 4. MPOA-projecting MeATac1∩Vgat neurons drive allogrooming.

Fig. 4.

a, Example images of Con/Fon-EYFP expression in the MeA of Tac1-Cre+/Vgat-Flp+ (but not Tac1-Cre/Vgat-Flp+, Tac1-Cre+/Vgat-Flp, or Tac1-Cre/Vgat-Flp) animals. Scale bar, 200 μm. b, c, Example images (b) and quantification (c) showing the overlap between Tac1, Vgat, and Con/Fon-EYFP expression in the MeA of Tac1-Cre+/Vgat-Flp+ animals. Scale bar, 25 μm. d, h, l, p, Schematics of fiber photometry of MeATac1∩Vgat neurons (h) and ChR2 activation of MeATac1∩Vgat neurons (d), of retrogradely targeted MPOA-projecting MeATac1∩Vgat neurons (l), and of axonal projections of MeATac1∩Vgat neurons in the MPOA (p). e, g, Probability (e) and duration (g) of allogrooming toward foot-shocked or unstressed (“sep only”) partners during photostimulation (15-s) in control and ChR2 animals. f, Self-grooming probability during photostimulation in ChR2 animals. ik, Example heatmaps (i) and average traces (j) showing Ca2+ signal changes aligned to allogrooming bouts and mean ΔF/F following allogrooming onset (k) in GCaMP or EYFP control animals. Time 0: allogrooming onset. ms, Allogrooming probability (m, q), duration (n, r), and onset latency (o, s) during soma stimulation (15-s) of retrogradely targeted MPOA-projecting MeATac1∩Vgat neurons (mo) or stimulation (10-s) of axonal projections of MeATac1∩Vgat neurons in the MPOA (qs). e, f, m, q, Blue areas: stimulation duration; time 0: stimulation onset. c, j, mean ± s.e.m. Boxplots: median, quartiles, 1.5 × IQR, and outliers. ***P < 0.001. For details of statistical analyses and sample sizes, see Supplementary Table 1.

To confirm that glutamatergic MeATac1 neurons do not promote allogrooming, we adopted a Cre-on and Flp-off intersectional strategy wherein we expressed ChR2 primarily in Tac1+/Vgat neurons (Extended Data Fig. 7a-c). Activation of these neurons indeed did not trigger allogrooming toward stressed partners but robustly elicited self-grooming (Extended Data Fig. 7d-f).

Lastly, using fiber photometry, we found that MeATac1∩Vgat neurons showed significantly increased activity during natural allogrooming (Fig. 4h-k). In contrast, Sst+ neurons, which do not promote allogrooming, showed no overall increase in activity during allogrooming (Extended Data Fig. 5q, r). Together, these results identify a select subset of GABAergic neurons (Tac1+/Vgat+) in the MeA that underlies allogrooming.

An MeA-MPOA circuit for allogrooming

To explore the downstream circuitry that regulates allogrooming, we examined the axonal projections of MeATac1∩Vgat neurons and observed major projections to the MPOA (Extended Data Fig. 8a, b). To determine whether MPOA-projecting MeATac1∩Vgat neurons play a role in driving allogrooming, we injected a retrograde virus expressing Con/Fon-ChR2 into the MPOA of Tac1-Cre/Vgat-Flp animals and implanted optic fibers above the MeA (Fig. 4l). Stimulating the somas of MPOA-projecting MeATac1∩Vgat neurons led to time-locked induction of allogrooming toward stressed partners in both males and females (Fig. 4m-o, Extended Data Fig. 8c-g, Supplementary Note 4).

We next directly stimulated the axonal terminals of MeATac1∩Vgat neurons in the MPOA through optic fibers implanted above the MPOA (Fig. 4p). This manipulation also elicited allogrooming in both males and females (Fig. 4q-s, Extended Data Fig. 8h-l, Supplementary Video 4, Supplementary Note 4). The evoked allogrooming was unlikely due to activation of collateral projections caused by antidromic activation of MeA somas, as inhibition of MeA cell bodies by intracranial infusion of lidocaine did not reduce the effect of photostimulating MPOA projections on allogrooming (Extended Data Fig. 8m-o). Additionally, while the PMv (ventral premammillary nucleus) also receives projections from MeATac1∩Vgat neurons (Extended Data Fig. 8p), stimulation of this projection produced a minimal effect on allogrooming (Extended Data Fig. 8q).

Previous studies show that activation of MeAVgat neurons evokes attack towards intruder animals in a resident-intruder assay17. When light stimulation was delivered at lower intensities, activation of MeAVgat neurons could promote allogrooming toward distressed familiar partners without eliciting attack (Extended Data Fig. 9a-d, Methods, Supplementary Note 6). Interestingly, stimulation of MPOA-projecting MeATac1∩Vgat neurons (Fig. 4l) did not promote any attack, even at high stimulation intensities. In contrast, activation of Tac1/Vgat+ neurons elicited substantial attack but minimal allogrooming toward stressed partners (Extended Data Fig. 10a-f, Supplementary Note 6). Together, our findings establish a primary role for MPOA-projecting MeATac1∩Vgat neurons in promoting affiliative allogrooming.

Discussion

The ability to engage in prosocial behaviors that benefit others has important implications for the physical and emotional welfare of individuals and groups in humans and other animals. While mice have been shown to exhibit social transmission of emotions such as fear and stress, direct physical interactions between bystanders and distressed animals have rarely been studied9,16,19-21. By demonstrating that mice display prosocial comforting behavior and identifying the MeA as a key node that encodes and drives this behavior, our study provides an entry point for understanding how the MeA interacts with other brain areas involved in empathetic and prosocial processes such as the anterior cingulate cortex1,7,9,10,16,19-21 (Supplementary Note 7). While the MeA was shown to regulate offspring-directed parenting behavior18, we demonstrate that it also plays an essential role in a distinct social context (i.e. adult-directed affiliative behavior; Supplementary Note 8). How offspring- and adult-directed caring behaviors engage similar or distinct circuit mechanisms remains an interesting question for deeper investigations. Our finding that tachykinin-expressing MeA GABAergic neurons promote affiliative allogrooming through the MPOA reveals a previously unknown aspect of functional heterogeneity within MeA neurons and delineate a molecularly and anatomically defined circuitry controlling allogrooming. Given the role of the amygdala in prosocial decision making in primates22, our findings shed new light on how the amygdala regulates prosocial behavior in different species. Insights from these investigations may impact understanding of social cohesion and disconnection, such as in individuals experiencing loneliness or neuropsychiatric conditions.

Methods:

Subjects

For characterization of prosocial interaction in wild-type mice, C57BL/6J males and females were first purchased from Jackson Laboratories (stock No.: 000664) and crossed to generate a breeding colony. 12-16-week-old animals from this colony were used for behavioral experiments. C57BL/6J males purchased from Jackson Laboratories (stock No.: 000664) were used for microendoscopic calcium imaging experiments. For optogenetic and fiber photometry experiments, the following Cre and Flp driver lines were used: VgatCre/+, VgatFlp/+, Tac1Cre/+, SstCre/+, and CckCre/+. All genotypes were first purchased from Jackson Laboratories (stock No: 028862, 029591, 021877, 013044, and 012706) and backcrossed to C57BL/6J to generate a breeding colony. VgatFlp/+ and Tac1Cre/Cre mice were crossed to generate VgatFlp/+; Tac1Cre/+ mice. BALB/cJ males and females were purchased from Jackson Laboratories (stock No.: 000651). Animals used for stereotaxic surgery were 10-12-week-old. Animals were housed in 12 h light-dark cycle (10 p.m. – 10 a.m. light), with food and water available ad libitum. The housing facility had a temperature of 21–23°C and a humidity of 30–70%. All experiments were performed during the dark cycle of the animals in a dark room illuminated by infrared or red light. Care and experimental manipulations of all animals were carried out in accordance with the NIH Guide for Care and Use of Laboratory Animals and approved by UCLA IACUC.

Viruses

AAV1-hSyn1-SIO-stGtACR2-FusionRed (Catalog # 105677-AAV1), AAV1-syn-jGCaMP7f-WPRE (Catalog # 104488-AAV1), AAV1-syn-FLEX-jGCaMP7f-WPRE (Catalog # 104492-AAV1), AAVretro-hSyn-Con/Fon-hChR2-EYFP (Catalog # 55645-AAVrg), AAV5-EF1α-Con/Fon-GCaMP6f (Catalog # 137122-AAV5), and AAVretro-hSyn-HI.EGFP-Cre-WPRE (Catalog # 105540-AAVrg) were purchased from Addgene. AAV5-EF1α-DIO-GCaMP6s, AAV2-EF1α-DIO-hChR2(H134R)-EYFP, AAV5-hSyn-Con/Fon-hChR2(H134R)-EYFP, AAV5-hSyn-Con/Foff-hChR2-EYFP, AAV5-hSyn-Coff/Fon-hChR2(H134R)-EYFP, AAV2-EF1α-FLEX-mCherry, AAV2-EF1α-DIO-EYFP, AAV5-hSyn-Con/Fon-EYFP, AAV5-hSyn-Con/Foff-EYFP, AAV5-hSyn-Coff/Fon-EYFP were purchased from the University of North Carolina vector core. AAV2-EF1α-FLEX-ChR2-nuclear hrGFP was purchased from the University of Pennsylvania vector core.

Stereotaxic surgeries

10-12-week-old animals were anesthetized with isoflurane and mounted on a stereotaxic device (Kopf instruments). Injections were carried out using a pulled, fine glass capillary (WPI). The anatomical coordinates of the MeA were determined based on Paxinos and Franklin’s the Mouse Brain in Stereotaxic Coordinates atlas and previous anatomical studies23,24.

For optogenetic activation and inhibition of MeA cell bodies, viruses were injected bilaterally at ML ±2.15, AP −1.55, DV −5.25 from bregma. Ferrule fiber-optic cannulas (200 μm core diameter, 0.37 numerical aperture; Inper) were placed 0.5 mm above the virus injection sites in the MeA. The type and volume of viruses injected at each site for different experiments are as follows: 400 nL AAV1-hSyn1-SIO-stGtACR2-FusionRed25 for GtACR2 inhibition in VgatCre/+ mice, 450 nL AAV1-hSyn1-SIO-stGtACR2-FusionRed for GtACR2 inhibition in Tac1Cre/+ mice, 300 nL AAV2-EF1α-FLEX-ChR2-nuclear hrGFP for ChR2 activation in Tac1Cre/+ mice, 350-450 nL AAV2-EF1α-DIO-hChR2(H134R)-EYFP for ChR2 activation in SstCre/+ and CckCre/+ mice, 400 nL AAV5-hSyn-Con/Fon-hChR2(H134R)-EYFP26, 450 nL AAV5-hSyn-Con/Foff-hChR2(H134R)-EYFP26, or 300 nL AAV5-hSyn-Coff/Fon-hChR2(H134R)-EYFP26 for ChR2 activation in VgatFlp/+;Tac1Cre/+ mice, 200-250 nL AAV2-EF1α-FLEX-ChR2-nuclear hrGFP for ChR2 activation in VgatCre/+ mice.

For optogenetic activation of the MeA-to-MPOA projection, AAV5-hSyn-Con/Fon-hChR2(H134R)-EYFP was injected bilaterally into the MeA (ML ±2.15, AP −1.55, DV −5.25 from bregma) of VgatFlp/+; Tac1Cre/+ mice with 450 nL at each site. Ferrule fiber-optic cannulas (200 μm core diameter, 0.37 numerical aperture; Inper) were then placed above the MPOA (left side: ML −0.4, AP 0.1, DV −4.75 from bregma; right side, angled 6 degrees, ML 1.0, AP 0.1, DV −4.85 from bregma). For activation of the MeA-to-MPOA projection with inhibition of MeA cell bodies, AAV5-hSyn-Con/Fon-hChR2-EYFP was injected into the MeA as described above and a ferrule fiber-optic cannula was implanted unilaterally into the MPOA (ML 0.65, AP 0.15, DV −5.1 from bregma, angled 12 degrees). A 26-gauge guide cannula for lidocaine injection was implanted above the ipsilateral MeA (ML −2.15, AP −1.55, DV −5.1 from bregma). For activation of the MeA-to-PMv projection, AAV5-hSyn-Con/Fon-hChR2(H134R)-EYFP was injected bilaterally into the MeA (ML ±2.15, AP −1.55, DV −5.25 from bregma) of VgatFlp/+; Tac1Cre/+ mice with 500 nL at each site. Ferrule fiber-optic cannulas (200 μm core diameter, 0.37 numerical aperture; Inper) were then placed above the PMv (left side: ML −0.5, AP −2.4, DV −5.1 from bregma; right side, angled 6 degrees, ML 1.05, AP −2.4, DV −5.25 from bregma).

For retrograde targeting of MPOA-projecting MeA neurons for ChR2 activation, AAVretro-hSyn-Con/Fon-hChR2-EYFP was injected bilaterally into the MPOA (ML ±0.45, AP 0.1, DV −4.85 from bregma) of VgatFlp/+; Tac1Cre/+ mice with 500 nL at each site. Ferrule fiber-optic cannulas (200 μm core diameter, 0.37 numerical aperture; Inper) were then placed above the MeA (ML ±2.15, AP −1.55, DV −4.75 from bregma).

In optogenetic experiments, to avoid situations where the baseline stress level of subject animals is substantially higher than that of partner animals due to surgical procedures, we performed surgical procedures on both animals in a pair. In some pairs partner animals received sham surgery but not fiber implantation, and in other pairs partner animals also received fiber implantation. We did not observe any obvious difference in the effect of optogenetic manipulations in subject animals under these two conditions.

In fiber photometry experiments, AAV5-EF1α-DIO-GCaMP6s27 and AAV1-syn-FLEX-jGCaMP7f-WPRE28 were injected bilaterally into the MeA (ML ±2.15, AP −1.55, DV −5.25 from bregma) of VgatCre/+ and SstCre/+ mice, respectively, with 250 nL at each site. AAV5-EF1a-Con/Fon-GCaMP6f27 was injected bilaterally into the MeA (ML ±2.15, AP −1.55, DV −5.25 from bregma) of VgatFlp/+; Tac1Cre/+ mice, with 400 nL at each site. Ferrule fiber-optic cannulas (200 μm core diameter, 0.37 numerical aperture; Inper) were implanted 0.2 mm above the injection site.

For microendoscopic calcium imaging, AAV1-syn-jGCaMP7f-WPRE28 was injected unilaterally into the MeA at two sites (ML 2.15, AP −1.5 and −1.65, DV −5.3 from bregma) of C57BL/6J mice, with 300 nL at each site. A 0.6-mm (diameter) gradient refractive index (GRIN) lens (6 mm; Inscopix) was implanted above the injection site at ML 2.15, AP −1.6, DV −5.25 from bregma. After three weeks, a base plate was placed on top of the lens. Mice were individually housed after surgery.

For retrograde tracing of the AOB–MeA projection, 250 nL AAVretro-hSyn-HI.EGFP-Cre-WPRE was injected unilaterally into the MeA (ML 2.15, AP −1.55, DV −5.25 from bregma) of C57BL/6J mice.

For examining the expression patterns of Con/Fon-EYFP, Con/Foff-EYFP, and Coff/Fon-EYFP in the MeA, 400 nL AAV5-hSyn-Con/Fon-EYFP or 300 nL AAV5-hSyn-Con/Foff-EYFP or AAV5-hSyn-Coff/Fon-EYFP was injected bilaterally into the MeA (ML ±2.15, AP −1.55, DV −5.25 from bregma) of VgatFlp/+; Tac1Cre/+ mice.

All control animals in this study were animals with the same genetic background injected with EYFP- or mCherry-expressing AAVs.

Proper viral expression and fiber placement in brain areas of interest were confirmed post hoc using histology for all experiments.

Finally, in previous literature the MeA was divided into four anatomical subdivisions: anterodorsal (MeAad), anteroventral (MeAav), posterodorsal (MeApd), and posteroventral (MeApv) subdivisions. With the stereotaxic coordinates used for viral injection in the MeA in the current study (ML ±2.15, AP −1.55, DV −5.25 from bregma), the labeled neurons were predominantly in the MeApd (Fig. 2b, 3b, 4a). The MeApd is outlined in Fig. 2b, 3b, 4a. While different MeA subregions have overall different circuit connectivity and cytoarchitecture13, the precise and definitive spatial boundaries between them have not been well-defined (particularly between anterior and posterior subdivisions). While the effects of our optogenetic stimulations were primarily attributable to neurons in the MeApd, it remains possible that some neurons in the other subdivisions may also be involved in allogrooming behavior.

Prosocial interaction assays

Prosocial interaction following foot-shock

To examine prosocial interactions between mice, we adapted a paradigm previously used in prairie voles7. Same-sex pairs of male and female C57BL/6J mice were co-housed for at least 5 weeks prior to behavioral testing. Pairs of same-sex, co-housed familiar cage mates with small weight differences were used to minimize antagonistic, reproductive, and/or novelty-driven interactions. One animal was randomly assigned as the “subject” and the other as the “partner”. Weight difference between the two mice in each pair was <4% for males and <12% for females. Prior to behavioral testing, animals were extensively habituated to human handling procedures and to the behavior setup for at least three consecutive days. This habituation procedure is important for minimizing the potential influence of stress in subject animals caused by experimental procedures. For the separation-only test (control), the partner was removed from the home cage and placed into a separate cage with beddings from the home cage. After ~12 min, the partner was returned to the home cage to reunite with the subject. For the separation+stressor test, the partner was separated from the subject and transferred to a foot-shock chamber (Med Associates Inc.) in a separate room. The partner then received 20 foot-shocks (0.7 mA, 1s) with a random interval between 20 and 40 s, before being returned to the home cage. Post-separation/stressor behavior was recorded for 13 min. Control experiments (separation-only test) were performed one day before the stress experiments. Behavioral testing was performed in the animals’ home cage to avoid potential stress and/or novelty-related behaviors associated with new environments. The home cage was covered by a cage lid throughout the experiment whenever possible to minimize any perturbations from the environment. All experiments were performed during the dark cycle of the animals in a dark room illuminated by infrared or red light.

We also examined allogrooming behavior after longer separation (2 hours) of unstressed partners and found that there was no significant difference in the total duration of allogrooming by subject animals between 10-min and 2-hour separation groups (n = 10 pairs of male mice, mean ± s.e.m. = 10.5 ± 7.9 s with 10-min separation, mean ± s.e.m. = 27.3 ± 13.8 s with 2-hour separation, two-sided Wilcoxon signed-rank test, P = 0.2031).

Videos from the experiments were manually annotated for different behaviors in a frame-by-frame manner using custom MATLAB code (https://github.com/pdollar/toolbox). Allogrooming was defined as visible licking and/or mouth contact localized on the body trunk, shoulder region, and head of another mouse, during which the actor mouse shows head bobbing indicative of licking motions and frequently holds the recipient with forelimbs for stability (Supplementary video 1). For the quantification of allogrooming bout number and bout duration, consecutive bouts with < 1 s interval between them were considered as one continuous bout. We did not observe barbering (characterized by a type of abnormal, repetitive grooming behavior directed at self or cagemates which involves the plucking and removal of fur, hairs, or whiskers). When the stressed partners received allogrooming, they did not display flinching or escape behavior that is indicative of agonistic interaction (Supplementary Video 1). While allogrooming studied in the current paradigm likely represents an affiliative comforting behavior, it remains a possibility that allogrooming may serve other behavioral and emotional functions (including affiliative, neutral, or even agonistic) in other social contexts and could be related to the animals’ behavioral and/or emotional states and social status.

Prosocial interaction following other types of stressors

Pairs of same-sex C57BL/6J mice co-housed for at least 5 weeks were used for examination of prosocial interaction in response to other types of stressors, including forced swim and acute restraint. The mice were habituated to human handling procedures and to the behavior setup as described above. For evaluating prosocial interaction after the partner experiences forced swim, the partner was separated from the subject for 10 min and then placed into a beaker containing room-temperature (~20-22°C) water. After 5 min, the partner was taken out and thoroughly dried with soft tissues as quickly as possible (within ~1-2 min) before being returned to the home cage. For control, the same partner was separated from the subject for 14 min, placed in water, and then taken out after ~5 s and thoroughly dried. Control experiments were performed one day before the stress experiment. For evaluating prosocial interaction after the partner experiences acute restraint, the partner was separated from the subject, kept in a restrainer for 30 min, and then returned to the home cage. In control experiments, the same partner was placed in a separate cage for 30 min before being returned to the home cage. Control experiments were performed one day before the stress experiments. Subject and partner behaviors were recorded, annotated, and quantified as described above.

For assessing subject-partner interaction after partners experience chronic stress (Supplementary Note 2), one of the mice (“partner”) in each same-sex, co-housed C57BL/6J pair was restrained in a restrainer for 3 hours each day for 10 consecutive days29. During these 10 days, the subjects and partners were single-housed in separate cages, as we found that subject-partner interaction can lead to a reduction of stress in the partners (Fig. 1u-w). On day 11, the partner did not receive any restraint and was placed into the cage containing the subject. In the control group, the mice were separated and single-housed for 10 days without exposing the partners to restraint on each day.

Prosocial interaction following odor transfer

Pairs of same-sex C57BL/6J mice co-housed for at least 5 weeks were used for examination of prosocial interaction in response to odors transferred from a naïve or distressed donor mouse. Mice were habituated to human handling procedures and to the behavior setup for three consecutive days. Odors were transferred by wiping the anogenital area of a third donor mouse (group-housed) with a cotton swab and then wiping the anogenital area of the partner mouse. To habituate the partner and donor mice to the swab procedure, we performed this procedure on three consecutive days before the tests between the naïve donor mouse and the partner mouse. For the “unstressed donor” test, the partner was removed from the home cage and an anogenital swab was performed between the naïve donor and the partner. The partner was then reunited with the subject. For the “stressed donor” test, we subjected the donor to 20 foot-shocks (0.7 mA, 1s) before performing the anogenital swab. Subject and partner behaviors were recorded, annotated, and quantified as described above. The “unstressed donor” experiments were performed one day before the “stressed donor” experiments.

Evaluation of stress-relieving effect of prosocial interaction

To examine the influence of naïve subjects on the stress level of distressed partners, same-sex partners were separated from subjects and exposed to foot-shocks as described above. Partners in the “reunion” group were returned to their home cages and allowed to interact with subjects for 8 min. Partners in the “alone” group were returned to their home cages in the absence of subjects and left undisturbed for 8 min. The partners were subsequently placed in the center of an open field in a square chamber (50 × 50 × 50 cm) and allowed to freely explore the arena for 25 min. Locations of animals (defined as position of the centroid) were tracked using a custom program in MATLAB and were then used to calculate the time spent in the corners (four 12.5 × 12.5 cm areas). Baseline (no separation or foot-shocks) data were collected one day prior to the foot-shock procedures. Each partner in the “reunion” group was tested on the same day as a partner in the “alone” group in a matched manner, to account for potential day-to-day variations in environmental factors that may affect stress level. To assess the stress-reducing effect when naïve subjects and stressed partners are prevented from close physical contact, a perforated barrier was placed in the middle of the cage with the naive subject and the stressed partner on each side during the “reunion” period. For the “alone” group, a perforated barrier was also placed in the middle of the cage with the stressed partner on one side. In Fig. 1u, v, to generate heatmaps of partners’ average occupancy time at different locations in the open field, the open field was divided into 255 × 255 patches of equal area and the time that partners spent within each patch during a 25-min assay was averaged across all partners.

Microendoscopic calcium imaging

Behavior assay

We employed in vivo microendoscopic calcium imaging30,31 of MeA neurons during free interaction with unstressed or stressed conspecifics. Subject mice were habituated to human handling procedures, the microendoscope, and the behavior setup for at least 3 days before experiments. During each imaging session, individual same-sex C57BL/6J mice (naïve or stressed with 20 foot-shocks at 0.7 mA, 1s, with a random interval between 10 and 20 s) were placed into the home cage of the subject animals. The two animals were allowed to freely interact for 5–10 min. Each subject animal was presented with 2–6 unstressed and 2–6 stressed conspecifics during each imaging session. We performed 7 independent imaging sessions in 6 subject animals. All subject animals were each imaged in one independent session, except for one animal that was imaged in two independent sessions at different focal planes. Calcium fluorescence videos and behavior videos were simultaneously recorded using a microendoscope (UCLA Miniscope V4, purchased from Open Ephys; https://github.com/Aharoni-Lab/Miniscope-DAQ-QT-Software) and a video camera, respectively. The microendoscopes were connected to a digital acquisition device (DAQ) through a flexible, ultra-light coaxial cable. Behavior videos were annotated by a human annotator frame by frame to identify onset and offset times of behaviors exhibited by the subject animals.

Extraction of calcium signals

Calcium fluorescence videos were recorded at 30 Hz. Raw videos from each imaging session were processed using an integrated Miniscope Analysis package (https://github.com/etterguillaume/MiniscopeAnalysis). Briefly, raw videos were first processed using the NormCorre algorithm (https://github.com/flatironinstitute/NoRMCorre)32 for motion correction. Motion corrected videos were then processed using Constrained Non-Negative Matrix Factorization (CNMF-E, https://github.com/zhoupc/CNMF_E)33 to isolate cellular signals and associated regions of interest (ROI). ΔF/F calcium traces of individual cells were z-scored and presented throughout in units of standard deviation (s.d.) prior to downstream analysis. As CNMF-E can identify fluorescence changes from non-neuronal sources, such as motion artefacts or neuropil signals, we manually inspected extracted ROIs and traces to remove ROIs that lacked a soma-like shape and/or showed signs of motion artefacts in their traces. We obtained a total of 336 neurons from 7 independent imaging sessions in 6 subject animals.

Analysis of single cell response during behavior

An ROC (receiver operating characteristic) analysis31,34 was used to identify neurons that significantly respond during each type of behavior event. A binary threshold was applied to the ΔF/F signal to classify each time point as showing or not showing a particular behavior. The true positive rate and false positive rate of behavior detection were calculated over a range of binary thresholds spanning the minimum and maximum values of the neural signal and used to construct an ROC curve that describes how well the neural signal detects behavior events at different thresholds. The area under the ROC curve (auROC) was then calculated as a measure of how strongly neural activity was modulated by each behavior. The observed auROC was compared to a null distribution generated by circularly permuting the calcium signals by a random time shift 1000 times. A neuron was considered significantly responsive (α < 0.05) if its observed auROC value exceeded the 95th percentile of this null distribution (activated if auROC > 97.5th percentile or suppressed if auROC < 2.5th percentile). Note that “suppressed” cells defined using this method do not necessarily exhibit an immediate decrease of activity at the onset of behavior, but display an overall negative correlation with the corresponding behavior. In Fig. 2i, among all allogrooming-responsive neurons, 69.6% were activated and 30.4% were suppressed; among all sniffing-responsive cells, 63.0% were activated and 37.0% were suppressed. This ROC analysis was separately performed for each type of behavior event and cells identified as responsive to more than one type of behavior were defined as the “mixed” group in Fig. 2d, i.

To quantify average cell responses during different types of behavior (Fig. 2e, f, k, l, Extended Data 3c, d, g), activity of individual cells during each behavior bout was aligned to behavior onset (time 0) and averaged across all behavior bouts within each imaging session. The values of activity change were derived by subtracting the baseline activity, which was calculated as averaged activity over a 2-s time window between 5 s and 3 s before behavior onset. Fig. 2f shows average responses of cells activated by unstressed, but not stressed, conspecifics during sniffing of unstressed animals (blue curve) and of cells activated by stressed, but not unstressed, conspecifics during sniffing of stressed animals (orange curve). Fig. 2l shows average responses of cells activated during allogrooming but not sniffing (left) and cells activated during sniffing but not allogrooming (right) during allogrooming (pink curves) and sniffing (green curves) events.

Analysis of population dynamics during behavior

To analyze the relationship between population activity and behavior, we first performed principal component analysis (PCA) on activity traces recorded from prosocial interaction sessions. Projection of population activity from individual sessions onto the top principal component yielded traces that appeared to be modulated during social interaction (Extended Data Fig. 4a). To examine the dynamics of dominant activity components during social interaction, we averaged PC1 projections around the onset of sniffing and allogrooming behavior across all behavior trials in all sessions. This trial–averaged response showed a clear time-locked increase in activity during social interaction (Extended Data Fig. 4b). Finally, to quantify the information contained in PC1 dynamics about social interaction, we asked how well this component alone could be used to decode behavior. We constructed ROC curves to measure, in each session, the relationship between social interaction events and PC1 activity, and used the area under this curve (auROC) as a performance metric. We found that auROC based on real data was significantly higher than that determined based on circularly permuted behavior vectors (control) (Extended Data Fig. 4c). These results suggest that encoding of social interaction is saliently embedded in the dominant component of MeA neuronal dynamics.

To analyze the separation of population vectors associated with different types of behavior (allogrooming, sniffing, and self-grooming), we used PCA of trial-averaged neural responses during behavior (within each independent session) to identify neural components that capture variability in the mean population response. To visualize the separation of population activity on these components, we projected activity during behavior events onto the top two components (see one example session in Fig. 2o). We next sought to quantify the clustering of population activity patterns associated with individual behavior events by event type. For each session, we computed the average pairwise Euclidean distance between PC projections (on the top two PCs) of trial activity within a behavior category, as well as the average pairwise distance between projections across behavior categories. We compared these “within-group” distances with “between-group” distances for each pair of behaviors. Larger between-group distances indicate that activity associated with behavior events is clustered by event type, suggesting a separation of population activity patterns by behavior type in PC space. PCA was performed using either manual behavior annotations (Fig. 2o, Extended Data Fig. 4d) or deep learning-based behavior annotations (Extended Data Fig. 2g,h; see the “behavior analysis using deep learning” section below) and revealed similar patterns of separation between population activities associated with different behaviors.

For behavior decoder analyses, Support Vector Machine (SVM) models were used to determine the hyperplanes that best separate population vectors associated with behavior events vs. baseline activity (single-behavior decoders, Fig. 2m, n), or between distinct types of behavior (between-behavior decoders, Fig. 2h, p, Extended Data Fig. 4e, i).

For binary between-behavior decoders in Fig. 2h, p, decoder performance was computed independently for each session using a leave-one-out cross-validation (LOOCV) procedure. For each session, the mean population activity associated with a behavior event was considered as a sample, and samples were taken for all instances of each of two behavior types. For each validation fold, one sample was held-out for testing, and the remaining samples were used for training. Any samples that fell within a time window (3 minutes in Fig. 2h, 1 minute in Fig. 2p,) of the test sample on a given fold were removed from the training set for that fold. Representation of training samples for each group was equalized on each fold by uniformly upsampling the group with fewer samples. For each fold, an SVM model was constructed using the training set and a prediction score was computed for the held-out sample. Finally, all prediction scores from all validation folds were compared with ground truth sample labels using an ROC curve, and the area under this curve (auROC) was taken as the final performance metric. Chance performance was measured for each session by performing the same exact procedure, but first circularly permuting the activity trace for each neuron.

For decoder projections in Fig. 2m, single-behavior decoders were constructed using samples of neural activity during behavior and samples of baseline activity (5-second intervals during which sniffing, allogrooming, and self-grooming were not observed). To obtain a projection over a continuous interval of test data, an entire session was split into two continuous 90% and 10% intervals. The samples contained in the 90% interval were used for SVM analysis to obtain the decoder hyperplane, and the held-out 10% data was then projected onto the component normal to this plane to obtain a continuous projection. Decoder predictions that exceeded the prediction threshold were colored in example traces shown in Fig. 2m to be visually compared with ground truth labels.

For behavior decoder time-courses (Fig. 2n, Extended Data Fig. 4i), single-behavior (Fig. 2n) or between-behavior (Extended Data Fig. 4i) SVM decoders were trained and tested using population activity at different time points relative to the true behavior onset time. At each time point relative to behavior onset (ranging from 30 seconds before to 30 seconds after behavior with 1-s interval), samples of population activity at that time point (averaged activity between 0.5 s before and 0.5 s after that time point) were taken (along with samples of baseline activity for Fig. 2n), and 20-fold cross validation was used to measure decoder performance. To eliminate potential contamination of activity in test samples by other neighboring events, events of the same behavior type that occurred within 2 minutes of any test data were removed from the training set for each fold. Representation of training samples for each group was equalized on each fold by uniformly upsampling the group with fewer samples. Time-courses for shuffled decoders were computed using randomly circularly permuted activity traces. As the performance of these decoders was close to chance level before behavior onset, did not peak until after behavior onset, and remained above chance level several seconds afterwards, the distinct patterns of population activity associated with different behaviors was unlikely due to differences in behavioral events prior to behavior onset (Extended Data Fig. 4f-h).

For the 3-way multi-class decoder (Extended Data Fig. 4e), the procedure was similar to that for the binary between-behavior decoders in Fig. 2h, p, except that samples from all three behavior types (allogrooming, sniffing, and self-grooming) were used in the training set. On each validation fold, one sample was held out, the remaining samples (outside of a 1-minute window from the held-out one) were equalized, a multi-class SVM model was constructed using the training data, and behavior identity (class label) was predicted for the held-out sample. Accuracy for each session (the overall fraction of correctly predicted group labels) was used as a performance metric and was compared with that of decoders constructed using circularly permuted activity traces.

For prediction of short vs. long allogrooming bouts using neural activity (Extended Data Fig. 4j, k), PC projections of neural activity within each session were pooled across sessions to construct one decoder. In order to pool samples of population activity across sessions, we transformed the population data into a common space of components that were shared across all sessions. To this end, we computed the trial-averaged dynamics for each neuron for each behavior type (sniffing, allogrooming, and self-grooming) and concatenated these across sessions. PCA of this cross-session neural activity matrix yielded components that capture the shared trial-averaged dynamics during similar behavior events. Population activity within each session was then projected onto the top 12 shared components. For each allogrooming bout across all sessions, we extracted 24 measures of population activity around behavior onset: projection onto the top 12 PCs averaged over the 3 seconds prior to behavior onset, and projection onto those same components averaged over the 3 seconds following onset. Samples of these activity measures across allogrooming bouts from all sessions were concatenated, and SVM was used to find a hyperplane that separates short (≤5 seconds) vs. long (>5 seconds) allogrooming bouts. LOOCV and an ROC curve comparing predicted bout lengths with ground truth were used to measure the decoder performance (Extended Data Fig. 4j), and these were compared to control decoders using circularly permuted activity traces (Extended Data Fig. 4k). To increase statistical power, this analysis also included baseline allogrooming bouts exhibited during interaction with unstressed animals, in addition to allogrooming behavior toward stressed animals. All the other analyses in Fig. 2i-p, Extended Data Fig. 3a-h, 4a-i specifically examined subject behaviors during prosocial interaction with stressed animals.

Behavior analysis using deep learning

To characterize allogrooming behavior in a more quantitative manner, we examined whether allogrooming contains unique and characteristic spatial and temporal features that can be reliably recognized using machine learning methods (Fig. 1o-r, Extended Data Fig. 2a-f). Previous machine learning analysis of behavior was primarily based on body and pose tracking35-39, but as both allogrooming and conspecific sniffing involve close-range interactions that lead to occlusion between animals, individual body parts are not reliably trackable (especially when animals have the same coat color), rendering the analysis of fine behavioral features difficult. To extensively capture spatial features that are relevant to behavior, we implemented a deep convolutional neural network (CNN) model (Google Inception v3)40,41 that was pre-trained on a large image dataset consisting of 1.2 million images (ImageNet). We implemented the Google Inception v3 model in Python (v3.5.6) using the TensorFlow package (v1.11). Using this network, we extracted 2048 spatial features from each frame in an unsupervised manner (without training the CNN on the current dataset). Behavior videos recorded during microendoscopic imaging experiments were used for this analysis, as this allowed us to collect head orientation information through a high-precision gyroscope attached to the microendoscope and to compare model performance using different behavioral features (see below). Videos were recoded using a 2.0 megapixel USB camera (ELP) at 30 fps with 640 × 320 pixel image size from a side view. The videos were annotated by an experienced human annotator to identify each frame as one of the four behavior classes–allogrooming, sniffing, self-grooming, or other behavior, and this was used as ground truth for model training and evaluation.

To further evaluate whether the CNN comprehensively captures behaviorally relevant features, we sought to extract additional tracking-based features such as location and pose as well as head orientations. To extract spatial features based on animal and pose tracking, we used the SLEAP software42. Because the animals are of the same color and because allogrooming and sniffing involve close-range interactions between the animals that lead to substantial occlusion, reliable tracking of fine body parts (e.g. heads, ears, snouts, paws) was not feasible. Instead, we tracked the body locations of the subject animals and the partners as well as the position of the head-mounted microendoscope as a proxy of the head location of the subject animals. From these values, we further calculated distance between the subject’s head and the partner’s body, distance between the bodies of the two animals, and speeds of both animals. To acquire head orientation and rotation features that capture fine head movement in three-dimensional space, we utilized a high-precision three-axial gyroscope (BNO055, Bosch Sensortec) attached to the microendoscope on the subject animals during microendoscopic imaging. Raw quaternions measuring three-axial orientations were recorded with high temporal precision (30 Hz). Quaternions were then converted to Euler angles at each time point. From these values, we further calculated the changes of Euler angles of each of the three axes and angular velocity of the D-V axis of the head at each time point.

To extract temporal features in sequences of frames and to classify behaviors based on their spatiotemporal patterns, we constructed a LSTM (long short-term memory)-based RNN model43,44 in Python using the TFLearn module in TensorFlow. We passed CNN-derived features, tracking-based features, head orientation-based features, or all of the above to the RNN model. Our model comprises an input layer, a LSTM layer with 256 nodes, followed by a fully connected softmax layer and a final regression layer. We also explored other RNN structures, including one LSTM layer with 128 or 512 nodes and two LSTM layers with 128 nodes each, and found that the current structure achieved the highest performance. To generate temporal sequences for RNN training and testing, we down-sampled the videos to 15 fps and used a custom Python script to generate 30-frame (2 s) sequences with a shift of seven or more frames between adjacent sequences. We divided the whole dataset into training, validation, and test sets (80%, 10%, and 10% of the data, respectively) and assigned sequences generated from different segments of the videos as training and test sets such that there was minimal temporal overlap between the two sets. To generate shuffled data as control, we randomly permuted the behavior labels of the sequences. During training, the Adam optimization algorithm was used for gradient descent. Prediction accuracy on the validation set was evaluated during training to prevent over-fitting. Models using CNN-derived features or all three types of features were trained for 75 epochs, at which point validation accuracy plateaued. Models using tracking-based or head orientation-based features reached optimum performance after 20 and 10 epochs, respectively; further training led to a decrease in validation and test performance, indicating over-fitting.

We trained binary classifiers to discriminate between pairs of behavior classes (Fig. 1p, Extended Data Fig. 2b-e) and multi-way classifiers to discriminate between all four behavior classes (Extended Data Fig. 2f). To evaluate the performance of the models, we calculated the F1 score as follows, which takes into account both the precision and recall of prediction:

F1=2×precison×recallprecison+recall

We performed 10-fold cross-validation and compared the distribution of F1 scores between different models. For the four-way classifier, we calculated averaged F1 scores across all four classes. We found that using tracking- or head orientation-based features alone led to a lower classification performance compared to using CNN-derived features, and combining CNN-derived features with tracking and head orientation achieved a performance similar to that of CNN features alone (Extended Data Fig. 2f). This suggests that unsupervised features extracted from the CNN contain rich information that is not further augmented by tracking and head orientation features.

To perform t-SNE embedding of spatiotemporal features of different behavior types (Fig. 1r), we first performed principal component analysis using the fast.prcomp function in the gmodels R package. PCs 1–30 were then used as input for t-SNE to generate a two-dimensional non-linear embedding using the Rtsne function in the Rtsne R package, with 1,000 iterations and a perplexity parameter of 30.

Optogenetics Experiments

Following stereotaxic surgeries, the viruses were allowed to incubate for 4–7 weeks before behavioral testing. Prior to an experiment, a ferrule patch cord was coupled to the ferrule fiber implanted in the subject mouse using a zirconia split sleeve (Doric Lenses). Optic fibers were connected using an FC/PC adaptor (Doric Lenses) to a 473-nm blue laser (CNI Laser). An Arduino micro-controller board and a customized MATLAB program were used to control laser pulses. The partner was separated from the subject and exposed to foot-shocks as described above before being reunited with the subject.

In GtACR2 inhibition experiments, blue (473 nm) light was delivered continuously for 5 seconds at an irradiance of ~8–10 mW mm−2 in the target region when the subject exhibited spontaneous allogrooming toward the stressed partner. Real and sham light illumination was manually triggered alternately but no light was delivered during sham trials. Male subjects were used for the inhibition experiments, as they provided a relatively high level of allogrooming toward stressed partners for assessing the suppressing effect of light illumination.

Initial optogenetic screening of MeA neuronal subpopulations (Fig. 3k-m, Extended Data Fig. 5a-p) using different Cre driver lines (Tac1Cre/+, SstCre/+, and CckCre/+) was done with 15–20 ms 473 nm pulses at 15–20 Hz for 15 s, at an irradiance of ~6–10 mW mm−2 in the target region. In this initial screening, a same-sex BALB/cJ animal was used as a target animal. Tac1+, Sst+, and Cck+ neurons constitute 18.4%, 16.1%, and 9.1% of MeA GABAergic neurons, respectively, based on single-cell RNA-seq data (GEO: GSE124061)18,45. These Cre lines were generated by knocking Cre into the endogenous loci of the corresponding genes and were previously validated to recapitulate their endogenous expression patterns46-48.

The effect of soma stimulation in VgatFlp/+;Tac1Cre/+ animals injected with Con/Fon-ChR2 or Coff/Fon-ChR2 was assessed in the presence of stressed partners (Fig. 4e left, f, Extended Data Fig. 6a-g, 10d-f) or unstressed partners (Fig. 4e right) using 473 nm, 7–15 ms pulses at 7–15 Hz for 15 s, at an irradiance of ~4–6.5 mW mm−2 in the target region. Under the same stimulation conditions, activation of Tac1+/Vgat+ neurons elicited allogrooming but not attack toward stressed partners (Fig. 4e, g) whereas activation of Tac1/Vgat+ neurons elicited a substantial level of attack but minimal allogrooming (Extended Data Fig. 10d-f, Supplementary Note 5).

Soma stimulation in VgatFlp/+;Tac1Cre/+ animals injected with Con/Foff-ChR2 (Extended Data Fig. 7d-f) was performed using 20 ms 473 nm pulses at 20 Hz for 15 s, at an irradiance of ~12 mW mm−2 in the target region. The effect of stimulation was assessed both in the presence and absence of stressed partners (data presented in Extended Data Fig. 7d-f were from experiments with stressed partners). We observed a robust induction of self-grooming in both contexts and did not observe any notable difference in the behavior induced between the two contexts.

We observed axonal projections of MeATac1∩Vgat neurons in the MPOA and PMv (Extended Data Fig. 8a, b, p), consistent with previous characterizations of projection targets of MeA neurons in general23,49. Stimulation of MPOA projection in VgatFlp/+;Tac1Cre/+ animals (Fig. 4p-s) was performed using 10 ms 473 nm pulses at 20–40 Hz for 10 s, at an irradiance of ~8 mW mm−2 in the target region. Stimulation of PMv projection in VgatFlp/+ Tac1Cre/+ animals (Extended Data Fig. 8q) was performed using 10 ms 473 nm pulses at 50–60 Hz for 10 s, at an irradiance of ~10–15 mW mm−2 in the target region. Soma stimulation through retrograde targeting in VgatFlp/+;Tac1Cre/+ animals (Fig. 4l-o) was performed using 20 ms 473 nm pulses at 20 Hz for 15 s, at an irradiance of ~9–12 mW mm−2 in the target region. This stimulation did not promote any attack behavior, even at these relatively high stimulation settings. Additionally, partners did not show obvious flinching behavior when they received allogrooming from subject animals, consistent with an affiliative nature of the stimulation-evoked allogrooming.

For activation of the MeA-to-MPOA projection with inhibition of MeA cell bodies using lidocaine50 (Extended Data Fig. 8m-o), stylets were removed from the guide cannulas before behavioral assays and 10 μg lidocaine (20 mg/mL in saline, injection volume 500 nL) was injected with a 26-gauge needle into the MeA immediately before the behavior assay. Injection needles remained in place for an additional 2 min before being removed and replaced immediately with stylets.

In ChR2 activation experiments in VgatCre/+ animals, we found that high stimulation intensity (20 ms 473 nm pulses at 20 Hz for 15 s, at an irradiance of ~9 mW mm−2 in the target region) elicited attack behavior, as has been previously reported17 (data not shown). At lower stimulation intensity (7–15 ms 473 nm pulses at 7–15 Hz for 15 s, at an irradiance of ~4–6.5 mW mm−2 in the target region), light stimulation was able to trigger allogrooming without inducing attack toward stressed partners in 5/6 male mice and 7/9 female mice (Extended Data Fig. 9b). To examine the effect of low-intensity photostimulation of Vgat+ neuron during interaction with unfamiliar intruders, we introduced an unfamiliar C57BL/6J male intruder into the home cage of the subject animal. The behavioral effects of photostimulation during interaction with stressed partners or unfamiliar intruders were compared in the same subject animals with the same stimulation parameters (Supplementary Note 6).

In ChR2 activation experiments, we found that the duration of triggered allogrooming was higher when subject animals were in the vicinity of and attending to the partners compared to that across all stimulations (Extended Data Fig. 9d). Quantifications presented in all the other figures were based on laser stimulations that were delivered when subject animals were in the vicinity of (within half a body-length) and attending to the partners or intruders. Light stimulations were delivered during periods when subject animals did not exhibit high levels of spontaneous allogrooming or other behaviors of interest.

Behaviors and stimulation bouts in optogenetic experiments were annotated in a frame-by-frame manner by an experienced human annotator. To calculate the probability of showing a particular behavior at different time points relative to the onset of light illumination (Fig. 3l, 4e, f, m, q, Extended Data Fig. 5a-f, i-n, 6a, d, 7d, e, 8m, n, 10d, e), trials from all animals were aligned to the onset of light illumination and the fraction of trials showing a particular behavior at a given time point (30 time points per second) was calculated as the probability of showing that behavior. Duration of behavior was calculated as the total amount of time animals spent on a particular behavior during the period of light illumination or sham manipulation (Fig. 3d, m, n, 4g, n, r, Extended Data Fig. 5g, h, o, p, 6b, e, g, 7f, 8d, f, i, k, o, q, 9b-d, 10f). For trials during which allogrooming did not occur, onset latency was calculated as the length of the stimulation (Fig. 4o, s, Extended Data Fig. 6c, f, 8e, g, j, l).

Fiber photometry

Following stereotaxic surgeries, the viruses were allowed to incubate for ~4 weeks before recording experiments. Fluorescence signals were acquired with a fiber photometry system (Doric Lenses Inc, Quebec). The analog voltage signals were digitalized and recorded by a Micro 1401 digitizer (CED, Cambridge, UK) using the Spike2 software (v10.09a). The LED power was adjusted at the tip of the optical fiber to ~5–10 μW. A ferrule patch cord was connected to the ferrule fiber implanted in the subject mouse using a zirconia split sleeve (Doric Lenses). The partner was separated from the subject and exposed to foot-shocks as described above. Recording was started immediately before the stressed partner was reunited with the subject. Photometry data were exported to MATLAB files for further analysis. Behavior was recorded, annotated frame-by-frame, and aligned to calcium signals. The values of fluorescence change (ΔF/F) were derived by calculating (FF0)/F0, where F0 is the baseline fluorescence signal averaged over a 0.5-s time window between 1 s and 0.5 s before each behavior bout. ΔF/F values were presented with mean plots with a shaded area indicating s.e.m. (Fig. 3g, 4j, Extended Data Fig. 5q). Consecutive allogrooming bouts with <1 s interval between them were considered as one continuous bout. Allogrooming bouts that lasted for at least 2 s were used for analysis. We also calculated mean ΔF/F values during the entire allogrooming bout (if bout duration ⩽ 5 s) or the first 5 s after behavior onset (if bout duration > 5 s) (Fig. 3h, 4k, Extended Data Fig. 5r). The aforementioned methods were applied for both GCaMP and EYFP groups. To assess whether there may be a habituation of MeA neural activity during allogrooming over the course of a recording session, we divided allogrooming bouts within each recording session in MeAVgat neurons into three groups based on their temporal order (the first, second, and last thirds of all bouts). We found no significant difference in mean AUC between these three groups (n = 6–16 allogrooming bouts in each group, mean ± s.e.m: 5.7 ± 1.6%, 5.3 ± 2.8%, and 8.5 ± 3.8%, Kruskal-Wallis test, P = 0.7239), suggesting that there was no overall decay in MeAVgat neuron activation during allogrooming over time.

Histology

Animals were sacrificed and perfused with 4% PFA. The brains were dissected out and fixed in 4% PFA for 2 hours at room temperature, rinsed with 1X PBS, then placed in 30% sucrose overnight at 4°C. 60 μm sections were cut on a Leica CM1950 cryostat. Images were acquired using a Leica DM6 B microscope or a confocal microscope (Zeiss LSM 880).

Fluorescent mRNA in situ hybridization and immunohistology

To examine the expression of different genes in different MeA neuronal subpopulations (Fig. 3i, j, 4b, c, Extended Data Fig. 7c, 10c), we performed mRNA in situ hybridization and immunohistology. In situ hybridization was performed on fixed brain tissues using the RNAscope technology (ACDbio, Catalog #323110). Mice were perfused with PBS and 4% PFA. Brains were post-fixed in 4% PFA for 8 hours at 4 °C and then dehydrated in 20% sucrose overnight. 14-micrometer sections were obtained using a cryostat and kept at −80°C before use. The staining procedures were performed according to the manufacturer’s protocols for fixed-frozen tissue sample with some modifications. For co-staining of Tac1, Cck and Sst, the tissue was digested with protease III for 15 min at 40 °C. For the combination of RNAscope with immunostaining, the tissue was target retrieved for 5 min using the co-detection target retrieval buffer and treated with protease plus for 11 min at 40 °C to reduce over-digestion of antigen in EYFP. The immunostaining of EYFP was performed after RNAscope procedures, but before DAPI staining. Briefly, the tissue was incubated with a rabbit anti-GFP antibody (Invitrogen, Catalog # A-11122) diluted at 1:500 in a co-detection solution (ACDbio, Catalog # 323180) at 4 °C overnight after RNAscope staining and then washed with PBST three times and incubated with a donkey anti-rabbit IgG secondary antibody (1:500 dilution, Invitrogen, Catalog # A-21206) for 2 hours at room temperature. Finally, sections were stained with DAPI for 40 s and mounted with 70% glycerol. Images were acquired using Zeiss LSM 880 at 20× and analyzed using QuPath51 according to instructions from ACDbio. Briefly, for the co-staining of Tac1, Cck and Sst, the DAPI channel was used to segment cell nuclei. A cell was classified as positive for a particular mRNA transcript if it contains > 4 fluorescent puncta for the corresponding probe. In Fig. 3j, the fraction of overlap between a particular pair of markers is defined as the fraction of double-positive cells within all cells that are positive for either of the two markers. Because of strong EYFP signals in the neurites, cell bodies with EYFP signals were manually identified and marked in QuPath. A cell was considered as positive for Tac1, Vgat or Vglut2 if it contains >4 fluorescent puncta for the corresponding probe (Fig. 4b, c, Extended Data Fig. 7c, 10c). Probes used in this study include Tac1 (Mm-Tac1-T3), Cck (Mm-Cck-C3), Sst (Mm-Sst-C4), Vgat (Mm-Slc32a1-C2), and Vglut2 (Mm-Slc17a6-C2).

Due to the design strategy of the Con/Fon-ChR2-EYFP viral construct26, intermediate mRNA molecules are transcribed from the viral construct prior to Cre- or Flp- mediated recombination. While these intermediate mRNA molecules do not express functional ChR2 and EYFP proteins, they contain part of the sequences that are recognizable by the same hybridization probes for the functional ChR2 or EYFP mRNAs. Consequently, immunohistology for the functional protein product was required for detecting the proper expression of the full-length, functional mRNA transcript following Cre- or Flp-mediated recombination. Moreover, as ChR2 proteins are primarily localized to membranes, their expression in cell bodies is difficult to be visualized. We therefore used the corresponding Con/Fon-EYFP viral construct to perform simultaneous in situ hybridization for Tac1 and Vgat mRNAs and immunohistology for EYFP proteins (Fig. 4b, c). For the same reasons, we used Con/Foff-EYFP (Extended Data Fig. 7c) or Coff/Fon-EYFP (Extended Data Fig. 10c) viral constructs to examine the co-localization of EYFP with Tac1, Vgat, or Vglut2 in Tac1Cre/+/VgatFlp/+ animals. Mice were perfused for in situ hybridization and/or immunohistology ~2–3 weeks after virus injection. The Cre-on/Flp-off virus used in the current study has been reported to lead to residual expression in a minor fraction of Cre+/Flp+ cells, possibly due to insufficiency of Flp relative to Cre26,52. Similarly, we found that when using this virus, the majority of EYFP+ cells (64.0 ± 1.8%, mean ± s.e.m.) were glutamatergic (Vglut2+).

Statistics and reproducibility

All statistical analyses were conducted using Prism (v9, GraphPad), MATLAB (R2018a and R2019b, MathWorks), R (v3.4.3), or Python (v3.5.6). Statistical tests used in this study include Wilcoxon rank-sum test, Wilcoxon signed rank test, t test, Kolmogorov-Smirnov test, Kruskal-Wallis test, Friedman test, one-way ANOVA, and two-way repeated measures ANOVA. When parametric tests were used, data normality and homogeneity of variances were confirmed using Shapiro-Walk Normality test and Levene’s test, respectively. P values were corrected for multiple comparisons when necessary. Bar plots show mean ± s.e.m. In boxplots, center lines indicate median, box limits indicate upper and lower quartiles, whiskers indicate data within 1.5× interquartile range, and dots indicate data points outside 1.5× interquartile range (except in Extended Data Fig. 5k, where whiskers indicate the 2.5th and 97.5th percentiles and dots indicate data points outside this range). The significance threshold was held at α = 0.05 (ns, not significant (P > 0.05); *P < 0.05; **P < 0.01; ***P < 0.001). More detailed information for all statistical analyses (including sample sizes, types of statistical test, test statistics, and exact P values when P > 0.0001) presented in Main and Extended Data figures is provided in Supplementary Table 1. All behavioral, imaging, and optogenetics experiments were replicated in multiple subject animals with similar results (see Supplementary Table 1 and figure legends for exact n numbers of animals and/or trials for each experiment). Example micrographs (Fig. 2b, 3b, i, 4a, b, Extended Data Fig. 3i, 7c, 8a, b, p, 10c) show representative results based on at least three independent biological samples (animals or independently injected brain hemispheres). Sample sizes were not predetermined using statistical methods. Experiments were randomized whenever possible. Experimenters were not blind to group allocation.

Extended Data

Extended Data Fig. 1. Characterization of prosocial allogrooming in female mice.

Extended Data Fig. 1.

a, Example raster plots showing allogrooming and self-grooming behaviors exhibited by female subjects when they interact with unstressed (separation only, control) or stressed (foot-shocked) female partners. Each row represents an individual animal. b, Time-course of cumulative duration of allogrooming exhibited by subjects and partners after partners experience foot-shocks. Mean ± s.e.m. c, d, Total duration (c) and onset latency (d) of allogrooming exhibited by subjects toward unstressed (control) or foot-shocked partners during 13 min of interaction. While females exhibit elevated allogrooming toward stressed partners similar to males, the total duration of allogrooming toward stressed partners is shorter in females compared to males (Fig. 1d, Supplementary Note 1). e, f, Total number of allogrooming bouts (e) and average per-bout duration of allogrooming (f) in individual subjects interacting with unstressed (control) or foot-shocked partners. g, Total duration of self-grooming exhibited by subjects during interaction with unstressed (control) or foot-shocked partners. h, i, Total duration of allogrooming (h) and total number of social approaches (i) toward subjects exhibited by partners after separation only or foot-shocks. Boxplots: median with quartiles, 1.5 × IQR and outliers. b-i, n = 10 pairs of female mice. Two-sided Wilcoxon signed-rank test. **P < 0.01, *P < 0.05. ns, not significant. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 2. Behavioral analysis using convolutional and recurrent neural networks.

Extended Data Fig. 2.

a, Schematic of behavior classification using recurrent neural network (RNN) based on CNN-derived spatial features, tracking-based features, and/or head orientation-based features. be, Performance of binary classifiers trained to discriminate between different pairs of behaviors using the CNN + RNN framework. f, Comparison of performance of four-way multi-class classifiers trained to discriminate between allogrooming, sniffing, self-grooming, or other behaviors. Different classifiers used CNN-derived spatial features, tracking-based features, head orientation-based features, or all three types of features to train the recurrent neural network. Data for the “CNN features” and shuffled control groups are the same as those in Fig. 1q and are presented here for comparison. g, PC projections of population vectors associated with different types of behavior bouts from one example microendoscopic imaging session. PCA is first performed using population activity during manually annotated behavior bouts (dots). Population activity during behavior bouts predicted using the CNN-RNN method (circles) was then projected onto this PC space. h, Mean pairwise Euclidean distances (in a space defined by PCs 1-4) between different pairs of behavior events that were either human annotated (“h.a.”) or predicted using the CNN-RNN method during each independent imaging session. Boxplots: median with quartiles, 1.5 × IQR and outliers. bf, n = 9 different partitions of training/validation/test datasets in each group. h, n = 7 independent imaging sessions in 6 subject mice. be, Two-sided Wilcoxon signed-rank test. f, One-way ANOVA followed by Bonferroni’s multiple comparisons test. h, Friedman test followed by post hoc Dunn’s multiple comparisons test. ***P < 0.001, **P < 0.01, *P < 0.05. ns, not significant. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 3. MeA neuronal responses during prosocial interaction.

Extended Data Fig. 3.

a, b, Example calcium traces from individual allogrooming-suppressed (a) and sniffing-suppressed (b) neurons during allogrooming or sniffing toward stressed conspecifics. c, d, Heatmaps showing average responses of example neurons with decreased activity during allogrooming (c) or sniffing (d). e, Cumulative distributions of pairwise distances between neurons of the same response type (allogrooming-responsive or sniffing-responsive) and distribution based on shuffled data in which the response type is randomly permuted (100 rounds of shuffling). f, Example calcium traces from single neurons that show increased activity during self-grooming but not allogrooming or sniffing. g, Heatmaps showing average responses of example self-grooming-responsive cells (with either increased or decreased activity) centered around self-grooming onset. h, Fraction of cells activated during both self-grooming and allogrooming or during both self-grooming and sniffing. i, Example image showing retrograde labeling of neurons in the accessory olfactory bulb (AOB) by injecting a retrograde AAV-EGFP virus in the MeA. Scale bar, 200 μm. c, d, g, Time 0 indicates behavior onset. e, n = 338, 1560, and 189800 pairwise distances for allogrooming-encoding cells, sniffing-encoding cells, and cells with shuffled identity, respectively. Kolmogorov-Smirnov test. h, Hypergeometric test. ns, not significant. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 4. MeA population activity encodes allogrooming and other behaviors during prosocial interaction.

Extended Data Fig. 4.

a, Projection of MeA population activity onto the first principal component (PC) overlaid with annotation of social interaction (including allogrooming and sniffing) in an example animal. b, Trial-averaged PC1 activity centered around onset of social interaction across all bouts from all sessions. c, Quantification of area under ROC curve (auROC) characterizing the relationship between PC1 activity and social interaction. d, Pairwise comparisons of the average within- and between-behavior class Euclidean distances (measured on the first 2 PCs within each session) for allogrooming vs. sniffing, allogrooming vs. self-grooming, and sniffing vs. self-grooming. e, Performance of three-way multi-class SVM decoders trained to predict allogrooming, sniffing, or self-grooming behavior. fh, Fraction of time that subjects show different types of behaviors (allogrooming, sniffing, or self-grooming) during the 3 s prior to the onsets of allogrooming (f), sniffing (g), and self-grooming events (h). i, Time-course of behavior decoder performance in discriminating between allogrooming and sniffing centered around onset of behavior. Shuffle control decoders are constructed using time-permuted calcium traces. Note that although a fraction of allogrooming events were preceded by sniffing events (f), the performance of the decoder remains at chance level prior to the onset of behavior (i), suggesting that neural activity during preceding sniffing events is not sufficient to decode allogrooming vs. sniffing. j, ROC curve quantifying performance of a binary decoder to predict whether an allogrooming bout is short (≤ 5s) or long (> 5s) using population activity centered around onset of allogrooming. k, Decoder performance in (j) compared with a null distribution constructed using time-permuted calcium traces. Whiskers indicate the 2.5th and 97.5th percentiles of null distribution. Dotted line: auROC from real data. ln, Fraction of time that subjects show allogrooming (l), sniffing (m), or self-grooming (n) during the 3 s prior to the onsets of long or short allogrooming events. Mean ± s.e.m. The ability to predict allogrooming bout duration using population activity is unlikely to be attributable to differences in behaviors preceding allogrooming as there is no difference in the distribution of different behaviors prior to allogrooming onset between the long and short bouts. b, i, Time 0 indicates behavior onset. b, fi, ln, mean ± s.e.m. Boxplots: median with quartiles, 1.5 × IQR and outliers. b, n = 7 independent imaging sessions (from 6 subject mice). c, n = 7 independent imaging sessions (from 6 subject mice) and 70 rounds of shuffling (10 rounds for each imaging session) for control group. Two-sided Wilcoxon rank-sum test. d, e, n = 7 independent imaging sessions (from 6 subject animals). Two-sided Wilcoxon signed-rank test. fh, n = 51, 292, 223 allogrooming (f), sniffing (g), and self-grooming (h) bouts, respectively (in 7 independent imaging sessions in 6 subject animals). k, permutation test (1000 rounds of permutation). ln, n = 51 short and 38 long allogrooming bouts (from 7 independent imaging sessions in 6 subject animals). Two-sided Wilcoxon rank-sum test. ***P < 0.001, **P < 0.01, *P < 0.05. ns, not significant. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 5. Activation of MeATac1 neurons promotes allogrooming and self-grooming in males and females.

Extended Data Fig. 5.

af, in, Probability of allogrooming (ac, ik) and self-grooming (df, ln) (fraction of trials showing a particular behavior at different time points) with respect to stimulation onset during optogenetic activation in male (af) and female (in) Tac1-Cre (a, d, i, l), Sst-Cre (b, e, j, m), and Cck-Cre (c, f, k, n) animals injected with ChR2 in the MeA. Blue areas: duration of light illumination; time 0: stimulation onset. g, h, o, p, Duration of allogrooming (g, o) and self-grooming (h, p) during photostimulations in male (g, h) and female (o, p) Tac1-Cre, Sst-Cre, and Cck-Cre animals injected with ChR2 in the MeA. q, Average trace showing Ca2+ signal changes during allogrooming toward stressed partners in Sst-Cre subjects expressing GCaMP. Mean ± s.e.m. Time 0: allogrooming onset. r, Comparison of Ca2+ signal changes between Sst+ and Tac1+/Vgat+ neurons during allogrooming using mean ΔF/F after behavior onset. Boxplots: median with quartiles, 1.5 × IQR and outliers. ap, Tac1-Cre, n = 35 trials in 2 males and 17 trials 2 females for both allogrooming and self-grooming. Sst-Cre, n = 25 trials in 2 males and 36 trials in 2 females for both allogrooming and self-grooming. Cck-Cre, n = 24 trials in 2 males and 22 trials in 2 females for both allogrooming and self-grooming. Kruskal-Wallis test followed by post hoc Dunn’s multiple comparisons test. r, n = 40 bouts in 7 GCaMP animals for Sst+ neurons. n = 19 bouts in 6 GCaMP animals for Tac1+/Vgat + neurons. Data for Tac1+/Vgat + neurons are the same as those in Fig. 4k and are presented here for comparison. Two-sided Wilcoxon rank-sum test. ***P < 0.001. **P < 0.01. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 6. Activation of MeATac1∩Vgat neurons promotes affiliative allogrooming in males and females.

Extended Data Fig. 6.

a, d, Probability of allogrooming toward stressed partners (fraction of trials showing allogrooming at different time points) with respect to stimulation onset in male (a) and female (d) ChR2 animals. b, c, e, f, Boxplots of duration (b, e) and onset latency (c, f) of allogrooming during photostimulations in male (b, c) and female (e, f) EYFP control and ChR2 animals. g, No significant difference in the duration of sniffing during photostimulations between EYFP control and ChR2 animals. Blue areas: duration of light illumination; time 0: stimulation onset. EYFP control males, n = 22 trials in 2 mice. ChR2 males, n = 58 trials in 4 mice. EYFP control females, n = 55 trials in 4 mice. ChR2 females, n = 115 trials in 4 mice. In g, trials from males and females are combined. Boxplots: median with quartiles, 1.5 × IQR and outliers. Two-sided Wilcoxon rank-sum test. ***P < 0.001. ns, not significant. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 7. Activation of MeA Tac1+/Vgat neurons promotes self-grooming but not allogrooming.

Extended Data Fig. 7.

a, b, Schematic of an intersectional approach for expression of ChR2 in Tac1+/Vgat neurons in the MeA using a Cre-on and Flp-off AAV virus. c, Example images showing that the majority of EYFP+ cells are glutamatergic (Vglut2+, 64.0 ± 1.8%, mean ± s.e.m.) and Tac1+ (91.8 ± 0.5%, mean ± s.e.m.) in Tac1Cre/+/VgatFlp/+ animals injected with the Con/Foff-EYFP virus (n = 3 hemispheres independently injected with the virus from 2 mice (5-7 sections per hemisphere). Scale bar, 25 μm. d, e, Probability of self-grooming (d) and allogrooming (e) toward stressed partners (fraction of trials showing a particular behavior at different time points) with respect to stimulation onset in ChR2 animals. Blue areas: duration of light illumination; time 0: stimulation onset. f, Duration of self-grooming and allogrooming toward stressed partners during photostimulations. Boxplots: median with quartiles, 1.5 × IQR and outliers. df, n = 39 trials in 4 mice (18 trials in 2 females and 21 trials in 2 males) for both self-grooming and allogrooming. The Cre-on/Flp-off virus used in the current study has been reported to lead to residual expression in a minor fraction of Cre+/Flp+ cells, possibly due to insufficiency of Flp relative to Cre (refs. 30, 52). Nonetheless, we found that when using this virus, the majority of EYFP+ cells (64.0 ± 1.8%, mean ± s.e.m.) were Vglut2+. Of note, the observation that the Cre-on/Flp-off animals did not show induction of allogrooming behavior suggests that activation of the small fraction of Tac1+/Vgat+ neurons in these animals (concurrent with activation of Tac1+/Vgat neurons) was not sufficient to drive allogrooming behavior. On the other hand, the observation that activation of Tac1+/Vgat+ neurons in animals injected with the Cre-on/Flp-on virus did not trigger self-grooming behavior suggests that the residual Tac1+/Vgat+ neurons labeled with the Cre-on/Flp-off virus are not responsible for the induction of self-grooming.

Extended Data Fig. 8. MPOA-projecting MeATac1∩Vgat neurons drive affiliative allogrooming in males and females.

Extended Data Fig. 8.

a, b, Example images showing axonal terminals of MeATac1∩Vgat neurons in the MPOA in male (a) and female (b) animals, revealed by immunostaining for EYFP in Tac1Cre/+/VgatFlp/+ animals injected with Con/Fon-ChR2-EYFP. Scale bar, 200 μm. (c, h) Schematics of viral injection and fiber implantation strategies for soma stimulation of retrogradely labeled, MPOA-projecting MeATac1∩Vgat neurons (c) or stimulation of the axonal projection of MeATac1∩Vgat neurons in the MPOA (h). dg, Duration (d, f) and onset latency (e, g) of allogrooming during photostimulations in EYFP control and ChR2 males (d, e) and females (f, g) with soma stimulation of MPOA-projecting MeATac1∩Vgat neurons. il, Duration (i, k) and onset latency (j, l) of allogrooming during photostimulations in EYFP control and ChR2 males (i, j) and females (k, l) with stimulation of the MPOA projection of MeATac1∩Vgat neurons. mo, Probability of allogrooming toward stressed partners (fraction of trials showing allogrooming at different time points) with respect to stimulation onset (m, n) and allogrooming duration (o) during photostimulations of the MPOA projection of MeATac1∩Vgat neurons without or with infusion of lidocaine in the MeA. Blue areas: duration of light illumination; time 0: stimulation onset. p, Example image showing axonal projections of MeATac1∩Vgat neurons in the PMv. Scale bar, 200 μm. q, Duration of allogrooming during photostimulation of the MPOA or PMv projection of MeATac1∩Vgat neurons. Data for MPOA projection stimulation are the same as those in Fig. 4r and are presented here for comparison. Boxplots: median with quartiles, 1.5 × IQR and outliers. dg, il, EYFP control, MeA soma stimulation, n = 52 trials in 4 females and 29 trials in 2 males. ChR2, MeA soma stimulation, n = 68 trials in 4 females and 59 trials in 2 males. EYFP control, MPOA projection stimulation, n = 45 trials in 4 females and 22 trials in 2 males. ChR2, MPOA projection stimulation, n = 40 trials in 3 females and 53 trials in 3 males. mo, n = 36 trials in 4 mice (24 trials from 3 females and 12 trials from 1 male) for the “no lidocaine” group. n = 58 trials in 4 mice (39 trials from 3 females and 19 trials from 1 male) for the “lidocaine” group. q, n = 93 trials in 6 mice (40 trials in 3 females and 53 trials in 3 males) for MPOA stimulation, n = 118 trials in 4 mice (65 trials in 2 females and 53 trials in 2 males) for PMv stimulation. Two-sided Wilcoxon rank-sum test. ***P < 0.001. ns, not significant. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 9. Activation of MeAVgat neurons can promote allogrooming during prosocial interaction.

Extended Data Fig. 9.

a, Schematic of ChR2 activation in MeAVgat neurons. b, c, Duration of allogrooming (b) and sniffing (c) toward stressed partners during low-intensity photostimulations in ChR2 and EYFP control animals. The increase in sniffing (~1.5 s) appears to be substantially smaller than that in allogrooming (~5 s), suggesting that increased allogrooming is the predominant behavioral effect. d, Duration of triggered allogrooming when subject animals are in the vicinity of and attending to the partners (“optimal” condition) compared to all stimulations. Boxplots: median with quartiles, 1.5 × IQR and outliers. b, EYFP control, n = 119 trials in 11 mice (74 trials in 6 females and 45 trials in 5 males); ChR2, n = 141 trials in 12 mice (88 trials in 7 females and 53 trials in 5 males). c, EYFP control, n = 119 trials in 11 mice (74 trials in 6 females and 45 trials in 5 males); ChR2, n = 142 trials in 12 mice (89 trials in 7 females and 53 trials in 5 males). d, All condition, n = 78 trials in 5 male mice; optimal condition (subject within half a body-length and facing the partner), n = 53 trials in 5 male mice. bd, Two-sided Wilcoxon rank-sum test. ***P < 0.001, **P < 0.01. For details of statistical analyses, see Supplementary Table 1.

Extended Data Fig. 10. Activation of MeA Tac1/Vgat+ neurons promotes aggression.

Extended Data Fig. 10.

ab, Schematic of an intersectional approach for specific expression of ChR2 in Tac1/Vgat+ neurons in the MeA using a Cre-off and Flp-on AAV. c, Example images showing that EYFP+ cells are predominantly Vgat+ (99.3 ± 1.4%, mean ± s.e.m.) and Tac1 (90.1 ± 1.9%, mean ± s.e.m.) in Tac1Cre/+/VgatFlp/+ animals injected with the Coff/Fon-EYFP AAV (n = 4 hemispheres independently injected with the virus from 2 mice (4-5 sections per hemisphere). Scale bar, 25 μm. d, e, Probability of aggression (d) and allogrooming (e) toward stressed partners (fraction of trials showing a particular behavior at different time points) with respect to stimulation onset in ChR2 animals. Blue areas: duration of light illumination; time 0: stimulation onset. f, Duration of aggression and allogrooming toward stressed partners during photostimulations. Boxplots: median with quartiles, 1.5 × IQR and outliers. df, n = 83 and 80 trials in 4 male mice for aggression and allogrooming, respectively.

Supplementary Material

Supplemental Information
Supplemental Video 1
Download video file (13.5MB, mp4)
Supplemental Video 2
Download video file (263.5KB, mp4)
Supplemental Video 3
Download video file (8.8MB, mp4)
Supplemental Video 4
Download video file (5.7MB, mp4)

Acknowledgements:

We thank V. Wan for technical assistance, D. Aharoni, P. Golshani, P. Zhao for assistance in setting up the miniscope (v4) imaging system, D. J. Anderson for valuable comments and feedback on the project, and members of the Hong lab for valuable comments. Illustrations of mice and mouse brain schematics in Fig. 1a, u-x, 2a, 3a, e, k, 4d, h, l, p, Extended Data Fig. 7b, 8c, h, 9a, 10b were created with BioRender.com. This work was supported in part by NIH grants (R01 NS113124 and U01 NS122124), a Searle Scholars Award, a Packard Fellowship in Science and Engineering, a Keck Foundation Junior Faculty Award, a McKnight Scholar Award, a Vallee Scholar Award, a Mallinckrodt Scholar Award, a NARSAD Young Investigator grant, a Klingenstein-Simons Fellowship Award, and a Brain Research Foundation grant (to W.H.) and NIH training grant (T32 NS048004 to J.D.).

Footnotes

Code availability: Code for behavioral analysis (https://github.com/pdollar/toolbox), animal pose tracking (https://github.com/murthylab/sleap/releases/tag/v1.0.9), microendoscopic imaging data analysis (https://github.com/etterguillaume/MiniscopeAnalysis,https://github.com/zhoupc/CNMF_E, and https://github.com/flatironinstitute/NoRMCorre) is available on GitHub. The pre-trained Google Inception v3 network is available at https://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz. Additional code relating to the paper is available upon reasonable request to the corresponding author.

Competing interests: The authors declare no competing interests.

Additional information: Supplementary Information is available for this paper.

Data availability:

Source Data are provided for all figures. Additional data relating to the paper are available upon reasonable request to the corresponding author.

References:

  • 1.de Waal FBM & Preston SD Mammalian empathy: behavioural manifestations and neural basis. Nat Rev Neurosci 18, 498–509 (2017). [DOI] [PubMed] [Google Scholar]
  • 2.Dunfield KA A construct divided: prosocial behavior as helping, sharing, and comforting subtypes. Front Psychol 5, 958 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Rault J-L Be kind to others: Prosocial behaviours and their implications for animal welfare. Appl Anim Behav Sci 210, 113–123 (2019). [Google Scholar]
  • 4.Morrison I Keep Calm and Cuddle on: Social Touch as a Stress Buffer. Adapt Hum Behav Physiology 2, 344–362 (2016). [Google Scholar]
  • 5.Spruijt BM, Hooff J. A. van & Gispen WH Ethology and neurobiology of grooming behavior. Physiol Rev 72, 825–852 (1992). [DOI] [PubMed] [Google Scholar]
  • 6.Jablonski NG Social and affective touch in primates and its role in the evolution of social cohesion. Neuroscience 464, 117–125 (2020). [DOI] [PubMed] [Google Scholar]
  • 7.Burkett JP et al. Oxytocin-dependent consolation behavior in rodents. Science 351, 375–378 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Li L-F et al. Involvement of oxytocin and GABA in consolation behavior elicited by socially defeated individuals in mandarin voles. Psychoneuroendocrinology 103, 14–24 (2019). [DOI] [PubMed] [Google Scholar]
  • 9.Sterley T-L & Bains JS Social communication of affective states. Curr Opin Neurobiol 68, 44–51 (2021). [DOI] [PubMed] [Google Scholar]
  • 10.Paradiso E, Gazzola V & Keysers C Neural mechanisms necessary for empathy-related phenomena across species. Curr Opin Neurobiol 68, 107–115 (2021). [DOI] [PubMed] [Google Scholar]
  • 11.Kwon J-T et al. An amygdala circuit that suppresses social engagement. Nature 593, 114–118 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12.Chen P & Hong W Neural Circuit Mechanisms of Social Behavior. Neuron 98, 16–30 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Raam T & Hong W Organization of neural circuits underlying social behavior: A consideration of the medial amygdala. Curr Opin Neurobiol 68, 124–136 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Unger EK et al. Medial Amygdalar Aromatase Neurons Regulate Aggression in Both Sexes. Cell Reports 10, 453–462 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Li Y et al. Neuronal Representation of Social Information in the Medial Amygdala of Awake Behaving Mice. Cell 171, 1176–1190 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 16.Twining RC, Vantrease JE, Love S, Padival M & Rosenkranz JA An intra-amygdala circuit specifically regulates social fear learning. Nat Neurosci 20, 459–469 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Hong W, Kim D-W & Anderson DJ Antagonistic Control of Social versus Repetitive Self-Grooming Behaviors by Separable Amygdala Neuronal Subsets. Cell 158, 1348–1361 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Chen PB et al. Sexually Dimorphic Control of Parenting Behavior by the Medial Amygdala. Cell 176, 1206–1221 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Allsop SA et al. Corticoamygdala Transfer of Socially Derived Information Gates Observational Learning. Cell 173, 1329–1342 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Jeon D et al. Observational fear learning involves affective pain system and Cav1.2 Ca2+ channels in ACC. Nat Neurosci 13, 482–488 (2010). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Sterley T-L et al. Social transmission and buffering of synaptic changes after stress. Nat Neurosci 21, 393–403 (2018). [DOI] [PubMed] [Google Scholar]
  • 22.Gangopadhyay P, Chawla M, Monte OD & Chang SWC Prefrontal–amygdala circuits in social decision-making. Nat Neurosci 24, 5–18 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Canteras NS, Simerly RB & Swanson LW Organization of projections from the medial nucleus of the amygdala: A PHAL study in the rat. J Comp Neurol 360, 213–245 (1995). [DOI] [PubMed] [Google Scholar]
  • 24.Cádiz-Moretti B, Otero-García M, Martínez-García F & Lanuza E Afferent projections to the different medial amygdala subdivisions: a retrograde tracing study in the mouse. Brain Struct Funct 221, 1033–1065 (2016). [DOI] [PubMed] [Google Scholar]
  • 25.Mahn M et al. High-efficiency optogenetic silencing with soma-targeted anion-conducting channelrhodopsins. Nat Commun 9, 4125 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Fenno LE et al. Targeting cells with single vectors using multiple-feature Boolean logic. Nat Methods 11, 763–772 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Chen T-W et al. Ultrasensitive fluorescent proteins for imaging neuronal activity. Nature 499, 295–300 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 28.Dana H et al. High-performance calcium sensors for imaging activity in neuronal populations and microcompartments. Nat Methods 16, 649–657 (2019). [DOI] [PubMed] [Google Scholar]
  • 29.Lim BK, Huang KW, Grueter BA, Rothwell PE & Malenka RC Anhedonia requires MC4R-mediated synaptic adaptations in nucleus accumbens. Nature 487, 183–189 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 30.Ghosh KK et al. Miniaturized integration of a fluorescence microscope. Nat Methods 8, 871–878 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 31.Kingsbury L et al. Correlated Neural Activity and Encoding of Behavior across Brains of Socially Interacting Animals. Cell 178, 429–446 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Pnevmatikakis EA & Giovannucci A NoRMCorre: An online algorithm for piecewise rigid motion correction of calcium imaging data. J Neurosci Meth 291, 83–94 (2017). [DOI] [PubMed] [Google Scholar]
  • 33.Zhou P et al. Efficient and accurate extraction of in vivo calcium signals from microendoscopic video data. Elife 7, e28728 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Kingsbury L et al. Cortical Representations of Conspecific Sex Shape Social Behavior. Neuron 107, 941–953 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Hong W et al. Automated measurement of mouse social behaviors using depth sensing, video tracking, and machine learning. Proc National Acad Sci 112, E5351–E5360 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Wiltschko AB et al. Mapping Sub-Second Structure in Mouse Behavior. Neuron 88, 1121–1135 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 37.Kabra M, Robie AA, Rivera-Alba M, Branson S & Branson K JAABA: interactive machine learning for automatic annotation of animal behavior. Nat Methods 10, 64–67 (2013). [DOI] [PubMed] [Google Scholar]
  • 38.Jhuang H et al. Automated home-cage behavioural phenotyping of mice. Nat Commun 1, 68 (2010). [DOI] [PubMed] [Google Scholar]
  • 39.Nilsson SR et al. Simple Behavioral Analysis (SimBA) – an open source toolkit for computer classification of complex social behaviors in experimental animals. Biorxiv (2020) doi: 10.1101/2020.04.19.049452. [DOI] [Google Scholar]
  • 40.LeCun Y, Bengio Y & Hinton G Deep learning. Nature 521, 436–444 (2015). [DOI] [PubMed] [Google Scholar]
  • 41.Szegedy C, Vanhoucke V, Ioffe S, Shlens J & Wojna Z Rethinking the Inception Architecture for Computer Vision. 2016 IEEE Conference Computer Vision and Pattern Recognition (CVPR). 2818–2826 (2016) doi: 10.1109/cvpr.2016.308. [DOI] [Google Scholar]
  • 42.Pereira TD et al. SLEAP: Multi-animal pose tracking. Biorxiv (2020) doi: 10.1101/2020.08.31.276246. [DOI] [Google Scholar]
  • 43.Hochreiter S & Schmidhuber J Long Short-Term Memory. Neural Comput 9, 1735–1780 (1997). [DOI] [PubMed] [Google Scholar]
  • 44.Lipton ZC, Berkowitz J & Elkan C A Critical Review of Recurrent Neural Networks for Sequence Learning. Arxiv:1506.00019 (2015). [Google Scholar]
  • 45.Wu YE, Pan L, Zuo Y, Li X & Hong W Detecting Activated Cell Populations Using Single-Cell RNA-Seq. Neuron 96, 313–329 (2017). [DOI] [PubMed] [Google Scholar]
  • 46.Harris JA et al. Anatomical characterization of Cre driver mice for neural circuit mapping and manipulation. Front Neural Circuit 8, 76 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 47.Taniguchi H et al. A Resource of Cre Driver Lines for Genetic Targeting of GABAergic Neurons in Cerebral Cortex. Neuron 71, 995–1013 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 48.Daigle TL et al. A Suite of Transgenic Driver and Reporter Mouse Lines with Enhanced Brain-Cell-Type Targeting and Functionality. Cell 174, 465–480 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 49.Hu RK et al. An amygdala-to-hypothalamus circuit for social reward. Nat Neurosci 24, 831–842 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 50.Stuber GD et al. Excitatory transmission from the amygdala to nucleus accumbens facilitates reward seeking. Nature 475, 377–380 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 51.Bankhead P et al. QuPath: Open source software for digital pathology image analysis. Sci Rep 7, 16878 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 52.Fenno LE et al. Comprehensive Dual- and Triple-Feature Intersectional Single-Vector Delivery of Diverse Functional Payloads to Cells of Behaving Mammals. Neuron 107, 836–853 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supplemental Information
Supplemental Video 1
Download video file (13.5MB, mp4)
Supplemental Video 2
Download video file (263.5KB, mp4)
Supplemental Video 3
Download video file (8.8MB, mp4)
Supplemental Video 4
Download video file (5.7MB, mp4)

Data Availability Statement

Source Data are provided for all figures. Additional data relating to the paper are available upon reasonable request to the corresponding author.

RESOURCES