Skip to main content
UKPMC Funders Author Manuscripts logoLink to UKPMC Funders Author Manuscripts
. Author manuscript; available in PMC: 2025 Aug 1.
Published in final edited form as: Nat Neurosci. 2021 Jul 29;24(9):1270–1279. doi: 10.1038/s41593-021-00884-8

Mice learn multi-step routes by memorizing subgoal locations

Philip Shamash 1, Sarah F Olesen 1, Panagiota Iordanidou 1, Dario Campagner 1, Nabhojit Banerjee 1, Tiago Branco 1,*
PMCID: PMC7617975  EMSID: EMS206916  PMID: 34326540

Abstract

The behavioral strategies that mammals use to learn multi-step routes are unknown. Here we investigated how mice navigate to shelter in response to threats when the direct path is blocked. Initially, they fled toward the shelter and negotiated obstacles using sensory cues. Within twenty minutes, they spontaneously adopted a subgoal strategy, initiating escapes by running directly to the obstacle’s edge. Mice continued to escape in this manner even after the obstacle had been removed, indicating use of spatial memory. However, standard models of spatial learning – habitual movement repetition and internal-map building – did not explain how subgoal memories formed. Instead, mice used a hybrid approach: memorizing salient locations encountered during spontaneous ‘practice runs’ to the shelter. This strategy was also used during a geometrically identical food-seeking task. These results suggest that subgoal memorization is a fundamental strategy by which rodents learn efficient multi-step routes in new environments.

Introduction

For prey species such as mice, quickly finding effective routes to goals is critical for survival because it reduces exposure to potential predators1. This is a challenging task: natural environments are complex, and wild animals must compute multi-step routes taking into account uneven terrain, obstacles, and dynamically changing environments. Ethological studies of wild rodents have emphasized the roles of locating salient landmarks2,3 and adhering to familiar paths4,5 in overcoming these challenges. However, observational studies are limited in their ability to identify the cues and behavioral strategies that animals actually use to navigate.

Experimental evidence from rodents trained to locate goals has uncovered multiple types of spatial reasoning that can be used to solve complex navigational problems. On the one hand, rodents keep track of their position within an allocentric (environment-centered) reference frame6. This sense of place is thought to be integrated into an internal topological map connecting locations within the environment, which allows animals to compute subgoal locations whenever a new multi-step route to a goal is required710. This kind of cognitive-map-based reasoning is flexible, is learned by observing the structure of the environment, and is dependent on the hippocampus11. Alternatively, animals can navigate to goals without relying on an internal map. These strategies include integrating self-motion cues to compute a vector back to their starting position12; repeating egocentric movements at familiar junctions13,14; and using landmarks for visual guidance15. The latter two tactics, known as “taxon” strategies, are inflexible, rely on proximal cues, and are learned through previous motivated actions11.

Despite all that is known about rodent navigation, the behavioral strategies that animals spontaneously use to quickly build up and deploy spatial knowledge in new environments remain unknown. The abilities listed above have mostly been demonstrated by repeatedly placing rodents in constrained mazes until they learn to navigate to a goal. In a natural setting, however, spatial learning must occur via internally generated exploration patterns and within a very limited timeframe. It is therefore unclear how well previous classifications of navigation strategies map onto the instincts and learning procedures that animals use during natural goal-directed navigation.

Escape behavior offers a powerful model for studying naturalistic navigation in the laboratory. Diverse animals, including fishes, lizards, crabs, birds, and rodents, respond to threats by escaping to a familiar shelter16. Mice are known to rapidly identify and memorize shelter locations in new environments and instinctively respond to visual or auditory threats by running straight to the shelter17,18. Previous studies have shown that the spatial memory for running back to shelter (‘homing’) can be based on path integration or distal visual landmarks when a direct path is available17,1921. If the direct path is blocked on one side by a barrier, previous work has shown that gerbils can use spatial memory to reach the hidden shelter after a brief period of exploration22. Thus, rodent escape offers not only reliable, stimulus-locked trajectories and rapid learning within a single session but also a reliance on spatial reasoning. These qualities make escape a useful model for understanding how animals learn and execute complex goal-directed trajectories within the time constraints compatible with survival in natural settings.

Here we first investigate the strategies that naïve mice use to navigate to shelter in response to auditory threats when the direct path is blocked by a wall. Through quantitative analysis of escape trajectories and their relationship to exploratory behavior, systematic variation of spatial conditions, and dynamic modifications to the environment, we describe how mice learn to execute efficient multi-step escape routes within minutes of entering a novel, obstacle-laden environment. We then show that the navigational strategy for escape is also used for reaching a food reward goal.

Results

Mice rapidly learn efficient escape routes past an obstacle

As a baseline condition for investigating how mice learn escape trajectories, we placed naïve animals in a circular, open-field platform with a shelter and overhead lighting. After a brief exploration period during which mice spontaneously located the shelter, we exposed them to a loud, overhead crashing sound while they were in a pre-defined threat zone (Fig. 1A). This reliably elicited rapid escapes directed at the shelter along a straight ‘homing vector’ (N=23 escapes, 10 mice; Fig. 1A-B, Extended Data Fig. 1A; Supplementary Video 1-2), similar to previous results17. We then repeated this experiment in a separate group of mice, with a wall positioned between the threat zone and the shelter (N = 24 mice; Extended Data Fig. 2A). This wall was white against a black background, and all mice approached and walked along it during the exploration period (Extended Data Fig. 1B). To quantify escape trajectories in relation to the obstacle, we computed a target score: escapes initiated in the direction of the shelter get a score of zero; escapes targeting the obstacle edge get 1.0; and escapes aimed beyond the obstacle edge get scores >1.0 (Fig. 1A). Escapes are classified as “edge vectors” if their score surpasses the 95th percentile of escape scores in the open field (0.65) and are otherwise classified as “homing vectors”. Upon the first threat presentation, the majority of the mice (57%) executed homing-vector escapes (Fig. 1A-B; Supplementary Video 3). Replacing the wall obstacle with an unprotective hole obstacle did not reduce this proportion (Extended Data Fig. 2B, Extended Data Fig. 1C-D). Thus, homing-vector escapes cannot be purely accounted for by the safety provided by running along a wall; rather, they are likely directed at the shelter location.

Figure 1. Mice rapidly learn efficient escape trajectories in the presence of obstacles.

Figure 1

a, Single escape trials colored by speed (top) and all trajectories color-coded by trajectory type (bottom; homing-vector paths are gray, edge-vector paths are blue). Initial escape target is the direction of the vector from escape initiation to 10 cm in front of the obstacle, normalized between 0 (directed at the shelter) and 1 (directed at the obstacle edge location). Dashed arrows in the top panels illustrate the shelter and edge-vector directions. Dots show the point where the target measurement is taken. Values (0.56 and 1.02) are the escape target score for the examples shown. Dot-and-arrow plots show the distribution of initial escape targets (the arrow is the median value). Only successful escapes (getting to the shelter within 12 seconds) are analyzed. b, Summary of initial escape targets. One-sided permutation test on the target score, trial 1 vs. trials 2-3: P=0.0004 (***). Each dot represents one escape. Gray points are escapes classified as homing vectors and blue points are edge-vector escapes. Differences in escape target were not related to differences in position or angle at the moment of threat onset (Supplementary Fig. 1). c, Spatial efficiency is the ratio of the shortest possible escape path length and the path actually taken to the shelter. This is the inverse of tortuosity. Each dot represents one escape. Open field total: N=23 escapes, 10 mice; obstacle total: N=66 escapes, 24 mice; obstacle trial 1: N=21 escapes, 21 mice; obstacle trial 2: N=24 escapes, 24 mice; obstacle trial 3: N=21 escapes, 21 mice; obstacle trials 2-3: N=45 escapes, 24 mice. White squares show the median, thick lines show the IQR, and thin lines show the range excluding outliers (beyond the median ± 1.5 x IQR). Distributions are kernel density estimates.

Over the course of three threat presentation trials (17±4 minutes into the session, mean±std), mice performed escapes that were increasingly spatially efficient (ratio of the shortest possible path to the actual escape path: median for trial 1 = 0.77; for trial 3 = 0.87; F(2, 30)=7.2, P=.003, repeated measures ANOVA on trials 1-3; Fig. 1C) and rapid (normalized escape duration: median for trial 1 = 3.8 s; for trial 3 = 3.2 s; F(2, 34)=6.2, P=.005; Extended Data Fig. 1E). By this point, almost all trajectories were aimed directly at the obstacle edge (90% edge vectors; median target score = 0.98). Thus, while inefficient homing responses initially dominated, mice acquired rapid and streamlined routes to shelter over the course of 20 minutes and three escape trials.

We next investigated whether mice use visual input to locate and run toward the obstacle edge. First, we tested whether visual cues are sufficient for generating edge-vector escapes. After 20 minutes with three escape trials in the open field, we examined how mice responded to an unexpected obstacle rising up at the same time as the threat stimulus onset (N=10 trials, 10 mice; Extended Data Fig. 3A; Supplementary Video 4). We found that 7/10 escapes followed homing-vector paths until reaching the wall (tactile obstacle avoidance; Extended Data Fig. 3A). The other 3/10 escapes deviated toward an obstacle edge before the mouse was close enough to touch the wall, suggesting that vision was used to navigate toward the obstacle edge (putative visual obstacle avoidance; proportion of mice deviating toward the edge: 3/10 > 0/23 escapes in the open field; P=0.02, Fisher’s exact test; Extended Data Fig. 3A). Thus, both tactile and visual cues can be used to negotiate obstacles during escape, in the absence any prior experience with an obstacle. Second, we examined whether visual cues were necessary for generating edge-vector escapes. We repeated the obstacle experiment from Figure 1, but now in complete darkness (Extended Data Fig. 3B-D; Supplementary Video 5). Mice executed fewer edge-vector escapes in the dark (% edge-vector escapes on trials 1-3: 33% with the lights off vs. 74% with the lights on, P=0.002, permutation test). This proportion of edge-vector escapes was not significantly different than escapes in the open field (not more than the 22% edge-vector rate in the dark in the open field; P=0.2, permutation test). However, after 20 minutes with three escape trials in the light, mice were able to execute mostly edge vectors in the dark (55% edge-vector escapes vs. 22% in the open field, P=0.002, permutation test; Extended Data Fig. 3C-D). Thus, for naïve mice with limited experience, visual cues are required for efficient obstacle avoidance. However, immediately after experiencing a 20-minute behavioral session in the light, streamlined escapes can occur even in complete darkness.

Mice develop a spatial memory strategy for obstacle avoidance

We thus considered that learning efficient escapes might entail developing a memory of the obstacle edge location, making perception of the obstacle unnecessary. To further test this hypothesis, after the animals explored the environment with the obstacle for 20 minutes and with three escape trials, we removed the obstacle at the moment of threat onset (“acute obstacle removal”; Supplementary Video 6). Although the obstacle disappeared before the initial orientation movement could be completed, all animals escaped along the edge vector and did not turn toward the shelter until they passed the location where the obstacle edge used to be (median target = 0.98; N=8 escapes, 8 mice; Fig. 2A-B). Next, we examined how persistent this memory-based strategy is. In a “chronic obstacle removal” experiment (CORE), we allowed several minutes between this acute obstacle removal trial and additional escape trials (9±5 minutes, mean±std). During this time, the mice explored the platform, including visiting its now obstacle-free center (Extended Data Fig. 4A). We found that 44% of the subsequent escapes were still directed at the location where the obstacle edge used to be (N=18 escapes, 8 mice; more than the 9% edge-vector rate in the open field: P=0.02, permutation test; Fig. 2A-B; Supplementary Video 6), while the remaining 56% mice reverted to the homing-vector response.

Figure 2. Mice use a spatial memory strategy for efficient obstacle avoidance.

Figure 2

a, Examples of edge-vector escape trials (top) and all trajectories (bottom) after removing the obstacle. Subheaders describe the experience in the environment prior to removing the obstacle. The dotted line indicates where the obstacle used to be. Arrow plots show the distribution of initial escape targets. b, Summary data for initial escape targets after obstacle removal. One-sided permutation test: acute: P=1x10-5 (***); chronic 3 baseline: P=0.02 (*); chronic 0 baseline: P=0.004 (**), permutation test on the rate of edge-vectors compared to the open field. Acute removal: N=8 escapes, 8 mice; chronic removal, 3 baselines: N=18 escapes, 8 mice; chronic removal, 0 baselines: N=23 escapes, 10 mice. c, Schematic for the experiment in which the obstacle length is changed by 25%. For the “obstacle shortened” condition, the dotted gray line indicates the initial obstacle length, and the thick black line indicates the new length (after 20 minutes / 3 baseline escape trials). For the “obstacle lengthened” condition, the thick black line indicates the initial obstacle length, and the dotted gray line indicates the new length. Both the initial and the shelter-bound segments of the escape are analyzed. d, Summary data for the experiments changing the length of the obstacle by 25%, analyzing the initial segment of the escape. Escapes aimed at the current obstacle edge location get a score of zero; escapes aimed at the edge location if the obstacle were 25% longer get a score of +1 (overshoot); and escapes aimed at the edge location if the obstacle were 25% shorter get a score of -1 (undershoot). Combining both length-change experiments, the median of the initial target score’s absolute value is 0.44. One-sided permutation test on the initial escape target, obstacle shortened vs. unchanged: P=0.002 (**); obstacle lengthened vs. unchanged: P=0.002 (**). e, Summary data for the experiments changing the length of the obstacle by 25%, analyzing the segment of the escape going from the obstacle edge to the shelter. Escapes aimed at the current shelter location get a score of zero; escapes aimed where the shelter would be if the obstacle were 25% longer get a score of +1 (overshoot); and escapes aimed where the shelter would be if the obstacle were 25% shorter get a score of -1 (undershoot). Combining both length-change experiments, the absolute median shelter-bound target score magnitude is 0.37. One-sided permutation test on the shelter-bound escape target, obstacle shortened vs. unchanged: P=0.001 (**); obstacle lengthened vs. unchanged: P=0.0002 (***). Obstacle shortened: N= 14 escapes, 9 mice; obstacle unchanged: N=25 escapes, 17 mice; obstacle lengthened: N=13 escapes, 9 mice. White squares show the median, thick lines show the IQR, and thin lines show the range excluding outliers. Distributions are kernel density estimates.

This memory for edge-vector escapes could in principle be learned during escapes trials or through spontaneous exploratory behavior. To distinguish between these possibilities, we repeated the CORE but now with zero baseline escape trials during the initial 20-minute exploration period (CORE-ZB). As in the previous experiment, we then removed the obstacle and allowed the mice to explore the newly unobstructed environment (for 5±4 minutes, mean±std; Extended Data Fig. 4A). Threat presentation after this period resulted in mostly edge-vector responses (57% edge-vector escapes; N = 23 escapes, 10 mice; more edge vectors than in the open field: P=0.004, permutation test; Fig. 2A-B). Thus, within 20 minutes in a novel environment, mice spontaneously develop a persistent spatial memory for efficient, multi-step escapes.

Our experiments so far have revealed a memory-based obstacle avoidance strategy. We have also shown that visual input is used to navigate around the obstacle when experience is limited. We therefore tested how perception and spatial memory operate in tandem when both are fully available. In a novel environment, we performed an experiment similar to the CORE, but instead of removing the obstacle, we changed its length by 25% (Fig.2C; obstacle shortened: N=14 escapes, 9 mice; obstacle lengthened: N=13 escapes, 9 mice; obstacle always short: N=15 escapes, 9 mice; obstacle always long: N=10 escapes, 8 mice). Initial escape trajectories were consistently biased toward the previous edge location (Fig. 2D-E, Extended Data Fig. 4B-E; Supplementary Video 7). However, this result differed from the obstacle removal experiments in two ways. First, the memory bias was intermediate in magnitude: escape targets were biased only partway toward the former edge location (Fig. 2D, Extended Data Fig. 4D-E). Second, the second segment of the escape was equally biased: after reaching the obstacle edge, mice ran toward where the shelter would be if the edge had not moved (Fig. 2E, Extended Data Fig. 4D-E). These results show that, when available, the current obstacle position is an important cue for anchoring and adjusting memory-guided paths to both the edge and the shelter.

Characterizing the spatial memory strategy for escape past an obstacle

We next aimed to characterize the spatial-memory strategy and how it is learned. We evaluated three possible strategies: habitual learning of turn angles, sampling the environment to build a cognitive map, and memorizing subgoals encountered during practice homings. We evaluated each possibility by analyzing the relationship between escapes and spontaneous behavior during exploration, primarily in the chronic obstacle removal experiment with zero baseline escape trials (CORE-ZB). For each analytical finding, we then performed further experiments to validate the analysis.

Habitual, egocentric movements do not explain the spatial memory: analysis

First, we tested whether mice learn egocentric movements from the threat zone to the obstacle edge, similar to the habitual response strategy in mazes13. We extracted all spontaneous homing runs, defined as sustained turn-and-run movements from the threat area toward the shelter during the CORE-ZB’s exploration period (see Methods; median [IQR] number of runs = 7 [6,7]; time from their end point until reaching the shelter: 8 [2, 16] sec; Fig. 3A; Extended Data Fig. 5A; Supplementary Video 8). We then computed each run’s starting position and orientation, and the angle turned during its initial turn-and-run segment (Fig. 3A; see Methods for details and Extended Data Fig. 6 for examples of starting-point extraction).

Figure 3. Habitual, egocentric movements do not explain the spatial memory for escape.

Figure 3

a, Examples of homing runs – continuous turn-and-run movements toward the shelter – extracted from all movement data (Supplementary Video 9; Methods). Turn angles are defined as the difference in heading direction between the homing initiation point and the point where the mouse has travelled 15 cm. Turn angles are positive for rightward turns and negative for leftward turns. b, Predicting the escape targets of mice in the CORE-ZB on the basis of their previous turning movements. Left: diagram illustrating the method for predicting the escape target based on the turn angles from previous homing runs. Right: the y-axis measures the amount of variance in escape targets across trials that can be explained by mice repeating turn angles from previous homing runs. The positive control is a platform with narrow corridors, in which movements are stereotyped (see Extended Data Fig. 5; N=30 escapes, 10 mice). The test condition is the CORE-ZB. The negative control is predicting a random angle, and then extrapolating that angle to predict escape targets in the CORE-ZB (avg R2 from doing this 1000 times). c, An experiment similar to the CORE-ZB, but with an additional barrier present during exploration. N=20 escapes, 10 mice. Bottom: distribution of turn angles from homing movements and from escapes. Both sets of angles are extracted in the same way (Fig. 3a; Methods). Black shows the new CORE with two barriers, and blue shows the two original COREs (Fig. 2A). Chi-square test comparing the angle distributions, binned as shown in the figure; exploratory movements: P=0.001 (**); escape movements: P=0.6. d, An experiment like the CORE-ZB, but in which the shelter is moved following the exploration period. N=18 escapes, 10 mice. Analysis is the same as in panel c. Bottom: Black shows the new CORE with the moved shelter, and blue shows the two original COREs. Chi-square test; exploratory movements: P=0.5; escape movements: P=0.03 (*).

Homing runs were sparse, and their initial positions and body orientations were highly variable. It was unlikely for any escape’s starting conditions to closely match a previous homing: only 22% of escapes were preceded by a run with starting points within 10 cm distance and 30° body orientation (Extended Data Fig. 5A). Despite this lack of stereotypy, we attempted to account for the memory-guided edge-vector escapes observed in the CORE-ZB using the assumption that mice repeat turn angles from previous homing runs. First, we validated a method to predict escape targets based on homing-run turn angles. We put mice on a modified platform with two narrow corridors, ensuring that homings and escapes were stereotyped (N=30 escapes, 10 mice; Extended Data Fig. 5B). Here, we could precisely predict escape targets using the mouse’s starting point and its history of previous turn-and-run movements (R2 of the prediction = 0.97 using the homing run with the most similar turn angle; R2 = 0.65 using the homing run with the closest initial position; R2 = 0.58 using the homing run with the closest initial body orientation; Fig. 3B; Extended Data Fig. 5C). In the CORE-ZB, however, repeating turning movements did not explain any of the variance in post-removal escape targets (R2 of the prediction = 9x10-4 (most similar turn angle); R2 = 0.04 (closest initial position); R2 = 9x10-6 (closest initial body orientation); R2 = 0.05 (randomly generated prediction); Fig. 3B; Extended Data Fig. 5D).

Habitual, egocentric movements do not explain the spatial memory: experiments

This analysis suggests that memory-guided edge-vector escapes are not based on repeating egocentric actions that mice had executed during the exploration period. We performed two new experiments to test this finding. First, we performed a variant of the CORE-ZB with an additional barrier in front of the threat zone, which was removed simultaneously with the main obstacle (Fig. 3C; N=20 escapes, 10 mice). With this extra barrier in place, homing runs now consisted of movements with smaller turn angles than in the previous experiments (the two COREs with the original geometry; P=0.001, chi-square test on the distribution of homing-run turn angles; Fig. 3C). However, after obstacle removal, the distribution of escape turn angles was indistinguishable from the previous experiments (P=0.6, chi-square test on the distribution of escape turn angles; Fig. 3C). Thus, different fine-grained movements during exploration do not necessarily produce different escape movements. Also note that escape routes did not deviate around the second, distal obstacle location (Fig. 3C). This further suggests that memory-guided escapes are not merely a function of the movements made during exploration but instead depend on the geometry of the environment. In a second new variant of the CORE-ZB, we tested whether memory-guided escapes are sensitive to the shelter location, as this would not be expected from a habitually repeated action (Fig. 3D; N=18 escapes, 10 mice). After the 20-minute exploration period, we simultaneously removed the obstacle and moved the shelter to the middle of the platform. As expected from a goal-directed or geometry-dependent process, escape turns differed from the two original COREs, with zero escapes targeting the obstacle edge location (P=0.5, chi-square test on homing-run turn angles; P=0.03, chi-square test on escape turn angles; Fig. 3D). Both of these experiments demonstrate a dissociation between egocentric turning movements and memory-guided escapes: distinct exploratory movements can lead to identical escape movements, and identical exploratory movements can lead to distinct escape movements.

Mice memorize subgoals at previously targeted locations: analysis

The goal-directed nature of these escapes suggests that the obstacle edges become subgoal locations. An alternative possibility, however, is that mice target the edge by learning allocentric heading directions. For example, edge-vector escapes could be generated by consistently running in the southwest or southeast direction, relative to the north-south axis connecting the shelter and the threat zone. Analysis of our data indicates that mice instead target allocentric locations. Following obstacle removal, escape heading directions follow whichever direction is required to reach the edge location (correlation between the heading direction to the edge and the heading direction taken in the escape: r=0.85, P=1.2x10-6; Extended Data Fig. 5E). This corroborates the results above, suggesting that mice learn true subgoals at the obstacle edge.

We next investigated the learning process that generates these subgoals during the spontaneous exploration period. We found two variables in the CORE-ZB with high, positive correlations to subgoal-targeting behavior: the total distance of exploratory movement on the threat side of the platform (correlation with post-removal escape targets: r=0.72, P=1x10-4; Extended Data Fig. 7A) and the number of homing runs from the threat area that directly targeted the obstacle edge (within 10 cm; correlation with post-removal escape targets: r=0.75, P=5x10-5; Fig. 4A-C). Two primary interpretations of these correlations are possible. The first is that routes are computed directly from a ‘cognitive map’: investigating the obstructed area updates the mouse’s internal map, which is reflected behaviorally in the mouse’s use of subgoals. If this were true, we would predict that: 1) investigating relevant features like the obstacle or its edge will also correlate with the subgoal memory; and 2) after obstacle removal, investigating the region where the obstacle used to be will suppress edge-vector escapes. Neither prediction matched the data. The amount of exploration near the obstacle or the obstacle edge was not correlated to subsequent escape target scores (correlation with distance moved around the obstacle: r= -0.09, P=0.7; with distance moved around the obstacle edge: r=0.06, P=0.8; Extended Data Fig. 7A). Furthermore, after obstacle removal, mice that densely sampled the empty center of the arena more did not execute different escape trajectories from mice that explored very little (correlation with distance moved around where the obstacle used to be: r= -0.12, P=0.6; with total post-removal exploration distance: r= -0.17, P=0.4; Extended Data Fig. 7A; see Extended Data Fig. 4A for examples of exploration during this period).

Figure 4. Mice memorize previously targeted subgoal locations.

Figure 4

a, Correlation of different running movements with the escape target score, in the CORE-ZB. These include homing runs from the threat area to different parts of the obstacle, as well as runs from the shelter area to the obstacle edge. Movements toward the same edge targeted in the escape (here, the right edge) are considered separately from movements toward the opposite edge (here, the left). Boxes show the correlation coefficients and respective p-values; significant correlations have green outlines. b, Homing run history for two mice in the CORE-ZB, and subsequent escape trajectories. c, Escape targets plotted against the number of spontaneous edge-vector homing runs during exploration in the CORE-ZB. As shown in panel a, these only include movements toward the same edge targeted during the escape. d, Spatial efficiency of escapes on the first trial in the presence of an obstacle (same data as in Figure 1). As in previous panels, edge vectors only include movements to the edge targeted during the escape. Zero edge vectors: N=9 escapes, 9 mice; ≥1 edge vector: N=12 escapes, 12 mice. Two-sided permutation test: P=0.04 (*). e, Escape targets plotted against the number of spontaneous edge-vector homing runs during exploration, for acute obstacle removal on the first trial. f, Chronic obstacle removal experiment without a shelter present during the 20-min exploration period. All subsequent escapes are shown on the right. g, Chronic obstacle removal experiment with an extra barrier blocking the threat area during the 20-min exploration period. All subsequent escapes are shown on the right. h, Summary of escape targets in the two modified CORE-ZB experiments. One-sided permutation test on the proportion of edge-vector escapes, compared to the open-field condition (as in Fig. 2B). No shelter condition: N=24 escapes, 10 mice; Block threat side condition: N=25 escapes, 10 mice. White squares show the median, thick lines show the IQR, and thin lines show the range excluding outliers. Distributions are kernel density estimates.

A second possibility is that learning occurs during the ‘practice’ edge-vector homings. In this case, we would predict that: 1) subgoals do not form in mice with zero edge-vector homings; and 2) the correlation with spontaneous homing runs would be specific to the edge targeted during escape (i.e., left vs. right) and to the direction taken during escapes (i.e., from the threat side to the shelter side). Both predictions were confirmed by the data. Every edge-vector escape following obstacle removal was preceded by at least one homing run targeting that same edge (100% of post-removal edge-vector escapes have ≥1 prior edge-vector run; greater than chance: P=0.02, permutation test; Fig. 4C). Second, escape targets in the CORE-ZB were not significantly correlated with homing runs from the threat area to the opposite edge (r=0.15, P=0.5), with homing-vector runs from the threat area to the middle of the obstacle (r=0.06, P=0.8), or with runs from the shelter area to the same obstacle edge (r=0.30, P=0.2; Fig. 4A).

Mice memorize subgoals at previously targeted locations: experiments

Our analysis of the CORE-ZB suggests that executing edge-vector homings, rather than sampling the environment, could be the rate-limiting step in spontaneously learning subgoals. To further test this hypothesis, we first examined whether spontaneous homings explain escape routes in the obstacle-present condition. On the first trial with an obstacle, mice with prior edge-vector homings performed more efficient escapes than mice with none (median spatial efficiency with zero runs = 0.76; with one run = 0.82; P=0.04, permutation test; Fig. 4D; same data from Figure 1). As expected, this effect was specific to runs from the threat area to the side of the obstacle used during the escape (Extended Data Fig. 7B-D). Thus, subgoal memorization does appear to play an adaptive role when perception of the obstacle is still available. Next, we examined the acute obstacle removal experiment. We could not apply correlational analysis to the acute obstacle removal after three trials since this dataset had 100% edge-vector responses and 100% prior edge-vector homings. Thus, we performed a new experiment, removing the obstacle acutely on the first trial (10±1 minutes into the session, mean±std). Here, 50% of escapes took edge-vector paths (N = 10 escapes, 10 mice; Extended Data Fig. 7E). Among the variables examined – i.e., exploration in different parts of the platform and various running movements – only the number of runs from the threat area to the edge used in the escape was significantly correlated with escape targets (r=0.71, P=0.02; Fig. 4E; Extended Data Fig. 7F-G). Furthermore, 100% of edge-vector escapes were preceded by at least one edge-vector homing (greater than chance: P=0.02, permutation test; Fig. 4E).

Next, we tested the practice-homing hypothesis with two new experiments. First, we repeated the CORE-ZB but without a shelter during the exploration period (N=24 escapes, 10 mice; Fig. 4F). This gives the mouse opportunity to observe the platform and obstacle, but without performing homings. After 20 minutes, we added the shelter and removed the obstacle as soon as the mouse entered the shelter (median [IQR] time to enter shelter: 84 [39, 154] sec). Subsequent escapes did not exhibit the subgoal memory (13% edge-vector escapes; not more edge vectors than in the open field: P=0.4, permutation test; Fig. 4F, 4H). Second, we repeated the CORE-ZB with an extra barrier blocking off the threat side of the platform during the exploration period (N=25 escapes, 10 mice; Fig. 4G). This prevents long-range homings while allowing investigation of the obstacle. Only 1/10 mice targeted the edge location with scores close to 1.0, and post-removal escapes did not significantly differ from the open-field control (20% edge-vector escapes; not more edge vectors than in the open field: P=0.2, permutation test; Fig. 4G-H). Both experiments thus demonstrated that merely investigating the obstacle does not lead to memorizing subgoals; they therefore lend support to the hypothesis that subgoal locations are instead learned through practice homings.

Spontaneous edge-vector runs are instinctive exploratory actions

It remains unclear what prompts spontaneous edge-vector homings in the first place. One possibility is that, during practice homings, a cognitive map is used to compute efficient routes to shelter; this could allow mice to target a subgoal for the first time, at which point that location could be memorized for use in subsequent escapes. Another possibility is that mice are innately predisposed to run to visually salient obstacle edges. Our data support the latter option. Spontaneous edge-directed movement occurs most during the first few minutes of the session and occurs equally with or without a shelter in the environment (Extended Data Fig. 8A-B). When the obstacle is a hole instead of a wall (Extended Data Fig. 2B), edge-directed movement is much less frequent, occurring at the same rate as in the open field (computed relative to the location where the obstacle edges would be if the obstacle were present; Extended Data Fig. 8B). Correspondingly, it takes twice as long for mice to learn to perform predominantly edge-vector escapes in the presence of a hole obstacle (20% edge-vectors escapes on trial 2-3, 67% edge-vector escape on trial 6-7; Extended Data Fig. 8C-D).

Subgoal learning also supports food-seeking routes

While subgoal memorization enhances spatial efficiency in a static environment, it also generates unnecessarily roundabout routes past an obstacle that no longer exists. In fact, edge-vector escapes can persist over at least 20 minutes and 7 trials following obstacle removal (Extended Data Fig. 9A-B). We considered that subgoal memorization may be specific to escape behavior, as mice might sacrifice flexibility for the sake of quickly reacting to imminent threats. To test this, we performed an obstacle removal experiment in the context of a less urgent, reward-based task (open-field control: N=32 reward runs, 6 mice; obstacle removal: N=34 reward runs, 6 mice). First, we trained food-deprived mice to approach and lick a reward port in response to a 10-kHz tone, which indicated the availability of condensed milk at the port. This took place across 5 sessions, in an operant conditioning box (Extended Data Fig. 10A-C). Next, we transported this task to the platforms previously used for escape behavior. The shelter was replaced by the reward port, and the threat stimulus was replaced by the 10-kHz tone (Fig. 5A). To start the session, mice were given 20 minutes in the obstructed environment (or in the open-field control environment) with ~1 baseline food-approach trial per minute. Next, we removed the obstacle (or simply continued the session in the open-field condition), triggered food-approach trials (5±3 minutes after obstacle removal, mean±std), and recorded the resulting food-seeking routes (Fig. 5A). At this point, mice successfully ran to the reward port during tone presentation on 85% of trials, but with slower reaction times than escape (median [IQR] time to start running toward the goal for food-seeking = 1.5 [0.7, 3.5] sec; for threat response = 0.6 [0.4, 1.2] sec; P=0.005, permutation test). Similar to escape routes, a large proportion of paths in the obstacle-removal condition initially targeted the obstacle edge location (53% edge vectors; P=0.006 compared to 12% in the open-field control session, permutation test; Fig. 5A-B; Supplementary Video 9; see Supplementary Figure 2 for correlations of food-seeking target with time, trial, and exploratory behavior).

Figure 5. Experience with an obstacle changes food-seeking but not exploratory trajectories.

Figure 5

a, Food-approach paths in response to a 10-kHz tone associated with the availability of condensed milk at a reward port. An example trial is shown on top, and all paths are shown below. The red circle with ‘R’ represents the reward location, i.e. the metal spout with milk. The dotted line indicates the location of the obstacle during the initial 20-minute period. b, Summary data for food-seeking paths, computed the same way as escape targets. One-sided permutation test on the proportion of edge-vector paths: P=0.006 (**). Open field: N=32 reward runs, 6 mice; obstacle removed: N=34 reward runs, 6 mice. c, Paths across the platform during spontaneous exploration in the escape experiments. All paths go from the ends of the platform toward the center. Conditions with more sessions are randomly downsampled so that the same number of paths is displayed for each condition. d, The number of spontaneous center-directed and edge-directed movements during exploration. One-sided permutation test on the number of edge-directed movements; obstacle vs. open field: P=2x10-5 (***); obstacle removed vs. open field: P=0.9. Obstacle: N=24 mice; obstacle removed (CORE with 0 and with 3 baseline trials): N=20 mice; open field: N=10 mice. White squares show the median, thick lines show the IQR, and thin lines show the range excluding outliers. Distributions are kernel density estimates.

Finally, we tested whether experience with the obstacle induces a non-specific increase in edge-directed movement, as this could explain the apparent use of subgoal memorization across two distinct tasks. We compared spontaneous movements from the ends of the platform toward the center and obstacle edge locations. Exploration following obstacle removal was not enriched in edge-directed movements (number of edge-directed movements per 15 min: median with the obstacle present =10; after obstacle removal = 3; in the open field = 4; P=2x10-5, permutation test on open field vs. obstacle; P=0.9, permutation test on open field vs. obstacle removed; Fig. 5C-D). Subgoal memorization therefore reflects a strategy for goal-directed navigation rather than a general bias in how mice move around their environment following experience with an obstacle.

Discussion

During their first few minutes in an obstructed environment, mice escaped to shelter by relying on their memory of the shelter location and their innate ability to negotiate barriers using vision and touch. These escape routes were spatially inefficient; they resembled obstacle avoidance in animals with lower cognitive capacities, such as toads, crabs, and ant colonies2325. Over a single 20-minute session, however, mice began to exploit their aptitude for spatial memory. They increasingly targeted the obstacle edge directly and could do so even in complete darkness or after the obstacle had been removed. We found that this capacity relied on memorizing allocentric subgoal locations rather than egocentric turning movements, and our data further suggested that mice identified and memorized subgoals during spontaneous homing runs.

Previous work has shown that rodents use spatial memory to navigate to shelter in an open field17,19,20. In such a simple environment, however, escape routes can be implemented by path integrating self-motion cues to keep track of a single vector to the shelter location – a one-step, egocentric process. With obstacles in the environment, a more advanced strategy is needed. Previous results in gerbils escaping in an obstructed environment suggested that spatial memory was employed to reach the shelter22, but their navigational strategy was unknown. Our results show that mice use subgoals in an allocentric reference frame. Several observations support this view. First, mice can accurately target the edge location minutes after the obstacle or the lights have been removed, which is not well explained by pure path integration. Second, escapes involved immediately orienting and running toward a subgoal ~50 cm away, which is not consistent with following odor trails or gradients26,27. Finally, repeating stereotyped turning movements or allocentric heading directions did not explain memory-guided escape paths in our assay; instead, mice consistently targeted the edge location. Future experiments on how escape routes transfer across days, types of obstacle, spatial scales and tasks will help to specify the nature of this allocentric schema and how it is updated.

Traditional models of allocentric navigation involve three key elements: an internal map of the environment (located in the hippocampus and entorhinal cortex), a stored goal location, and a mental search for paths to the goal79,28. The limiting factor is the quality of the map. Finding efficient multi-step routes – be it through a tree-search algorithm7,8, a map-partitioning algorithm9, or warping around an ‘obstacle-to-avoid’ feature28 – can occur as soon as the map faithfully reflects the current environment. To build up this map, animals simply have to investigate unfamiliar or altered parts of the environment. The amount of exploratory movement thus matters for spatial learning, but movements’ intentions or directions do not28 (Cf. reference29). Our observations of escape routes in naïve mice do not support such views of allocentric learning. In our data, none of the following was sufficient to generate subgoals: 1) spending time exploring the obstacle; 2) running along the homing-vector path and then being blocked by the obstacle; 3) learning a subgoal at the other obstacle edge; 4) targeting the obstacle edge while running away from the shelter; 5) investigating the obstacle in the absence of a shelter; and 6) investigating the obstacle while the threat area was blocked off. Furthermore, investigating the formerly obstructed area following obstacle removal did not restore direct homing-vector responses.

The subgoal strategy does contain elements of classical map-based navigation: it is learned in all-or-none fashion and depends on a sense of allocentric space, i.e. a ‘map’; however, it also includes a component similar to taxon navigation, in which animals learn inflexible routes based on previous goal-directed movements11. Hybrid strategies – combining rapid learning, inflexible routes, and special ‘learning movements’ – have been discovered before, as in the orientation flights of wasps30. However, orientation flights entrain one-step routes to a visual beacon; here, we find that learning movements are used to entrain multi-step routes to an obstructed goal. Our working model is that mice instinctively execute visually guided movements toward a salient wall edge; if this movement gives the mouse direct access to a subsequent goal (e.g., the shelter), then its target is memorized as a subgoal location. We hypothesize that a rapid, all-or-none learning rule works on practice homings, but further experiments should be done to test the causal role of this putative moment of insight.

Memorizing subgoals confers distinct survival advantages: it can drive escape routes with the optimality of map-based planning and the rapidity of instinctive responses. However, this strategy is less flexible than responding to sensation or updating maps. The steady persistence of ~50% biphasic escapes for tens of minutes after removing the obstacle was longer than expected, and it remains unclear how mice learn to reinstate the homing-vector response after obstacle removal. Responses to imminent predatory threats are known to favor quick reaction times at the expense of computational sophistication31, and so this inflexible strategy could in principle be specific to defensive behavior. However, we found that it was also used in a less urgent food-seeking task. Thus, subgoals appear to be a general building block for quickly learning spatial locations important for survival.

Subgoal learning bears some resemblance to hierarchical reinforcement learning, a technique in artificial intelligence for learning multi-step behaviors32. However, the learning process we have observed in mice does not fit cleanly into the dominant ‘model-free vs. model-based’ framework for reinforcement learning agents (Cf. reference8). Rather, it fuses action repetition with a model of space: mice discover a map of individual subgoals through targeted exploration and learning heuristics.

Finally, our results provide an alternative entry point to studying the neural mechanisms of spatial learning. Experiments with constrained behaviors and open-field environments have been crucial for the spatial-memory field; they uncovered the hippocampal formation’s key role in allocentric spatial memory11, identified important activity dynamics in the hippocampus3335, and demonstrated the dorsal striatum’s involvement in repeating inflexible routes36,37. However, models of navigation based on these data remain limited in their applicability to real-world learning. To improve on this, future work will benefit from an understanding of spontaneous learning strategies and complex behaviors3840. Probing brain activity during spontaneous subgoal memorization presents one such opportunity for reconciling neural models with natural learning. This behavior’s rapid learning profile and reliable, stimulus-locked routes make it particularly tractable for testing theories of hippocampal and striatal functions and of the neural dynamics that underlie them.

Methods

Animals

All experiments were performed under the UK Animals (Scientific Procedures) Act of 1986 (PPL 70/7652) following local ethical approval by the Sainsbury Wellcome Centre Animal Welfare Ethical Review Body. We used 158 singly housed (for ≥1 week), male, 8-12-week-old C57BL/6J mice (Charles Rivers) during the light phase of the 12-h light-dark cycle. Mice were housed at 22°C and 55% relative humidity with ad libitum access to food and water. For the main experiments, data come from the mice’s first-ever behavioral session. Table 1 describes all groups of mice used for this study, including the experimental conditions, any excluded mice, and re-use across experiments.

Table 1. All groups of mice and all experimental conditions.

Mice that were excluded generally stayed inside of the shelter instead of exploring. This is more common in mice with more previous experience. Previous stimulus experience refers to previous trials and sessions from an experiment higher up on the list. For example, “3 trials (Obstacle)” come from the “Obstacle” condition listed higher up in the table.

Environment Light # of mice Excluded - no
threat zone entry
Previous stimulus
experience
Time
before
trial 1
Data location
Open field On 10 0 None 10 min F1, EDF 2, F5, EDF 10
Obstacle On 24 0 None 10 min F1, EDF 2, F4, EDF 6, F5, EDF 10
Hole obstacle On 8 0 None 10 min EDF 2, EDF 7
Obstacle rises acutely On 10 5 3 trials (Open field) 20 min EDF 3
Obstacle rises acutely On 9 4 1 session + 3 trials
(Open field)
20 min EDF 3
Open field Dark 14 0 None 10 min EDF 3
Obstacle Dark 14 0 None 10 min EDF 3
Obstacle 10 min on then dark 14 0 None 10 min EDF 3
Obstacle 20 min on then dark 14 0 3 trials (Obstacle) 20 min EDF 3
Acute obstacle removal
trial 4
On 10 2 3 trials (Obstacle) 20 min F2
Chronic obstacle removal (CORE) #1 (CORE-3B) On 10 2 3 trials (Obstacle) +
1 trial (Acute removal)
20 min F2, F4A, EDF 8, F5,
EDF 10
CORE #2 (zero baseline escape trials; CORE-ZB) On 10 0 None 20 min F2, F3, EDF 5, F4, EDF 6,
EDF 8, F5, EDF 10
Square w/ short obstacle On 12 3 1 session 10 min F2, EDF 4
Square w/ long obstacle On 12 4 1 session 10 min F2, EDF 4
Square w/ lengthened obstacle On 9 0 1 session + 3 trials (long obstacle) 20 min F2, EDF 4
Square w/ shortened
obstacle
On 12 3 1 session + 3 trials (short obstacle) 20 min F2, EDF 4
Narrow corridors On 10 0 1 session 20 min F3, EDF 5
CORE #3 (additional short
barrier)
On 10 0 None 20 min F3
CORE #4 (move the
shelter)
On 10 0 None 20 min F3
Acute obstacle removal
trial 1
On 10 0 None 10 min F4, EDF 6
CORE #5 (no shelter at
first)
On 10 0 None 20 min F4, EDF 7
CORE #6 (additional long
barrier)
On 10 0 None 20 min F4
Open field (no shelter) On 6 0 1 session n/a EDF 7
Obstacle (no shelter) On 6 0 1 session n/a EDF 7
Hole obstacle (no shelter) On 7 0 1 session n/a EDF 7
Open field (food seeking) On 6 0 5 training sessions
(conditioning box)
20 min F5, EDF 9, EDF 10
CORE #7 (food seeking) On 6 0 training + 1 session
(open field food)
20 min F5, EDF 9, EDF 10

Behavioral platforms

The main platform was an elevated white acrylic circular platform 92 cm in diameter (Extended Data Fig. 2A). The platform had a 51 cm x 1 cm hole in its center; through this hole, the obstacle (white acrylic, 50 cm long x 12.5 cm tall x 0.5 cm thick) could be raised (obstacle condition) or lowered (open field condition). For experiments in which the obstacle appears or disappears, this was done by digitally triggering a custom-made pneumatic tubing system (time to raise or lower the obstacle was ~100 ms; Supplementary Video 10). In the acute obstacle removal experiment, this was triggered simultaneously with the stimulus onset. In chronic obstacle removal experiments, this was triggered while the mouse was in the shelter. Obstacle removal makes a “whooshing sound” (63 dB measured at the shelter) and usually triggers a startle response. The presence or absence of this response was unrelated to subsequent expression or extinction of the subgoal memory. The hole obstacle consisted of a 50 cm long x 10 cm wide rectangular hole in the center of the platform (Extended Data Fig. 2B). The modified platform with two narrow corridors consisted of the original platform with the obstacle, plus six additional panels (schematic in Extended Data Fig. 5B). Four of these panels were 50 cm long x 12.5 cm tall x 0.5 cm thick, and two were 12.5 cm long x 12.5 cm tall x 0.5 cm thick.

Together, they formed two corridors that were 50 cm long x 7.5 cm wide and were at 65° and 115 ° angles relative to the axis of the central obstacle. The interior panels forming the corridor were made of red acrylic so that the IR camera could see through them; all other panels were made of white acrylic. The platform in the sideways-moving-obstacle experiment was an elevated white acrylic square platform 80 cm x 80 cm. The obstacle (white acrylic, 70 cm long x 12.5 cm high x 0.5 cm thick) was manually pulled to the “short” condition (obstructing 48 cm) or to the “long” condition (obstructing 66 cm) while the mouse was in the shelter. The shelter was a 10 cm cube of transparent red acrylic (opaque to the mouse). It included a mouse-hole-shaped entrance at the front and additional 2.5 cm tall square of red acrylic on top in order to prevent the mice from climbing on top. The platform was surrounded by a black, square, plastic surrounding. A projector screen was located above the platform. The platform was illuminated with 4 infrared lights (S8100-45-A-IR, Fuloon). Experiments shown in Extended Data Fig. 3 and Supplementary Video 5 were performed in complete darkness (0.00 cd/m2 of visible light). At this light level, mice did not react to rapidly waving a hand in front of them, which is perceived as highly threatening when light is available. For all other experiments, light was projected onto the screen at 5.2 cd/m2 using a projector (PF1000U, LG). Note that the room was not totally sonically insulated and that neither the black surround nor the overhead illumination was circularly symmetric; these asymmetries could all provide spatial orientation cues. The platform and shelter were cleaned with 70% ethanol after each session.

Escape behavior

Animals were given a 7-minute acclimation period during which they discovered the shelter. Stimuli were subsequently delivered when the mouse entered the threat zone (the back 20 cm, on the end opposite from the shelter) and was generally facing away from the shelter. Only stimuli delivered in this zone were analyzed. At least one minute was allowed in between trials. Threat stimuli were loud (87 dB), unexpected crashing sounds played from a speaker located 1m above the center of the platform (Supplementary Audio 1-2). Sounds (“smashing” and “crackling fireplace”) were downloaded from soundbible.com. They were then edited using Audacity 2.3.0 such that they were 1.5 seconds long and continuously loud. Stimuli were alternated between the “smashing” sound and the “crackling” sound to prevent stimulus habituation. In some sessions (four with and four without an obstacle), we used an ultrasonic sweep stimulus (17-20 kHz, 3 sec). No difference in response between the stimuli was observed and therefore the data from these sessions were pooled. For each trial, the stimulus was triggered repeatedly until the mouse reached the shelter, for a maximum 9 seconds. Since escapes take longer with the hole obstacle and in the dark, stimuli in these conditions were played for up to 12 seconds. Stimulus responses were considered escapes if the mouse reached the shelter within 12 seconds in the light or 18 seconds for the hole obstacle and for the dark. In order to distinguish escape behavior from exploration-like routes, the rare trials in which, after initiating the escape, the mouse moved back toward the threat zone on average over a 2-second period were not counted as escapes.

Stimulus delivery was controlled with software custom-written in LabVIEW (2015 64-bit, National Instruments). Stimuli were triggered manually, when the mouse had been in the threat zone (demarcated on the live video) for at least one second and was facing in approximately the opposite direction from the shelter. While manual stimulation could be a source of bias, we found that mice executing homing-vector vs. edge-vector escapes did not have significantly different starting positions or heading directions, limiting the impact that this bias could have (Supplementary Fig. 1A-C). We also found that the obstacle-removal experiments with differing results did not exhibit significantly different starting positions or orientations (Supplementary Fig. 1D). The sound was played from the PC, through an amplifier (TOPAZ AM10, Cambridge Audio) and speaker (L60, Pettersson). The audio signal was fed in parallel through a breakout board (BNC-2110, National Instruments) into a multifunction I/O board (PCIe-6353, National Instruments) and sampled at 10 KHz. To synchronize the audio and video, this signal was compared to the 30 Hz pulse triggering video frame acquisition, which was also fed as an input to the input/output board and sampled at 10 KHz. To verify correct synchronization, in most experiments the audio output cable was also fed in parallel to an infrared LED (850nm OLSON PowerStar IR LED), which flashed in synch with sound presentation. Mice varied in how many trials they performed in each experiment, due either to remaining in the shelter rather than entering the threat zone or not escaping in response to the stimulus (7% of trials). We thus limited analysis to the first three escapes in each condition (more than 50% of mice completed at least three escapes in all experiments).

Food-seeking behavior

Mice were food restricted to 85% of their baseline weight. Training and pretraining were done in a 60cm x 15cm rectangular arena, with a shelter on one side and a reward port on the other side. The reward consisted of a 7-µL drop of condensed milk (diluted 1:1 with water) delivered through the spout. For pretraining, during which the mouse learned to associate the metal spout with reward, 100 drops of milk were manually triggered and then collected by the mouse, with a minimum interval of 1 minute between each drop. They were then trained in five, ~1-hour sessions to approach and lick a metal spout in response to a 9-second, 10-kHz, 72-dB tone. Tone stimuli were triggered manually once per minute. Licking the spout while the tone was on resulted in reward. After reward delivery, there was a 5-second refractory period; thus, mice could trigger at most two rewards during the 9-second tone. On the last two day of training, the tone duration was reduced to 4.5 seconds after 30 minutes. Licks were registered with a capacitive touch sensor (Adafruit MPR121), connected to a microcontroller board (Arduino Uno). The milk was delivered through a peristaltic pump (Campden Instruments 80204E), connected to the same microcontroller. For testing food-seeking paths, these mice had two sessions. The first session was in the platform with no obstacle, the shelter on one side, and a lick port on the opposite end of the platform. They received “practice trials” of tone and milk, from throughout the platform bur initially mostly when they were already near the lick port. After 20 minutes, test trials were initiated when the mouse was on the opposite side from the lick port, and these data were used for analysis. The second session followed the same protocol. However, in this session the obstacle was initially present, and then was removed after 20 minutes while the mouse was in the shelter. Mice performed more trials than with the escape behavior, so here we examined trajectories from the first eight successful trials (50% of mice completed at least eight trials).

Video tracking and visualization

Videos were acquired at 30 frames per second using an overhead camera (acA1300- 60gmNIR, Basler) with a near-infrared-selective filter. Video recording was performed with software custom-written in LabVIEW (2015 64-bit, National Instruments). Videos were then fisheye-distortion corrected, aligned onto a common coordinate framework, and visualized with custom Python code using the OpenCV library41 (Supplementary Video 1). We used DeepLabCut42 to track the mouse from the video, after labelling 1500 frames with 13 body parts: snout, left eye, right eye, left ear, neck, right ear, left upper limb, upper back, right upper limb, left hind limb, lower back, right hind limb, tail base. Post-processing includes removing low-confidence tracking, using a median filter with a width of 7 frames, and applying an affine transformation to the tracked coordinates to match the common coordinate framework.

Analysis

All analysis was done using custom software written in Python 3.6 as well as open-source libraries, notably OpenCV and scikit-learn41,43.

Calculating position, speed, and allocentric heading direction

(Supplementary Video 11): For analysis of trajectories and exploration, we used the center of the mouse. This was calculated as the average of all 13 points, which we found to be more stable and consistent than using any individual point. To determine the mouse’s speed for the color-coded visualizations, we smoothed the raw frame-by-frame speed with a gaussian filter (sigma = 3 frames = 0.1 sec). To calculate the mouse’s heading direction, we computed the vector between the center of the body (averaging the tail base, right hind limb, lower back, left hind limb, right upper limb, upper back, and left upper limb points) and the front of the body (averaging the left upper limb, upper back, and right upper limb points). We set the south direction (threat to shelter) to 0°, north (shelter to threat) as 180°, and east/west (left/right sides) as ±90°.

Quantification of escape targets:

The initial escape target was computed by taking the vector from the mouse’s position at the escape initiation to its position when it is 10 cm in front of the obstacle. For the hole obstacle, this means 10 cm in front of the obstacle’s outer perimeter, rather than its center. We computed a target score where a vector aimed directly at the shelter received a value of 0; one aimed at either obstacle edge received a value of 1.0; a vector halfway between these would score 0.5; and a vector that points beyond the edge would receive a value greater than 1.0. The formula is: target=abs(offsetHVoffsetEV+offsetHVEV2offsetHVEV), where offsetHV is the distance from the mouse to where the mouse would be if it took the homing vector, offsetEV is the distance from the mouse to where the mouse would be if it took the obstacle-edge vector, and offsetHV-EV is the distance from the homing-vector path to the obstacle-edge-vector path. Only the obstacle edge closest to the escape path was considered. Initial food-approach trajectories and spontaneous exploration trajectories were analyzed in the same manner. The threshold for classifying a trajectory as an edge vector was the 95th percentile of escapes in the open-field condition (0.65), which is equivalent to the 10th percentile of escapes on trial 3 with the obstacle. The rest were designated as homing vectors. Thus, we are slightly more conservative in labeling “edge vectors” (beyond the open field distribution with 95% confidence) than in labeling “homing vectors” (beyond the third obstacle escape distribution with 90% confidence). For examining the effect of experience on spontaneous exploration, we used a threshold of 0.5 to distinguish center-directed and edge-directed movements. In the narrow corridor experiment, a vector aimed at the left corridor opening received a value of 0, and a vector aimed at the left corridor opening received a value of 1.0. For the experiment in which the obstacle rises up unexpectedly during threat, putative visual avoidance is defined to occur when the mouse turns on average toward an obstacle edge, while it is in the region between 5-10 cm away from the obstacle. Putative tactile obstacle avoidance is defined to occur when the mouse turns toward an obstacle edge only after its head is already within 5 cm of the obstacle.

Extraction of homing runs and escape initiation points

Homing runs are continuous turn-and-run movements from the threat side of the platform toward the shelter side. They are defined as a series of movements that continuously bring the mouse closer to the shelter or obstacle edges. They are extracted by: 1) computing the mouse’s “homing speed”, i.e. speed with respect to the shelter or obstacle edges with gaussian smoothing (σ=0.5 sec) and the mouse’s “shelter turning speed”, i.e. rate of change of heading direction with respect to the shelter; 2) identifying all frames in which the mouse has homing speed ≥ 10 cm/sec or is turning toward the shelter at an angular speed ≥ 90°/sec; 3) selecting all frames within 1 second of these frames to include individual frames that might be part of the same homing movement but do not meet the speed criteria; 4) rejecting all frames in which the mouse is not approaching or turning toward an edge or the shelter; 5) rejecting sequences that do not decrease the distance to the shelter by at least 30%. Each series of frames that meet these criteria represents one homing run. The homing runs we analyzed were those that started within 5 cm of the threat zone (the “threat area”) and ended with 5 cm of the central axis (i.e., along the obstacle). The homing target location is where a homing run crosses a line parallel to and 5 cm in front of the obstacle. Edge-vector targets occur when this location is within 10 cm to the left or right of the obstacle edge. The escape initiation point is defined as the beginning of a homing run that goes from inside the threat zone to outside of the threat zone following a threat stimulus. This is computed in the same way for spontaneous homings. In practice, the escape initiation point occurs when the mouse starts turning to run along the path that leads it out of the threat zone. We use this this criterion because it allows us to fairly compare spontaneous and stimulus-evoked homings, it correctly rejects initial post-stimulus movement bouts directed away from the shelter, and it correctly identifies the beginning of a turn- and-run movement as verified by manual inspection of the videos. Illustration of the escape initiation points for the main experiments are displayed in Extended Data Fig. 6. To characterize the urgency of the task based in the escape task vs. in the food task, we use the metric of the time until running toward the goal. This is when the mice cross a threshold on the homing speed of ≥20 cm/sec.

Quantification of turning angles

Turning angles that initiated homing runs and escapes were taken as the difference between the mouse’s heading direction at the start of the movement (the homing-run or escape initiation point) and the mouse’s heading direction after it had traveled 15 cm away from this start location. The start location is when the mouse starts turning toward and/or moving toward the shelter or obstacle edge (see previous subsection). Left turns were defined as negative, and right turns were defined as positive. For predicting escape targets from turn movements, we first extracted all homing runs from the mouse’s previous exploration experience. We then identified the 1-3 homing runs most similar to the escape, using three different similarity metrics: the most similar turn angle, the closest starting position, and closest initial heading direction. For each homing run-escape pair, we computed what the escape target would have been if the mouse had turned the same angle that it had turned during the homing run, i.e. if it had repeated the previous egocentric action. Finally, we performed a linear regression between the predicted targets (x) and the actual escape targets (y) to find the proportion of variance (R2) in escape targets predicted using this assumption that mice repeat previous egocentric turns. R2=1i(yiy^)2i(yiy¯)2, where y¯ is the mean escape target and ŷ is the predicted escape target based on the linear regression. For the negative control, we disregarded the homing experience and instead predicted a random turn angle, and then extrapolated that angle to predict an escape target. We repeated this procedure 1000 times to get 1000 R2 values and took the mean R2.

Quantification of exploration

The time spent exploring was computed as the time spent at least 5 cm away from the shelter. The amount of exploration, or distance explored, was the time exploring multiplied by the mouse’s speed at each time point. Mice spent ~ 1/3 of the session in the shelter (IQR: 20-52% of the time). Spontaneous exploratory traversals are paths during exploration that start at either end of the platform (within 20 cm the end) and then reach within 10 cm of the central x-axis. Traversals that go along the boundary of the platform (i.e. within 10 cm of the outer perimeter) or take longer than 2 seconds (~10 cm/sec) were excluded from analysis, as these paths contained pausing and looping behavior, hindering the analysis of trajectories.

Statistics

For permutation tests, the test statistic is the group mean difference (e.g. in escape target or path efficiency). The condition of each mouse (e.g. open field vs obstacle) is randomly shuffled 10,000 times to generate a null distribution and a p-value. We used this test because it combines two distinct advantages: 1) Because the test statistic is the group mean, this test gives weight to each trial that a mouse performs rather than collapsing each animal’s data into one mean or improperly pooling trials (unlike the t-test or the Mann-Whitney test). 2) It is non-parametric and does not assume gaussian noise (unlike the repeated-measures ANOVA), in line with much of our data. Tests for differences in efficiency, reaction time, and initial escape conditions were two-tailed; tests for targets being biased toward previous experience were one-tailed. A different test statistic was used for the permutation test testing the significance of the result that 100% of memory-guided edge-vector escapes had at least one prior edge-vector homing. In this test, the p-value reflects the proportion of random subgroups of all trials that also score 100%. For the CORE-ZB (23 escapes, 13 edge-vector escapes), the p-value 0.02 indicates a 2% chance that every member of a random sub-group of 13/23 escapes has ≥1 prior edge-vector movement. The ANOVA was performed using the linear mixed effects model package in R, after removing outliers (z-score > 0.975). The normality assumption was tested using the Shapiro–Wilk test. Fisher’s exact test was performed for cases with one trial per mouse and a categorical outcome. The Pearson correlation coefficient was used for correlation analyses. R2 values report the percent of the variance explained by the two variables’ linear relationship and is equivalent to the square of their Pearson correlation coefficient. Sample sizes for initial experiments were not predetermined but were chosen to be similar to previous publications14, 15,17, 18. Subsequently, a power analysis was carried out based on estimated means and variances across conditions and a minimum power of 0.8, determining sample sizes of 10 animals in the light and 14 in the dark. The range illustrated in boxplots are limited from the first quartile minus 1.5 x IQR to the third quartile plus 1.5 x IQR. Statistically significant results are indicated in the figures using *P < 0.05, **P < 0.01 ***P < 0.001.

Extended Data

Extended Data Fig 1.

Extended Data Fig 1

Extended Data Fig 2.

Extended Data Fig 2

Extended Data Fig 3.

Extended Data Fig 3

Extended Data Fig 4.

Extended Data Fig 4

Extended Data Fig 5.

Extended Data Fig 5

Extended Data Fig 6.

Extended Data Fig 6

Extended Data Fig 7.

Extended Data Fig 7

Extended Data Fig 8.

Extended Data Fig 8

Extended Data Fig 9.

Extended Data Fig 9

Extended Data Fig 10.

Extended Data Fig 10

Supplementary Material

Extended Data Fig. 1
Extended Data Fig. 2
Extended Data Fig. 3
Extended Data Fig. 4
Extended Data Fig. 5
Extended Data Fig. 6
Extended Data Fig. 7
Extended Data Fig. 8
Extended Data Fig. 9
Extended Data Fig. 10
Supplementary Audio 1
Download audio file (129.7KB, wav)
Supplementary Audio 2
Download audio file (129.6KB, wav)
Supplementary Video 1
Download video file (16.7MB, mp4)
Supplementary Video 2
Download video file (6.2MB, mp4)
Supplementary Video 3
Download video file (11MB, mp4)
Supplementary Video 4
Download video file (4.4MB, mp4)
Supplementary Video 5
Download video file (10MB, mp4)
Supplementary Video 6
Download video file (11.5MB, mp4)
Supplementary Video 7
Download video file (4.8MB, mp4)
Supplementary Video 8
Download video file (12.1MB, mp4)
Supplementary Video 9
Download video file (10.6MB, mp4)
Supplementary Video 10
Download video file (6.5MB, mp4)
Supplementary Video 11
Download video file (11.5MB, mp4)

Reporting Summary.

Further information on research design is available in the Nature Research Reporting Summary linked to this article.

Acknowledgments

This work was funded by a Wellcome Senior Research Fellowship (214352/Z/18/Z) and by the Sainsbury Wellcome Centre Core Grant from the Gatsby Charitable Foundation and Wellcome (090843/F/09/Z) (T.B.), and the SWC PhD Programme (P.S. and S.O.). We thank members of the Branco lab and T. Mrsic-Flogel for discussions; J. Rapela for advice on statistical analysis; T. Mrsic-Flogel, T. Behrens, C. Barry, M. Stephenson-Jones, Y. Isogai, C. Clopath, Y.L. Tan, F. Claudi, R. Vale, and three anonymous reviewers for comments on the manuscript; the SWC Neurobiological Research Facility and FabLabs for technical support; K. Betsios for programming the data acquisition software.

Footnotes

Author contributions statement

P.S. and T.B. conceived the project, designed the experiments, and wrote the manuscript. P.S. performed the escape experiments with help from P.I. P.S. analyzed the data. D.C. and N.B. designed the food reward training protocol. S.F.O. and P.S. performed the food reward experiments.

Competing interests statement

The authors declare no competing interests.

Data availability

Data supporting the findings of this study (mouse tracking data and stimulus information) are available from figshare.com: figshare.com/articles/dataset/Subgoal_paper_data_zip/14610135. Any additional data are available from the corresponding author upon request.

Code availability

The custom code used to perform analysis for this study is available from github.com/BrancoLab/escape-analysis. Code for registering videos to a common coordinate framework is available from github.com/BrancoLab/Common-Coordinate-Behaviour, and code for creating the visualizations found in the figures and supplementary videos is available from github.com/BrancoLab/escape-visualization.

References

  • 1.Lima SL, Dill LM. Behavioral decisions made under the risk of predation: a review and prospectus. Can J Zool. 1990;68:619–640. [Google Scholar]
  • 2.Drickamer Lee C, Stuart J. Peromyscus: Snow Tracking and Possible Cues Used for Navigation. American Midland Naturalist. 1984;111:202. [Google Scholar]
  • 3.McMillan BR, Kaufman DW. Travel path characteristics for free-living white-footed mice (Peromyscus leucopus) Can J Zool. 1995;73:1474–1478. [Google Scholar]
  • 4.Benhamou S. An analysis of movements of the wood mouse Apodemus sylvaticus in its home range. Behavioural Processes. 1991;22:235–250. doi: 10.1016/0376-6357(91)90097-J. [DOI] [PubMed] [Google Scholar]
  • 5.Thompson SD. Spatial Utilization and Foraging Behavior of the Desert Woodrat, Neotoma lepida lepida. Journal of Mammalogy. 1982;63:570–581. [Google Scholar]
  • 6.Morris RGM. Spatial localization does not require the presence of local cues. Learning and Motivation. 1981;12:239–260. [Google Scholar]
  • 7.Edvardsen V, Bicanski A, Burgess N. Navigating with grid and place cells in cluttered environments. Hippocampus. 2020;30:220–232. doi: 10.1002/hipo.23147. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Spiers HJ, Gilbert SJ. Solving the detour problem in navigation: a model of prefrontal and hippocampal interactions. Front Hum Neurosci. 2015;9 doi: 10.3389/fnhum.2015.00125. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Stachenfeld KL, Botvinick MM, Gershman SJ. The hippocampus as a predictive map. Nature Neuroscience. 2017;20:1643–1653. doi: 10.1038/nn.4650. [DOI] [PubMed] [Google Scholar]
  • 10.Tolman EC. Cognitive maps in rats and men. Psychological Review. 1948;55:189–208. doi: 10.1037/h0061626. [DOI] [PubMed] [Google Scholar]
  • 11.O’Keefe J, Nadel L. The hippocampus as a cognitive map. Clarendon Press; Oxford University Press; 1978. [Google Scholar]
  • 12.Etienne AS, Jeffery KJ. Path integration in mammals. Hippocampus. 2004;14:180–192. doi: 10.1002/hipo.10173. [DOI] [PubMed] [Google Scholar]
  • 13.Restle F. Discrimination of cues in mazes: A resolution of the ‘place-vs.-response’ question. Psychological Review. 1957;64:217–228. doi: 10.1037/h0040678. [DOI] [PubMed] [Google Scholar]
  • 14.Sutherland RJ, Dyck RH. Place navigation by rats in a swimming pool. Canadian Journal of Psychology/Revue canadienne de psychologie. 1984;38:322–347. [Google Scholar]
  • 15.Hamilton DA, Rosenfelt CS, Whishaw IQ. Sequential control of navigation by locale and taxon cues in the Morris water task. Behavioural Brain Research. 2004;154:385–397. doi: 10.1016/j.bbr.2004.03.005. [DOI] [PubMed] [Google Scholar]
  • 16.Escaping From Predators: An Integrative View of Escape Decisions. Cambridge University Press; 2015. [DOI] [Google Scholar]
  • 17.Vale R, Evans DA, Branco T. Rapid Spatial Learning Controls Instinctive Defensive Behavior in Mice. Current Biology. 2017;27:1342–1349. doi: 10.1016/j.cub.2017.03.031. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Yilmaz M, Meister M. Rapid Innate Defensive Responses of Mice to Looming Visual Stimuli. Current Biology. 2013;23:2011–2015. doi: 10.1016/j.cub.2013.08.015. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Alyan S, Jander R. Short-range homing in the house mouse, Mus musculus: stages in the learning of directions. Animal Behaviour. 1994;48:285–298. [Google Scholar]
  • 20.Etienne AS, Teroni E, Maurer R, Portenier V, Saucy F. Short-distance homing in a small mammal: the role of exteroceptive cues and path integration. Experientia. 1985;41:122–125. [Google Scholar]
  • 21.Harrison FE, Reiserer RS, Tomarken AJ, McDonald MP. Spatial and nonspatial escape strategies in the Barnes maze. Learning & Memory. 2006;13:809–819. doi: 10.1101/lm.334306. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Ellard CG, Eller MC. Spatial cognition in the gerbil: computing optimal escape routes from visual threats. Animal Cognition. 2009;12:333–345. doi: 10.1007/s10071-008-0193-9. [DOI] [PubMed] [Google Scholar]
  • 23.Collett TS. Do toads plan routes? A study of the detour behaviour of Bufo viridis. J Comp Physiol. 1982;146:261–271. [Google Scholar]
  • 24.Layne JE. Mechanisms of homing in the fiddler crab Uca rapax 1. Spatial and temporal characteristics of a system of small-scale navigation. Journal of Experimental Biology. 2003;206:4413–4423. doi: 10.1242/jeb.00660. [DOI] [PubMed] [Google Scholar]
  • 25.McCreery HF, Dix ZA, Breed MD, Nagpal R. Collective strategy for obstacle navigation during cooperative transport by ants. J Exp Biol. 2016;219:3366–3375. doi: 10.1242/jeb.143818. [DOI] [PubMed] [Google Scholar]
  • 26.Liu A, et al. Mouse Navigation Strategies for Odor Source Localization. Front Neurosci. 2020;14:218. doi: 10.3389/fnins.2020.00218. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Wallace DG, Gorny B, Whishaw IQ. Rats can track odors, other rats, and themselves: implications for the study of spatial behavior. Behavioural Brain Research. 2002;131:185–192. doi: 10.1016/s0166-4328(01)00384-9. [DOI] [PubMed] [Google Scholar]
  • 28.Burgess N, Recce M, O’Keefe J. A model of hippocampal function. Neural Networks. 1994;7:1065–1081. [Google Scholar]
  • 29.Schölkopf B, Mallot HA. View-Based Cognitive Mapping and Path Planning. Adaptive Behavior. 1995;3:311–348. [Google Scholar]
  • 30.Collett TS. Making learning easy: the acquisition of visual information during the orientation flights of social wasps. J Comp Physiol A. 1995;177 [Google Scholar]
  • 31.Mobbs D, Headley DB, Ding W, Dayan P. Space, Time, and Fear: Survival Computations along Defensive Circuits. Trends in Cognitive Sciences. 2020;24:228–241. doi: 10.1016/j.tics.2019.12.016. [DOI] [PubMed] [Google Scholar]
  • 32.Sutton RS, Precup D, Singh S. Between MDPs and semi-MDPs: A framework for temporal abstraction in reinforcement learning. Artificial Intelligence. 1999;112:181–211. [Google Scholar]
  • 33.Jadhav SP, Kemere C, German PW, Frank LM. Awake Hippocampal Sharp-Wave Ripples Support Spatial Memory. Science. 2012;336:1454–1458. doi: 10.1126/science.1217230. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.O’Keefe J, Recce ML. Phase relationship between hippocampal place units and the EEG theta rhythm. Hippocampus. 1993;3:317–330. doi: 10.1002/hipo.450030307. [DOI] [PubMed] [Google Scholar]
  • 35.Wilson M, McNaughton B. Reactivation of hippocampal ensemble memories during sleep. Science. 1994;265:676–679. doi: 10.1126/science.8036517. [DOI] [PubMed] [Google Scholar]
  • 36.Doeller CF, King JA, Burgess N. Parallel striatal and hippocampal systems for landmarks and boundaries in spatial memory. Proceedings of the National Academy of Sciences. 2008;105:5915–5920. doi: 10.1073/pnas.0801489105. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 37.Packard M, Hirsh R, White N. Differential effects of fornix and caudate nucleus lesions on two radial maze tasks: evidence for multiple memory systems. J Neurosci. 1989;9:1465–1472. doi: 10.1523/JNEUROSCI.09-05-01465.1989. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 38.Datta SR, Anderson DJ, Branson K, Perona P, Leifer A. Computational Neuroethology: A Call to Action. Neuron. 2019;104:11–24. doi: 10.1016/j.neuron.2019.09.038. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Krakauer JW, Ghazanfar AA, Gomez-Marin A, MacIver MA, Poeppel D. Neuroscience Needs Behavior: Correcting a Reductionist Bias. Neuron. 2017;93:480–490. doi: 10.1016/j.neuron.2016.12.041. [DOI] [PubMed] [Google Scholar]
  • 40.Mobbs D, Trimmer PC, Blumstein DT, Dayan P. Foraging for foundations in decision neuroscience: insights from ethology. Nat Rev Neurosci. 2018;19:419–427. doi: 10.1038/s41583-018-0010-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 41.Bradski G. The OpenCV Library. Dr Dobb’s Journal of Software Tools. 2000 [Google Scholar]
  • 42.Mathis A, et al. DeepLabCut: markerless pose estimation of user-defined body parts with deep learning. Nat Neurosci. 2018;21:1281–1289. doi: 10.1038/s41593-018-0209-y. [DOI] [PubMed] [Google Scholar]
  • 43.Pedregosa F, Varoquaux G, Gramfort A, Michel V, Thirion B. Scikit-learn: machine learning in Python. J Mach Learn Res. 2011;12:2825–2830. [Google Scholar]

Associated Data

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

Supplementary Materials

Extended Data Fig. 1
Extended Data Fig. 2
Extended Data Fig. 3
Extended Data Fig. 4
Extended Data Fig. 5
Extended Data Fig. 6
Extended Data Fig. 7
Extended Data Fig. 8
Extended Data Fig. 9
Extended Data Fig. 10
Supplementary Audio 1
Download audio file (129.7KB, wav)
Supplementary Audio 2
Download audio file (129.6KB, wav)
Supplementary Video 1
Download video file (16.7MB, mp4)
Supplementary Video 2
Download video file (6.2MB, mp4)
Supplementary Video 3
Download video file (11MB, mp4)
Supplementary Video 4
Download video file (4.4MB, mp4)
Supplementary Video 5
Download video file (10MB, mp4)
Supplementary Video 6
Download video file (11.5MB, mp4)
Supplementary Video 7
Download video file (4.8MB, mp4)
Supplementary Video 8
Download video file (12.1MB, mp4)
Supplementary Video 9
Download video file (10.6MB, mp4)
Supplementary Video 10
Download video file (6.5MB, mp4)
Supplementary Video 11
Download video file (11.5MB, mp4)

Data Availability Statement

Data supporting the findings of this study (mouse tracking data and stimulus information) are available from figshare.com: figshare.com/articles/dataset/Subgoal_paper_data_zip/14610135. Any additional data are available from the corresponding author upon request.

Code availability

The custom code used to perform analysis for this study is available from github.com/BrancoLab/escape-analysis. Code for registering videos to a common coordinate framework is available from github.com/BrancoLab/Common-Coordinate-Behaviour, and code for creating the visualizations found in the figures and supplementary videos is available from github.com/BrancoLab/escape-visualization.

The custom code used to perform analysis for this study is available from github.com/BrancoLab/escape-analysis. Code for registering videos to a common coordinate framework is available from github.com/BrancoLab/Common-Coordinate-Behaviour, and code for creating the visualizations found in the figures and supplementary videos is available from github.com/BrancoLab/escape-visualization.

RESOURCES