Directional dynamics in the entorhinal cortex of male mice driven by behavioral constraints

Domain: chemistry
Published: 2026-03-09
Editorial outcome: major_revision

Abstract
The medial entorhinal cortex of rodents contains a variety of functionally-defined cell types, including grid and head direction cells. While evidence indicates that functional types are not associated with clear molecular footprints, the factors that define them remain unclear. By comparing neural recordings in male mice exploring the same environment either freely or head-fixed to an autonomous-driving cart, we here show that, for a substantial portion of neurons, the head direction functional identity is dynamic, likely emerging through self-organization. Approximately half of free-foraging head direction cells reversibly lost their tuning during assisted navigation, while other neurons gained directional tuning, especially in environments enriched with sensory cues. This adaptive process is experience-dependent, progressively sharpening and stabilizing directional representations, while also integrating a spatial component. Our findings reveal a remarkable flexibility of entorhinal representations, demonstrating their capacity to reorganize and adapt based on how animals interact with their environment.

Introduction
The medial entorhinal cortex (mEC) of rodents simultaneously encodes multiple variables related to spatial navigation through distinct, functionally-defined cell types, such as grid and head direction (HD) cells 1-4. Although the mEC contains several anatomically defined cell classes with distinctive electrophysiological properties, functional and anatomical classifications do not map neatly onto one another 5-7. Consequently, the factors determining the functional identity of neurons in the mEC—potentially involving hard-wiring or self-organization—remain an open question. Plasticity has so far shown to have an influence on tuning functions of several cell types, but not on their functional identity 8-14.

Many highly interconnected brain areas represent direction through HD functionally-defined cells 15. Vestibular, motor and multimodal information are thought to be integrated by sub-cortical pathways, producing a robust representation sustained by attractor dynamics in the anterior-dorsal thalamic nucleus 16. This pathway is required for entorhinal grid cells to express their hexagonal maps 17. Recent evidence suggests the possibility of a differentiated cortical pathway that, while not independent from subcortical circuits, is more focused on sensory information 18, 19. This duality might be expressed in the mEC, where a distinction between theta modulated and non-modulated HD cells has been made, as only the latter modify their preferred direction in an environment as a consequence of sudden contextual changes 20.

Passively transporting animals in a cart has proved useful for investigating the mechanisms underlying HD representations across the brain 21-24. In the mEC, passive transport disrupts grid maps, suggesting that motor engagement is essential for their proper implementation 25, 26. Interestingly, passive transport has also been reported to enhance the directionality of some grid cells, but not conjunctive cells, while keeping HD cells mostly spared despite some mild loss in directional selectivity 25. These contrasting effects may either represent specific deficits in distinct cell subpopulations or, alternatively, reflect a broader reconfiguration of entorhinal HD representations, a possibility that remains unaddressed. Here we developed assisted navigation—similar to passive transport, but with tighter control over the two-dimensional trajectory, achieved by head-fixing mice to an autonomous-driving cart. Leveraging two-photon calcium imaging, this approach enabled us to comprehensively examine how behavioral constraints re-organize functionally-defined HD cells within the wider entorhinal network.

Results
Reconfiguration of directional codes
To study entorhinal representations during free and assisted navigation, we injected the adeno-associated virus AAV-hSyn-GCamMP6f in the entorhinal cortex of 12 mice. In each animal we implanted a prism that allowed calcium imaging through a two-photon miniaturized microscope (Fig. 1a,b and Supplementary Fig. 1a). We selected a total of 11,818 cells (between 240 and 2,245 per mouse) with high signal-to-noise ratio and extracted events through deconvolution and binarization of calcium activity raw traces using standard methods 27 (Fig. 1c,d). A comparison of the autocorrelation decay of deconvolved calcium events and head direction confirmed that our neural recordings had sufficient temporal resolution to capture HD variations during both free and assisted navigation sessions (Supplementary Fig. 2a–b).

We first investigated the head-direction code during navigation in a 80 cm side square environment containing visual and odor cues. In this arena, mice had two sessions of free exploration separated by a session of assisted navigation, with 5 minutes resting in-between sessions (Fig. 1e). For assisted navigation, mice were head-fixed to an autonomous-driving cart that changed speed and direction at intervals between 100 and 1,500 ms in a pseudo-random-walk fashion (Supplementary Movie 1). Ultrasound sensors were used to prevent the car from bumping against walls. Mean coverage of the arena (free: 91 %, assisted: 93 %) and mean speed (free: 9.0 cm s-1, assisted: 8.5 cm s-1) were comparable across conditions (Supplementary Fig. 2c-e).

For each of the 4,528 cells recorded in this experiment (8 mice in 11 experimental days), we obtained head-direction (HD) tuning curves and characterized them by their mean vector length (MVL), angular information and stability (Fig. 1f). Previous work on passive transport inside a plexiglass cage pointed to a mild decay in selectivity of HD cells that did not alter their functional identity 25, but did not address HD modulation in the general population, which we examined. Surprisingly, we found that during assisted navigation, average HD selectivity increased both in terms of mean vector length and HD information rate (Fig. 1f). This increase in HD selectivity was not due to sparse sporadic activation, since also stability, obtained as the Pearson correlation between HD maps corresponding to consequtive halves of the same session, increased during assisted navigation. Similar conclusions were obtained when using only one experimental day per animal (Supplementary Fig. 3a,b), as well as when downsampling data to match either speed (Supplementary Fig. 3c-e) or angular velocity (Supplementary Fig. 3f-i) distributions of free and assisted sessions or considering only the center-most part of the arena (Supplementary Fig. 4). These results point to a reconfiguration of HD representations across navigation modalities, resulting in an overall increase rather than an impairment in directional selectivity in the medial entorhinal cortex during assisted navigation.

To characterize neural activity across conditions, we next classified individual neurons as HD cells if their MVL was higher than the 99th percentile of the distribution obtained from a shuffling procedure pooling all data from the first free navigation session of each experiment (cutoff: 0.44; pool of 1,000 shuffles for each cell; Supplementary Figs. 5-6a). We identified three groups of HD cells, which did not cluster anatomically (Supplementary Fig. 1b-d). HD cells passed the criterion during the first free navigation session (179 cells or 3.9 %) but not during the assisted session (Fig. 1g,h). Conversely, HD cells passed the criterion only during the assisted session, adding up to a higher proportion of the overall population (482 cells or 10.6 %). A third group of cells, HD (where I stands for invariant; see below), passed the classification criteria in both session (144 cells or 3.2 %). This group, compared to HD and HD exhibited lower mean acitivity levels, together with higher HD selectivity and stability across sessions (Fig. 1i and Supplementary Fig. 6b). The proportion of these cells was significantly larger than expected with a false positive probability of 0.01, given the classification criterion based on the 99th percentile of the shuffled distribution (binomial test p-value < 10-50 for all HD subpopulations). The tuning patterns of these cells remained stable across sessions and consecutive days (Supplementary Fig. 6c-e), further reinforcing the reliability of the directional tuning.

We next asked if HD cells had the same preferred direction or remapped across conditions. For each cell, we quantified remapping by the Pearson correlation between the HD maps corresponding to different sessions (Fig. 1i). We found that HD cells had the highest level of correlation across sessions, and it was not significantly different when comparing sessions with matched or non-matched navigation modalities. HD cells, in contrast, had a significantly lower correlation when comparing sessions across modalities, indicative of remapping.

To investigate the reconfiguration of directional representations from a population coding perspective, we used a Bayesian decoder within a cross-validation framework (Fig. 1j). We trained and tested the decoder with data coming from either matched or non-matched navigation modalities. We observed that when datasets were matched, the same population of cells decoded direction better during assisted navigation than during free foraging (Fig. 1k). In addition, the decoded error was smaller for matched than non-matched datasets, further demonstrating the modulation of HD representations by navigation modality.

Put together, these results suggest that behavior constraints drive a reconfiguration of HD functional identity in the entorhinal cortex. Speciallized codes, represented by HD and HD cells, are navigation-modality specific, while HD cells implement an invariant directional code. Overall stronger directional modulation during assisted navigation might reflect an adaptation to absent or unreliable self-motion inputs.

Population code reconfiguration
Given that HD cells in some brain areas are thought to follow an attractor dynamic 16, 29-32, we next asked whether the loss of directionality in HD cells during assisted navigation could result from poor anchoring within an otherwise coherent population activity. If this was the case, temporal correlations between pairs of HD cells with similar preferred direction should be preserved in the assisted session despite the loss in selectivity 16, 33, 34. We divided free and assisted sessions into two halves and used one half to sort HD cells according to directional preference (first half of free session for HD and HD, second half of assisted session for HD ; Fig. 2a). We used the remaining data to assess the presence of a diagonal band in the cell-pair correlation matrix, quantifying it by calculating the ratio of in-diagonal to off-diagonal values. For HD and HD we found that this ratio was higher in session halves that matched the modality used for cell sorting, and was not different from 1 for the non-matched modality, indicating a complete loss of cell-pair correlation structure (Fig. 2b-c). In contrast, for HD cells the diagonal was preserved: the ratio was higher than 1 and not different across sessions.

We also analyzed the normalized Frobenius distance between cell-pair correlation matrices corresponding to free vs. assisted sessions for each HD type, in order to quantify changes in the structure of temporal correlation across conditions. To quantify it, we used the mean of the squared difference between corresponding matrix elements, akin to the Frobenius distance (Fig. 2d). For HD and HD , the distance was comparable to that of the shuffled distribution, where cells were randomly sorted to construct each matrix. This suggests that the correlated activity between cell-pairs is primarily driven by either random or global fluctuations. In contrast, for HD cells, the distance was significantly smaller than that of the shuffled distribution. These results point to the lack of attractor dynamic behavior specifically in HD and HD cells.

To address population activity through a different perspective, we decoded head direction from the activity of each HD population using a Bayesian decoder within a cross-validation framework (Fig. 2e,f). The decoder performed significantly better for HD and HD cells when trained and tested with data from matched modalities, consistent with our previous results and with their definitions, but equally well across modalities for HD cells (Fig. 2e,f). Crucially, the confidence of the decoder, indicative of similar population activity patterns in training vs. testing data, followed similar trends, suggesting a reconfiguration of the population activity across sessions for HD and HD , but not HD cells (Fig. 2f).

These results rule out the possibility that the reconfiguration of directional codes across modalities is due to a lack of anchoring to external cues, suggesting instead profound changes in population activity patterns due to behavioral constraints.

Assisted-navigation representations are sensory-focused
Since HD representatations are thought to rely on external sensory cues 2, 18, 20 or internal proprioception signals 35, 36, we next asked if the activity of HD cells is modulated by changes in these input sources. We first repeated the previous experiment (cue-rich) but this time using an environment deprived of most external sensory cues (cue-poor; Fig. 3a; 1,808 cells from 11 experimental days in 4 mice). In contrast with our previous findings, mean directional selectivity and stability in the cue-poor environment were not higher in assisted than in free sessions (Fig. 3b and Supplementary Fig. 7a,b). Similarly, the proportion of cells classified as HD was not significantly different from the proportion observed during free exploration (Fig. 3c). Crucially, MVL, stability, HD information and the proportion of cells classified as HD were higher during assisted navigation for the cue-rich than for the cue-poor environment, highlighting the role played by sensory cues in the reconfiguration of directional codes (Fig. 3b). These differences between representations of cue-rich and cue-poor contexts were not due to prior experience, as similar results were observed when including only animals that were first exposed to the assisted navigation in each context (Supplementary Fig. 7c,d). In line with this argument, a decoder trained with all recorded cells improved its performance during assisted navigation in the cue-rich but not the cue-poor environment (Fig. 3d). Such differences between cue-poor and cue-rich environments were much smaller, often not significant, during free foraging sessions (Fig. 3b).

We also asked if car speed modulated assisted directional representations in the cue-rich environment. We recorded activity during 4 consecutive sessions, each with a different speed regime, either random as in Figure 1 or with an average speed set to the 30th (low), 50th (medium) or 70th (high) percentile of the free foraging speed distribution (Supplementary Fig. 7e,f; 6,357 cells from 7 mice in 17 experimental days). We found no difference in mean directional selectivity, stability or proportion of cells classified as HD across speed sessions (Fig. 3e,f), which also applied to HD and HD considered separately (Supplementary Fig. 7g). Furthermore, HD cells had strikingly consistent maps across speed regimes, with levels of directional correlation across assisted sessions similar to those of HD cells (Fig. 3e-h).

Put together, these results indicate that during assisted navigation, the directional code is strongly modulated by sensory cues.

Experience shapes assisted-navigation representations
Our results suggest a reversible dynamic in which HD replace HD cells for directional coding during assisted navigation. We next asked whether this new representation of a familiar environment is established instantaneously or gradually stabilized through learning. We divided the assisted session into five consecutive blocks (approximately 2 min each) and obtained HD maps for each block (Fig. 4a). We pooled data from cue-rich and speed experiments, all recorded in the cue-rich context, and divided them into two groups: sessions where assisted navigation was experienced for the first time by the mouse (naïve, 2,233 cells from 7 mice in 7 experimental days) and sessions where it had prior exposure (trained, 3,393 cells from 6 mice in 11 experimental days).

Using the Pearson correlation, and including all recorded cells, we first inspected the similarity between the HD maps for each block of the assisted session and the map corresponding to its last block. In naïve animals, but not in trained ones, we observed a significant increase in correlation across blocks, indicating an evolving representation (Fig. 4b and Supplementary Fig. 8a-c). In contrast, no significant trends were found when correlating maps for each block vs. maps for the previous free session (Supplementary Fig. 8d). This observation suggests that, while assisted-navigation representations evolve along the naïve session, they are already independent of free representations as early as block 1. Average MVL also increased with time spent in the task during naïve sessions, but remained unchanged during trained sessions. When analyzing individual HD types, a significant improvement in directional map quality was observed exclusively for HD cells during naïve sessions, but not during trained sessions or for HD cells (Supplementary Fig. 8c). Although there were no naïve free-exploration sessions available for comparison, we also assessed these variables for HD cells and found no significant changes across blocks (Supplementary Fig. 8f).

To understand these phenomena indicative of plasticity from the perspective of population coding, we decoded HD from population activity in each block, using the 4 remaining blocks as training data. We found that decoding error decreased as a function of time in the naïve session but not in subsequent ones (Fig. 4c and Supplementary Fig. 8e). Free exploration sessions did not exhibit a decrease in decoding error across blocks (Supplementary Fig. 8g).

These results suggest that plastic changes, occurring within minutes, shape assisted-navigation representations of direction into a new stable equilibrium. This newly established directional code is stored and remains readily accessible for use in subsequent experiences with assisted navigation.

Conjunctive codes for direction and space
Directional information, in some but not all brain areas where it is represented, is coded in conjunction with spatial information 2, 37-39. In conexts where correlations between behavioral variables such as position and direction are possible, the concept of unbiased information37 allows for disentangling the contribution of each variable by quantifying the amount of information that cannot be explained by the other. Adapting this to our data 37, we asked if HD cells represent space along with direction. For each cell, we generated a series of new calcium event trains using a binomial random generator. Each instance was obtained based solely on the cell’s original HD map and the animal’s current heading at each timestamp, but not its position or spatial map. We refer to it as a HD-locked shuffled instance of the cell’s event train, constructed to roughly preserve HD modulation and number of events. Unbiased spatial information was defined as the difference between the spatial information of the original map and the mean of the ones obtained for HD-locked shuffled instances (Fig. 5a). Conversely, we also produced spatially-locked shuffled instances and used them to define unbiased HD information. We found significant levels of unbiased spatial information for the pool of all recorded cells, as well as for all HD types considered separately (Fig. 5b and Supplementary Figs 9-10a). In addition, we observed a positive correlation between unbiased spatial and directional information for HD cells, pointing to a conjunction of these codes during assisted navigation (Fig. 5b). This phenomenon could not be attributed to the conjunctive coding of HD by grid cells. As expected from previous studies25, 26, grid cells lost their spatial fields and exhibited low levels of unbiased spatial information during assisted sessions (Supplementary Fig. 11). These results point to entorhinal HD cells, and in particular HD , as bearing a conjuntive code.

We next asked if spatial associations in HD cells, as directional ones, were learned. We observed that unbiased spatial and directional information increased from the first to the second half of the assisted session during naïve but not trained sessions, for the pool of all recorded cells (Fig. 5c) and for HD cells in particular (Supplementary Fig. 10f). In agreement with these findings, the decoding of spatial information improved along the assisted session for naïve but not trained animals (Fig. 5d).

We also asked if conjunctive coding was favored by the presence of sensory cues along the walls of the arena during assisted navigation. We observed that spatial fields of HD cells tended to peak close to the walls, and significantly more during cue-rich than cue-poor sessions (Fig. 5e). We next asked if the preferred direction of firing could also be influenced by the closest wall. To address this, we defined theta as the angle between a cell’s preferred direction and the direction from the center of its spatial field pointing toward the nearest wall (Fig. 5f). We found that the preferred direction of cells was significantly more skewed toward the closest wall in the cue-rich compared to the cue-poor environment (Fig. 5g). This wall-orientated preference, which could not be attributed to border-cell-like behavior (Supplementary Fig. 10a-e), was modulated by the distance between the field center and the wall: it was significant only in the cue-rich condition and for fields located within approximately 15 cm of the nearest wall. As fields farther away from the wall were included, the distribution of preferred directions became uniform. In contrast, in the cue-poor environment, preferred directions were uniformly distributed regardless of the distance to the nearest wall.

Our findings challenge the prevailing view that entorhinal HD cells represent a fixed cell class across behavioral conditions—a distinction that only becomes evident, however, through the partial reconfiguration of representations observed during assisted navigation. We show, instead, that cells can acquire a HD identity depending on the modality of navigation. While the population activity patterns of HD and HD cells are rapidly modified upon the first assisted experience, this reconfiguration involves cumulative, minute-by-minute changes that affect both the directional and spatial tuning of HD cells. As mice familiarize themselves with the new mode of navigation, these patterns gradually stabilize, bringing entorhinal directional maps to a new equilibrium. Importantly, this new equilibrium does not replace previously acquired representations of the environment but is added to a repertoire, remaining available for future use.

Methods
Animals
All experimental procedures were approved by the Institutional Animal Care & Use Committee at Peking University. Adult male C57BL/6N mice (n = 12) were used for experiments, housed under 20° C, 50 % humidity in a 12 h light/dark cycle individually. Male mice were used because they exhibited more consistent running behavior in the openfield. Their total food intake (2 – 4 g of food per day) was controlled and monitored to maintain 90% of free-feeding body weight. Behavioral experiments were performed during the dark phase. All data for all mice were included for analysis.

Virus injection and prism implantation
All surgeries were performed on isoflurane (airflow: 0.8 – 1.0 L / min, 0.5 – 3 % isoflurane, adjusted according to physiological condition) anaesthetized animals head fixed on a stereotaxic frame (KOPF). The hair was trimmed from the head, followed by the cleaning of the incision area with alcohol and betadine. After cleaning tissues and blood on the skull, a small square craniotomy was made with a thin drill over the right MEC. The dura was then removed by a blunt needle to expose the brain surface. For each mouse, two injections of total 0.8 μL of AAV-hSyn-GCaMP6f (titer: > 2×1013 vg/mL) were injected into the right MEC at a rate of 30 nL/min with a glass micropipette (typical two injection sites: +3.1 to +3.7 mm ML, sinus + 0.3 mm AP, -1.8 to -1.4 mm and -1.5 to -1.3 mm DV), controlled by a Nanoliter 2020 Microinjection Pump (World Precision Instruments). The pipette was left in place for 10 minutes before being slowly withdrawn to allow virus diffusion. Next, a 3.5 × 2.5 mm2 prism (Grintech) was inserted between cerebellum and cerebrum with the flat surface targeted on dorsoventral surface of MEC. Craniotomy was then covered with Kwik-Sil (World Precision Instruments) and tissue adhesive glue (3M) to protect and bond the skull with the scalp incision area. A headbar (Transcend Vivoscope) was added on the top, with the exposed skull as well as the gaps between the skull and the headbar filled with dental cement (Super bond). Animals were then placed on a heating pad until waking up and housed individually while being treated with cephalosporin for 1 week.

Miniaturized 2-photon microscope calcium imaging
Mice were allowed to recover for three weeks after surgery and then restrained with an adapter. Using a wide-field single-photon microscope, a field of view (FOV) was determined in which the largest number of neurons appeared clearly, and a baseplate was then attached to the headbar to fix the microscope. During calcium imaging, the calcium signals were collected with the miniatu red 2-photon microscope (LFMTPM V2.0.1), and controlled by the GINKGO-MTPM software (Transcend Vivoscope Biotech Co., Ltd, China). Two-photon excitation of GCaMP6 was achieved using a laser (TVS-FL-01, Transcend Vivoscope Biotech Co., Ltd China) at 920 nm with a typical laser intensity of 70 mW. Images were acquired at 9.5 Hz at a resolution of 600×512 pixels corresponding to a field of view of 534×455 μm. The imaging data was recorded synchronously with the behavioral data using the GINKGO-MTPM software. After recording, behavioral data were aligned with the imaging clock and downsampled to the imaging frame rate (9.5 Hz) by linear interpolation.

Some animals were re-used after a month, which explains the discrepancy between number of mice and experimental days in some of our results. In those cases, the baseplate was re-attached to the headbar to obtain a better FOV. The new imaged neurons were added to the statistics, considering the two sessions with different FOV as independent from each other. While this procedure could potentially result in some bias, Supplementary Figure 3a-b shows that our main observations hold robustly if only one experimental day per mouse is taken into account.

Histology
After finishing experiments, mice were first anaesthetized with a 0.6 mL injection of 2.5% tribromoethanol and then fixed on the perfusion table. An incision was made along the midline of the abdomen to the chest with dissecting scissors, and a perfusion needle was inserted into the left ventricle once an incision was made on the right atrium. Mice were then transcardially perfused with 40 mL saline, followed by 20 mL 4% paraformaldehyde (PFA). After perfusion, the brain tissue was carefully removed, post-fixed in 4% PFA for more than 24 hours at 4°C, and then dehydrated in 30% sucrose until the brain sank. Next, the brain tissue was removed from the sucrose and mounted on a metal platform with OCT Compound (4583, Sakura, Tokyo, Japan). After freezing in the cryostat, the tissue was sectioned at a thickness of 30-μm. Sections were first rinsed with PBS two times (300 μL each slide, 5 min each time), incubated with blocking solution (10% goat serum and 0.3% Triton X-100 in PBS) for 1 h at room temperature, followed by primary antibody (chicken anti-GFP, Invitrogen, Cat #A10262; rabbit anti-NeuN, Abcam, Cat #ab_177487) in diluted (1:1000) blocking solution overnight at 4 °C. After washing in PBS three times (300 μL each slide, 5 min each time), sections were then incubated with species-specific secondary antibodies (Alexa Fluor 488, Invitrogen, Cat #A11039; Alexa Fluor 568, Abcam, Cat #ab_175471) and DAPI (Sigma-Aldrich) in diluted (1:1000) blocking solution for 2-4 h at room temperature. After rinsing with PBS two times (300 μL each slide, 5 min each time), sections were mounted on glass slides with Fluoromount-G (SouthernBiotech) and coverslipped. Imaging was processed using either Zeiss Axio Scan Z1 or Olympus Virtual Slide System to confirm the position of prism implantation and the expression of virus.

Free exploration task
After complete recovery from the surgery, mice were habituated in a 40 cm high and 80 cm side square arena for more than 3 days (at least 15 mins per day). The walls and the floor of the arena were built using plastic. In the cue-poor environment, three cue cards (30 cm W x 21 cm H) with different symbols were placed in the centers of three walls, with the bottom edge 8 cm above the floor. In the cue-rich environment, all walls were further covered with gratings and an extra odor cue (pure ethyl acetate diluted to 5% v/v in mineral oil) was placed in the center of the fourth wall. Neural activity was recorded as the animal freely explored in the arena, searching for butter cookies (PAUL KEI) that were thrown into the arena one at 10-15 s intervals. Mouse behavior was monitored at 25 frames per second (fps) with an infra-red camera centered above the arena. The arena was cleaned with dust collector and 75% ethanol between sessions.

Assisted navigation task
Mice were restrained head-fixed to a custom-made autonomous-driving car and moved around the same arena. The car had one motor (WHEELTE) on each side and was controlled by an Arduino board powered by six rechargeable batteries (Delipow, 2700 mA). The two motors operated in the same direction during forward movements and in opposite directions during turning. To manipulate the car moving at low speeds, motors with high reduction ratio were used. To mimic the random foraging of mice, the car was set to change its moving direction after an interval of time drawn from a uniform distribution between 100 and 1500 ms. Unless a wall was encountered, there was a 92.5% chance of proceeding forward, a 7% chance of turning left or right, and a 0.5% chance of stopping. Once the choice was made, the car would execute the action until the next decision point. During the forward mode, the ultrasound sensors in front of the car detected the distance from the wall every 100 ms. The car would move backwards and make a turn away from the wall if the distance was smaller than 5 cm. In the default, random speed regime, the moving speed of the car changed at every decision point. The new speed was obtained from a pseudo-random uniform distribution between 2 and 30 cm s-1.

Speed modulation task
Speed modulation was implemented by changing the parameters of the Arduino code. The moving speed of mice during free exploration in previous experiments was collected, and its 30th, 50th and 70th percentile were set to the car as a constant value for low, medium and high-speed conditions (see Supplementary Figure 7e-f).

Pre-processing of 2-photon calcium signal
After recording, Ca2+ imaging data were first analyzed offline using Suite2P 59 (https://github.com/MouseLand/suite2p) for motion correction, identification and extraction of spatial footprints as well as the activity traces of region of interest (ROI). The outputs from Suite2P were further analyzed with custom-written programs in Matlab (R2020a, The MathWorks, Natick, MA) for calculating Ca2+ signals for each specified ROI as the relative fluorescence changes (ΔF/F) 60. ΔF/F was then deconvolved using OASIS 61 (https:// github.com/zhoupc/OASIS_matlab). To extract calcium transients from noise such as electrical and motion artifacts, significant transients were identified as periods in which ΔF/F was two standard deviations above the baseline fluorescence for more than 0.75 s, as established in previous studies 62, 63. For each ROI, a fluorescence change was identified as a true calcium event only during significant transients when its amplitude exceeded one standard deviation above the baseline. To count the cells recorded in each animal, CellReg 64 (https://github.com/zivlab/CellReg) was applied to identify the same cells across days within each re-attachment.

Tracking of behavioral data
The raw behavioral data recorded by the camera was analyzed using DeepLabCut 65 (https://github.com/DeepLabCut/DeepLabCut). For each frame, four body parts (free exploration: nose, neck, left and right ear; assisted navigation: nose, neck, left and right side of the headbar) were extracted to yield the position of the animal. The DLC model was trained from 50 manually labelled datasets with resnet_50 for 100,000 iterations. The identified positions located inside the arena were kept and further smoothed with a 15-point mean filter. Head direction (HD) was determined by the relative position of the animal’s neck and nose.

Spatial and directional rate maps
For each session, cells with more than 50 calcium events were extracted, and rate maps were generated to evaluate their calcium activity normalized by occupancy (sessions where a cell had less then 50 calcium events were not included in the analyses). The deconvolved calcium activity was first sorted into different bins (bin size: 3×3cm2 for spatial maps and 3° for directional maps) according to the behavioral data, and then divided by the time spent in each bin. The resulting rate was further smoothed either using a 2D Gaussian kernel with a standard deviation of 6 cm for spatial maps or a 30° mean window filter for directional maps. For spatial rate maps, the firing fields were determined as the contiguous periods exceeding 60th percentile of the field’s peak rate, with the peak rate higher than 0.5 Hz. All data with running speeds lower than 2 cm per second were excluded in all calculations to rule out the effects of different behavioral states.

Analysis of head direction cells
The length of mean resultant vector (mean vector length, MVL) was calculated for each cell to evaluate HD selectivity. MVL was obtained by averaging the vectors corresponding to each bin of the directional rate map using the circular statistic toolbox in Matlab 66. Shuffling was performed 1,000 times for each cell. For a single shuffling instance, a shuffled directional map was obtained by time-shifting the deconvolved calcium activity of the cell along the animal’s path wrapping the end of the session to the beginning, with a 30 s exclusion window toward the future and the past. Shuffled MVL values were calculated and pooled for all cells in the first free foraging session to obtain the 99th percentile of the distribution, which was set as a criterion to classify cells as HD in all sessions. In all the experiments, cells that passed the criterion during the first free exploration session but not during the assisted session were classified as HD . Conversely, cells that passed the criterion only during assisted sessions but not during any of the free exploration sessions were identified as HD . Finally, cells that passed the criterion in both conditions were classified as HD.

HD information was used as a complementary measure of directionality, with the advantage of not being biased by the potential presence of multiple opposite directional fields 67. It was calculated as
I = ∑ p λ log λi / λ, (1)
i i i 2
where λ is the mean event rate of a unit in the ith angular bin, λ is the average event rate of the neuron, and p is the probability of the animal’s in the ith bin. Directional stability was calculated as the Pearson correlation of the directional maps obtained for the two consecutive halves of a session.

Analysis of spatial cells
Spatial information was calculated as HD information but using the spatial map and spatial bins. Shuffling was performed similarly, and a cell was identified as a spatial cell if its spatial information exceeded the 99th percentile of the spatial information for the pooled shuffled data. Spatial stability was calculated as the Pearson correlation of the spatial maps obtained for the two consecutive halves of a session.

Analysis of grid cells
Spatial autocorrelation was obtained for each cell as in previous studies 2 to identify grid cells. The autocorrelogram was calculated as the correlation between the fields with spatial lags of τx and τy as
r(τx,τy) = n∑λ(x,y)λ(x-τx,y-τy) - ∑λ(x,y)∑λ(x-τx,y-τy) / √ n∑λ(x,y) 2 - (∑λ(x,y))2 √ n∑λ(x-τx,y-τy) 2 - (∑λ(x-τx,y-τy)) 2, (2)
Where λ(x,y) is the average event rate of a neuron at location (x,y), and the summation is over all n pixels in λ(x,y) for which the rate was calculated for both λ(x,y) and λ(x-τx,y-τy). Autocorrelations were not estimated where n < 20.
To quantify the 6-fold symmetry within the spatial autocorrelation map, a circular sample of the autocorrelogram was extracted, centered on the central peak but with the central peak excluded, and compared with its rotated version. The degree of spatial periodicity (‘grid score’) was obtained as the difference between the lowest correlation at 60° and 120° and the highest correlation at 30°, 90° and 150°. Shuffling was performed for each cell with 1,000 permutations. For each cell, the control spatial map was obtained by time-shifting the deconvolved calcium activity of the cell along the animal’s path by a random number of frames taken from a uniform distribution including the whole session, but excluding 30s into the future or the past, to ensure the complete loss of correlation between neural activity and behavior. A cell was identified as a grid cell if its grid score from the experimental data exceeded the 99th percentile of pooled shuffled data.

Calculation of unbiased information
Unbiased information was used to remove the part of spatial information strictly due to directional responses and vice-versa 37, 68, 69. For a given cell, a spatially-locked shuffled instance was defined by a new calcium event train generated through a binomial random process. For every timestamp, this random process had a mean given by the value of the spatial map in the bin where the animal stood. Similarly, a HD-locked shuffled instance used the HD map to generate a new event train. Spatial and HD information were calculated for each of the 100 shuffles of each type per cell. The unbiased spatial information for a cell was defined as the difference between its actual spatial information and the mean of the shuffled spatial information. The unbiased HD information was defined as the difference between its actual HD information and the mean of the shuffled HD information.

Similarly, and to allow a comparison of variables with the same methodology, the unbiased grid score, unbiased border score and unbiased spatial information were calculated as the difference between the observed variable and the average over 100 spatial shuffles for each cell.

Calculation of directionality
For a collection of spatial bins (typically those inside the center square vs close to the walls), the behavioral-MVL for each bin was obtained similarly to the MVL but using the distribution of head directions instead of the rate map. The directionality of each bin was defined as the average behavioral-MVL across sessions.

Downsampling of behavioral data
To rule out the possibility that the reconfiguration across conditions was caused by differences in the distribution of speed during free and assisted session, behavioral data in each condition was downsampled to achieve similar moving speeds. For each recording, the behavioral data during assisted navigation was first downsampled in speed bins where it occurred in excess, to match the speed distribution of free sessions on the same day. The behavioral data recorded in free exploration was then downsampled where it occurred in excess, to match exactly the speed distribution that resulted from the first round of downsampling. Spatial and directional rate maps were then obtained from downsampled data.

Calculation of best rotated angle
To evaluate whether a HD cell remapped across conditions, the best rotated angle was defined as the amount of rotation (in multiples of 3°) of the map corresponding to the first session required to maximize its Pearson correlation with the map corresponding to the second session.

Correlation between cell pairs
To study the structure of cell-pair activity correlations we first divided free and assisted sessions into two consecutive halves. To study HD and HD, the first half of the free session was used to sort cells according to their preferred direction. The correlation matrix was then calculated for each half of each session, where element (i,j) had the Pearson correlation between the corresponding event train of cells i and j. The presence of a diagonal in the correlation matrix, indicative of similar activity between similarly sorted cells, was evaluated for all sessions not used for sorting. HD cells were studied similarly but using the second half of the assisted session to sort cells. In-diagonal elements were defined as the 10 % closest to the diagonal, but excluding it, while off-diagonal elements were defined as the 10 % furthest apart from the diagonal. For each HD type, only sessions containing more than 10 cells of that type were included in the analysis.

Shuffling instances of the correlation matrix were obtained by randomly sorting the cells and calculating the correlation between corresponding cell pairs.

Decoding from neural data
A Naïve Bayes decoder with 5-fold cross validation was applied to decode the position and HD of the animal from neural activity 70. Only sessions containing more than 5 cells were included. Each session was divided into 5 consecutive blocks.
First, the average firing rate in response to position can be measured by a tuning curve f(X) for each cell i. We assumed the probability of the cell producing n events during a short time interval γ (set to 1 s in our analysis) for a fixed position X followed a Poisson statistic
P(n|X) = (f(X)∙γ)n e-γf(X) / n!, (3)
We further assumed the firing rate is independent across cells. According to Bayes’ theorem, given the activity of neuron populations, the conditional distribution for position X could be represent as
P(X|n) = C P(X) (∏N fi(X)ni) e-γ∑N i=1 fi(X), (4)
i=1
where X is the specified position bin, each cell i has a tuning curve fi(X), and fired ni times during time window γ. P(X) is calculated as the overall probability of the animal staying in the spatial bin X. C is a normalization constant calculated so that the total probability is 1. For each frame, the decoded position was determined as the position with the maximum posterior probability (confidence). Shuffled data were generated by randomly time-shifting and wrapping the position of animals. The decoding accuracy was obtained by test data for each fold of cross-validation, calculated as the mean absolute error (MAE) between the observed and decoded positions. To decode HD, the same procedure was applied, with X indicating the directional bin.

Statistics and reproducibility
No statistical methods were used to predetermine sample sizes. Sample sizes were chosen based on previous publications and prior experience in our laboratory. The study contains data from 12 mice. All collected data were analyzed, with inclusion criteria for specific analyses described in Methods. Cells with fewer than 50 events were excluded. Sessions containing fewer than 5 or 10 recorded cells were excluded from decoding and temporal correlation analyses, respectively, to minimize noise and improve reliability.

Animals were randomly allocated into each experiment group. Experimenters were not blinded to group allocation during data collection. However, neural activity during behavioral tasks could only be observed after automatic pre-processing.

Experimenters were blinded to experimental conditions during data analysis. Each animal in the study is an independent experimental replicate performed separately. Results were consistent across animals.

Data analysis were conducted using MATLAB (R2022a), Python (3.8) and GraphPad Prism 9. Figures were generated using MATLAB, Python and GraphPad Prism 9 and arranged in Adobe Illustrator 2023. Statistical analyses were performed using MATLAB, Python and GraphPad Prism 9.

Peer review rounds
[{"round": 1, "reviewer_comments": {"reviewer_4": "The present study investigates the dynamics of head-direction (HD) encoding in the medial entorhinal cortex (MEC) during both free exploration and passive transport. The main claim is that HD representations are reorganized between these two conditions, with some neurons losing their directional tuning while others gain modulation by the animal’s heading. This is my first time reviewing the study, though I was provided with the previous reviews. Overall, I find the study to be well presented, and the data support the authors’ main claims. The demonstration that assisted navigation leads to a reorganization of the subpopulation of HD-modulated cells, and that this reorganization is plastic, is both novel and compelling. Moreover, it appears that the authors have thoroughly addressed most of the reviewers’ previous concerns. One of the reviewer comments pertained to the analysis of whether pairwise correlations among HD cells are maintained across conditions (Fig. 2b). A more straightforward and interpretable approach might have been to examine the relationship between pairwise correlations and the angular offset between cells (within a given condition). This could be assessed across all sessions, or more rigorously, on a session-by-session basis, with statistics performed on the correlation values. That said, a potential confound is that calcium signals often exhibit high levels of common, non-specific modulation, which can bias pairwise correlations toward positive values. In any case, such an analysis would likely support the authors' current conclusions. It would simply present the findings in a more intuitive and interpretable way. I would also like to raise an additional comment/suggestion that, to the best of my knowledge, was not addressed by the other reviewers. Is there any anatomical clustering of the different cell types? Displaying a representative session showing the spatial locations of the various cell types, along with a basic analysis of potential clustering, would be informative. The analysis need not be complex, for example, comparing inter-ROI distances within versus across cell categories would already be useful.", "reviewer_5": "The study addresses whether the functional identity of head-direction cells in the medial entorhinal cortex is hard-wired or can flexibly reconfigure depending on behavioral context. To test this, the authors introduce an assisted navigation paradigm in which head-fixed mice are transported through an environment on an autonomous cart. Using two-photon calcium imaging of large populations of entorhinal neurons, they compare head-direction coding during free versus assisted navigation to assess how behavioral constraints reorganize directional representations. Overall, the authors have done a thorough job addressing Reviewer #3’s comments, and I am satisfied with their responses. Major Points: • Link to broader MEC learning literature. The authors argue that their central novelty lies in the gain-of-function—cells that acquire HD tuning during assisted navigation. This is indeed a meaningful advance over prior work, which emphasized loss of function or stability. To further underscore this point, the findings could be more explicitly situated within the emerging literature on experience-dependent changes in MEC coding. For example, Bigus et al. (2024) showed that MEC time cells develop new, context-dependent temporal sequences as animals learn a timing task, demonstrating that MEC codes can be reshaped by experience in ways that support flexible behavior. Placing the present gain-of-function result alongside such evidence (see also Butler et al. 2019; Boccara et al. 2019; Wen et al. 2024; Bowler et al. 2025) would highlight that MEC representations are not solely the product of fixed attractor dynamics but can be reorganized through learning and behavioral context. This framing would strengthen the case that the current study extends our understanding of MEC flexibility. • Clarify alternative interpretations. In the final Discussion paragraph (lines 623–636), the authors already contrast evidence for hard-wired attractor dynamics with their own findings of flexible, experience-dependent coding. This section would be a natural place to also acknowledge an alternative possibility: that the MEC circuit could remain largely hard-wired but requires intact proprioceptive/self-motion inputs to operate in its physiological regime. From this perspective, the apparent reconfiguration during assisted navigation might reflect a shift in input weighting rather than intrinsic circuit plasticity. At the same time, the progressive refinement of HD coding over blocks in the naïve state does suggest that some plasticity or flexibility is engaged, even if it is driven by changes in input integration rather than modifications to intrinsic circuitry. Explicitly situating their results in relation to both possibilities—hard-wired but input-dependent versus flexible and learning-dependent—would sharpen the interpretation and clarify how these findings extend ongoing debates in the field. • Interpretation of HDA cells. One concern regarding the interpretation of the HDA cells is that they could represent boundary vector cells. Figure 5 highlights the conjunctive spatial-directional coding properties of the HDA cells; it shows that the majority of spatial fields in the cue-rich, assisted-navigation condition are close to the wall (5e, near where the cart would turn or back up) and aligned in front of the animal (5g). If boundary cells are also sensitive to sensory cues, this interpretation could fit their results as well, consistent with Figure 3. It would therefore be helpful for the authors to discuss whether HDA cells are comparable to boundary vector cells or to characterize the strength of HDA cells’ HD tuning as a function of spatial location. The authors begin to address this with Extended Data Figure 4, but the point could be strengthened by directly comparing tuning strength between inner and outer regions of the arena for the same cells. If some of these conjunctive responses can be shown to differ from boundary coding (i.e. strong HD tuning irrespective of distance to walls), it would reinforce the argument that HDA cells reflect a novel, emergent representation of HD tuning in MEC. Alternatively, the authors could clarify whether they see these responses as distinct or overlapping with boundary coding and cite the relevant MEC boundary-cell literature. Acknowledging the possibility that HDA cells represent a mixed population of spatial–directional coding strengths would also be consistent with their data, especially given this is the largest subtype (~3× more than the others). Minor points • Figure 1: The size/resolution of example traces is too small to judge smaller calcium transients and whether they were classified as significant. Does the 0.75 s transient-length cutoff risk missing shorter events? • Clarification: Are HD cell firing onsets associated with locomotion bouts in a given direction, or with changes in head direction? Demonstrating this is similar across free and assisted conditions would strengthen the controls for behavioral differences. • Clarification: Please clarify how HD-subtype proportions are distributed across animals. It is unclear how the percentages in Lines 169–175 (~3% HDF, 10% HDA, 3% HDI) map onto the values plotted in the main figures (e.g., Fig. 1g). • Rate map orientation: The orientation of the mouse is not always clear in the HD rate maps, as angular axes are not labeled consistently. • Discussion: A short speculation about why loss of self-motion inputs may lead to increased HD coding would be useful. • Discussion: The authors should clarify whether the prevailing model is truly that HD cells are fixed, and cite additional studies of plasticity or learning-induced changes in MEC tuning where relevant."}, "author_response": "Dear Editor and Reviewers: We are grateful for the thoughtful feedback from the editor and reviewers on our manuscript titled ‘Directional dynamics in the entorhinal cortex driven by behavioral constraints’, which helped us to improve the manuscript substantially. We have carefully considered all the suggestions and made the necessary revisions. The point-to-point response is provided below. We hope that the revised version now fully addresses the reviewers’ concerns and meets their requirements. The reviewers’ comments are presented in black font. Our responses are in blue font. Specific corrections introduced into the manuscript are in red font. Reviewer #4 (Remarks to the Author): The present study investigates the dynamics of head-direction (HD) encoding in the medial entorhinal cortex (MEC) during both free exploration and passive transport. The main claim is that HD representations are reorganized between these two conditions, with some neurons losing their directional tuning while others gain modulation by the animal’s heading. This is my first time reviewing the study, though I was provided with the previous reviews. Overall, I find the study to be well presented, and the data support the authors’ main claims. The demonstration that assisted navigation leads to a reorganization of the subpopulation of HD-modulated cells, and that this reorganization is plastic, is both novel and compelling. Moreover, it appears that the authors have thoroughly addressed most of the reviewers’ previous concerns. We appreciate these positive comments. We have carefully revised the manuscript in response to the suggestions below, and we hope the changes will help clarify our results. One of the reviewer comments pertained to the analysis of whether pairwise correlations among HD cells are maintained across conditions (Fig. 2b). A more straightforward and interpretable approach might have been to examine the relationship between pairwise correlations and the angular offset between cells (within a given condition). This could be assessed across all sessions, or more rigorously, on a session-by-session basis, with statistics performed on the correlation values. That said, a potential confound is that calcium signals often exhibit high levels of common, non-specific modulation, which can bias pairwise correlations toward positive values. In any case, such an analysis would likely support the authors' current conclusions. It would simply present the findings in a more intuitive and interpretable way. We agree with the reviewer that our analysis is somewhat convoluted and that a more straightforward approach would be preferable. We have carefully considered possible alternatives, but we believe that any analyses relying on tuning properties can be misleading in a context where such tuning is largely lost. In the figure below, we show an analysis of angular offsets in line with the reviewer’s suggestion. While the results are consistent with those in Figure 2, we feel that this approach is somewhat biased—essentially “right for the wrong reason.” As cells lose angular preference, the concept of an angular offset becomes ill-defined. Although a preferred direction can still be computed mathematically, it would mainly reflect random fluctuations rather than genuine tuning. For this reason, we use this figure only for illustration and have not included it in the manuscript, although we would be happy to do so if the reviewer feels it would add clarity. Because angular preference and offsets are effectively buried within noise, our analysis in Figure 2 instead asks whether temporal correlations between neurons are preserved even when angular tuning is lost, which we believe is the correct way to approach this question despite the complexity of the analyses. In the second part of the reviewer’s comment, they raise an important point that we had not explicitly emphasized in the manuscript. Indeed, correlated activity between cells could arise from population-wide fluctuations that are independent of head direction. If that were the case, pairwise-correlation matrices would display relatively high values regardless of the cell ordering. As shown in Figure 2d, the distance between correlation matrices across conditions for HD and HD is comparable to that obtained when cell F A order is shuffled, suggesting that correlations in these conditions are dominated by global fluctuations, not by tuning similarity. In contrast, HD cells show significantly lower I distances, indicating that cell identity and ordering by preferred direction remain meaningful. We have now made this point explicit in the revised version of the manuscript: ‘To quantify it, we used the mean of the squared difference between corresponding matrix elements, akin to the Frobenius distance (Fig. 2d). For HD and HD , the distance F A was comparable to that of the shuffled distribution, where cells were randomly sorted to construct each matrix. This suggests that the correlated activity between cell-pairs is primarily driven by either random or global fluctuations. In contrast, for HD cells, the I distance was significantly smaller than that of the shuffled distribution. These results point to the lack of attractor dynamic behavior specifically in HD and HD cells.’ F A Left: For each HD type (sub-panels), density of angular offsets between each cell-pair (color-coded; HD : 2377 cell-pairs, HD : 17244 cell-pairs, HD: 2681 cell-pairs). F A I Right: Distribution across density matrices of in- to off-diagonal ratio (n = 11 sessions; i.q.r.; Kruskal-Wallis test with p-values indicated). I would also like to raise an additional comment/suggestion that, to the best of my knowledge, was not addressed by the other reviewers. Is there any anatomical clustering of the different cell types? Displaying a representative session showing the spatial locations of the various cell types, along with a basic analysis of potential clustering, would be informative. The analysis need not be complex, for example, comparing inter-ROI distances within versus across cell categories would already be useful. We agree that this is an important point, not covered in our previous version. We have added new panels covering this question in Extended Data Fig. 1. We observe no such clustering of cell types, either by visual examination of examples (Extended Data Fig. 1b) or quantification through inter ROI distance or the Bivariate Ripley's K-Function (Extended Data Fig. 1c-d). The absence of pre-established anatomical configurations provides additional—although not conclusive—evidence supporting the idea that plasticity and self-organization play a key role in determining functional cell types, as we now note in the Discussion section. Reviewer #5 (Remarks to the Author): The study addresses whether the functional identity of head-direction cells in the medial entorhinal cortex is hard-wired or can flexibly reconfigure depending on behavioral context. To test this, the authors introduce an assisted navigation paradigm in which head-fixed mice are transported through an environment on an autonomous cart. Using two-photon calcium imaging of large populations of entorhinal neurons, they compare head-direction coding during free versus assisted navigation to assess how behavioral constraints reorganize directional representations. Overall, the authors have done a thorough job addressing Reviewer #3’s comments, and I am satisfied with their responses. We thank the reviewer for their time and effort in thoroughly evaluating our work and offering valuable feedback for improvement. We have carefully considered all the comments and made corresponding revisions to improve the manuscript. Major Points: • Link to broader MEC learning literature. The authors argue that their central novelty lies in the gain-of-function—cells that acquire HD tuning during assisted navigation. This is indeed a meaningful advance over prior work, which emphasized loss of function or stability. To further underscore this point, the findings could be more explicitly situated within the emerging literature on experience-dependent changes in MEC coding. For example, Bigus et al. (2024) showed that MEC time cells develop new, context-dependent temporal sequences as animals learn a timing task, demonstrating that MEC codes can be reshaped by experience in ways that support flexible behavior. Placing the present gain-of-function result alongside such evidence (see also Butler et al. 2019; Boccara et al. 2019; Wen et al. 2024; Bowler et al. 2025) would highlight that MEC representations are not solely the product of fixed attractor dynamics but can be reorganized through learning and behavioral context. This framing would strengthen the case that the current study extends our understanding of MEC flexibility. We fully agree with the reviewer that linking our findings with the boarder context of dynamic changes in MEC coding will further highlight the significance of our study. We have added to the first paragraph of the discussion: ‘The stability and reversibility of this switch, with the original HD representation restored when free navigation resumes, indicate that the entorhinal cortex has the capacity to store and select from multiple maps for the same environment based on the mode of navigation. The adaptability we observe points to a self-organizing process, for example aimed at harmonizing observations and predictions (Campbell et al., 2018), where the brain explores different solutions to maintain spatial and directional representations aligned with behavioral constraints. Together, these observations add to a growing body of evidence highlighting the flexibility of spatial and temporal representations in the entorhinal cortex (Bigus et al., 2024; Boccara et al., 2019; Bowler et al., 2025; Butler et al., 2019; Wen et al., 2024).’ • Clarify alternative interpretations. In the final Discussion paragraph (lines 623–636), the authors already contrast evidence for hard-wired attractor dynamics with their own findings of flexible, experience-dependent coding. This section would be a natural place to also acknowledge an alternative possibility: that the MEC circuit could remain largely hard-wired but requires intact proprioceptive/self-motion inputs to operate in its physiological regime. From this perspective, the apparent reconfiguration during assisted navigation might reflect a shift in input weighting rather than intrinsic circuit plasticity. At the same time, the progressive refinement of HD coding over blocks in the naïve state does suggest that some plasticity or flexibility is engaged, even if it is driven by changes in input integration rather than modifications to intrinsic circuitry. Explicitly situating their results in relation to both possibilities—hard-wired but input-dependent versus flexible and learning-dependent—would sharpen the interpretation and clarify how these findings extend ongoing debates in the field. We thank the reviewer for this insightful suggestion. We agree that input-dependent mechanisms could offer an alternative explanation, although we consider this less likely than self-organization precisely because of the improvement in HD tuning during assisted movement that the reviewer cites. To make this point more clear, we have added to the discussion: ‘Our findings, however, offer evidence of a complementary dynamic: the remarkable flexibility of entorhinal cells to adapt through learning, reshaping their functional identity in response to a shifting balance between sensory and self-motion inputs. Although we cannot exclude the possibility that these changes originate upstream, a self-organizing process provides the most parsimonious explanation, given the observation that cells improve their tuning during their first experience in assisted navigation. Together, hard-wired templates and self-organizing mechanisms may serve as complementary driving forces in entorhinal processing, providing a flexible framework capable of meeting the challenges posed by multimodal inputs and diverse forms of interaction with the external world.’ • Interpretation of HDA cells. One concern regarding the interpretation of the HDA cells is that they could represent boundary vector cells. Figure 5 highlights the conjunctive spatial-directional coding properties of the HDA cells; it shows that the majority of spatial fields in the cue-rich, assisted-navigation condition are close to the wall (5e, near where the cart would turn or back up) and aligned in front of the animal (5g). If boundary cells are also sensitive to sensory cues, this interpretation could fit their results as well, consistent with Figure 3. It would therefore be helpful for the authors to discuss whether HDA cells are comparable to boundary vector cells or to characterize the strength of HDA cells’ HD tuning as a function of spatial location. The authors begin to address this with Extended Data Figure 4, but the point could be strengthened by directly comparing tuning strength between inner and outer regions of the arena for the same cells. If some of these conjunctive responses can be shown to differ from boundary coding (i.e. strong HD tuning irrespective of distance to walls), it would reinforce the argument that HDA cells reflect a novel, emergent representation of HD tuning in MEC. Alternatively, the authors could clarify whether they see these responses as distinct or overlapping with boundary coding and cite the relevant MEC boundary-cell literature. Acknowledging the possibility that HDA cells represent a mixed population of spatial–directional coding strengths would also be consistent with their data, especially given this is the largest subtype (~3× more than the others). We agree with the reviewer that the phenomenon of HD cells’ spatial fields peaking near A the walls may reflect boundary influence. Previous studies have described border cells in MEC, a special subset of the wider boundary vector cell type found in subiculum, but firing homogenously along at least one wall (Boccara et al., 2010; Savelli et al., 2008; Solstad et al., 2008). More generally, boundary vector cells can have firing fields at a fixed distance from the wall, but we agree with the spirit of the reviewer’s question concerned specifically with border-like behavior. We have added analyses that show that it is unlikely that HD A cells are border cells and included them in Extended Data Fig. 9. First, we observe a general decline in unbiased border score (analogous to unbiased spatial and directional information) for all HD (Extended Data Fig. 9c). In particular, during assisted sessions, HD cells show increased levels of unbiased spatial information despite decreased levels A of unbiased border score. Second, the distribution of unbiased border score for HD cells A is similar to the distribution for non-HD cells (Extended Data Fig. 9d). Third, we conducted the analysis suggested by the reviewer and found that for HD cells the distribution of A MVL during assisted sessions was similar if we selected only spatial bins close to the wall or close to the center of the arena (Extended Data Fig. 9e). These results argue against the idea that HD and border cells are the same population. A Boccara, C.N., Sargolini, F., Thoresen, V.H., Solstad, T., Witter, M.P., Moser, E.I., and Moser, M.B. (2010). Grid cells in pre- and parasubiculum. Nat Neurosci 13, 987-U112. Savelli, F., Yoganarasimha, D., and Knierim, J.J. (2008). Influence of Boundary Removal on the Spatial Representations of the Medial Entorhinal Cortex. Hippocampus 18, 1270-1282. Solstad, T., Boccara, C.N., Kropff, E., Moser, M.B., and Moser, E.I. (2008). Representation of Geometric Borders in the Entorhinal Cortex. Science 322, 1865-1868. Minor points • Figure 1: The size/resolution of example traces is too small to judge smaller calcium transients and whether they were classified as significant. Does the 0.75 s transient-length cutoff risk missing shorter events? We apologize for the oversight. We have replaced the example traces with higher resolution ones and zoomed in on excerpt area to ensure the traces are clear. The 0.75 s transient-length cutoff was selected based on previous paper (Zong et al., 2022) and prior experience, in order to avoid false positives due to artifactual fluctuations (Low et al., 2014). We have now added to the method section: ‘To extract calcium transients from noise such as electrical and motion artifacts, significant transients were identified as periods in which ΔF/F was two standard deviations above the baseline fluorescence for more than 0.75 s, as established in previous studies (Low et al., 2014; Zong et al., 2022).’ Zong, W., Obenhaus, H.A., Skytoen, E.R., Eneqvist, H., de Jong, N.L., Vale, R., Jorge, M.R., Moser, M.B., and Moser, E.I. (2022). Large-scale two-photon calcium imaging in freely moving mice. Cell 185, 1240-1256 e1230. Low, R.J., Gu, Y., and Tank, D.W. (2014). Cellular resolution optical access to brain regions in fissures: imaging medial prefrontal cortex and grid cells in entorhinal cortex. Proc Natl Acad Sci U S A 111, 18739-18744. • Clarification: Are HD cell firing onsets associated with locomotion bouts in a given direction, or with changes in head direction? Demonstrating this is similar across free and assisted conditions would strengthen the controls for behavioral differences. We agree with the reviewer that it is an important control that was not addressed in our manuscript. To explore this question, we first divided frames into two groups based on the velocity component along each direction: ‘forward direction’ and ‘lateral direction’ (Extended Data Fig. 5a). The proportion of frames in each group were similar across conditions (Extended Data Fig. 5b). Cells that exhibited HD tuning exclusively in one condition (HD and HD ) showed highly selective maps with comparable MVL across both F A forward and lateral directions (Extended Data Fig. 5c-d). HD cells had slightly smaller I MVL values in the lateral direction in both conditions. These results suggest that the firing onsets of HD cells were associated with the same features across conditions, further supporting that the dynamic changes in HD tuning were not driven by behavioral differences. • Clarification: Please clarify how HD-subtype proportions are distributed across animals. It is unclear how the percentages in Lines 169–175 (~3% HDF, 10% HDA, 3% HDI) map onto the values plotted in the main figures (e.g., Fig. 1g). We apologize for the lack of clarity. We are now added Extended Data Fig. 3b showing the distribution of HD-subtype proportions across animals. Animals have an average of 3.35% HD , 10.57% HD and 2.37% HD. F A I • Rate map orientation: The orientation of the mouse is not always clear in the HD rate maps, as angular axes are not labeled consistently. We thank the reviewer for raising this point. We have modified all the HD maps in the manuscript with labelled angular axes. • Discussion: A short speculation about why loss of self-motion inputs may lead to increased HD coding would be useful. On a purely speculative note, we hypothesize that the increased HD coding observed during assisted navigation may result from an altered balance of inputs. Entorhinal cells might tune to make predictions on available information. Absent self-motion signals as a reliable predictor, they might dedicate more resources to represent viewpoint information provided by sensory cues. We have now added to the first subsection of the Results section: ‘Put together, these results suggest that behavior constraints drive a reconfiguration of HD functional identity in the entorhinal cortex. Specialized codes, represented by HD and A HD cells, are navigation-modality specific, while HD cells implement an invariant F I directional code. Overall stronger directional modulation during assisted navigation might reflect an adaptation to absent or unreliable self-motion inputs.’ • Discussion: The authors should clarify whether the prevailing model is truly that HD cells are fixed, and cite additional studies of plasticity or learning-induced changes in MEC tuning where relevant. To our best knowledge fixed functional cell types are indeed the prevailing view. Studies have shown loss of function in some cases but never a gain of function (e.g. (Winter et al., 2015)). Plasticity in grid cell maps has been shown in several studies (Barry et al., 2007; Boccara et al., 2019; Butler et al., 2019; Krupic et al., 2015; Krupic et al., 2018; Malone et al., 2024; Yoon et al., 2013) but never involving switches in functional cell type classification. Similarities and differences with the two previous studies that we believe to be closest to our results (Kornienko et al., 2018; Low et al., 2021) have a dedicated paragraph in the discussion. We have added a phrase to clarify these ideas in the first paragraph of the introduction. ‘Consequently, the factors determining the functional identity of neurons in the mEC—potentially involving hard-wiring or self-organization—remain an open question. Plasticity has so far shown to have an influence on tuning functions of several cell types, but not on their functional identity (Barry et al., 2007; Boccara et al., 2019; Butler et al., 2019; Krupic et al., 2015; Krupic et al., 2018; Malone et al., 2024; Yoon et al., 2013).’ Winter, S.S., Mehlman, M.L., Clark, B.J., and Taube, J.S. (2015). Passive Transport Disrupts Grid Signals in the Parahippocampal Cortex. Curr Biol 25, 2493-2502. Barry, C., Hayman, R., Burgess, N., and Jeffery, K.J. (2007). Experience-dependent rescaling of entorhinal grids. Nat Neurosci 10, 682-684. Boccara, C.N., Nardin, M., Stella, F., O'Neill, J., and Csicsvari, J. (2019). The entorhinal cognitive map is attracted to goals. Science 363, 1443-1447. Butler, W.N., Hardcastle, K., and Giocomo, L.M. (2019). Remembered reward locations restructure entorhinal spatial maps. Science 363, 1447-1452. Krupic, J., Bauza, M., Burton, S., Barry, C., and O'Keefe, J. (2015). Grid cell symmetry is shaped by environmental geometry. Nature 518, 232-235. Krupic, J., Bauza, M., Burton, S., and O'Keefe, J. (2018). Local transformations of the hippocampal cognitive map. Science 359, 1143-1146. Malone, T.J., Tien, N.W., Ma, Y., Cui, L., Lyu, S., Wang, G., Nguyen, D., Zhang, K., Myroshnychenko, M.V., Tyan, J., et al. (2024). A consistent map in the medial entorhinal cortex supports spatial memory. Nat Commun 15, 1457. Yoon, K., Buice, M.A., Barry, C., Hayman, R., Burgess, N., and Fiete, I.R. (2013). Specific evidence of low-dimensional continuous attractor dynamics in grid cells. Nat Neurosci 16, 1077-1084. Kornienko, O., Latuske, P., Bassler, M., Kohler, L., and Allen, K. (2018). Non-rhythmic head-direction cells in the parahippocampal region are not constrained by attractor network dynamics. Elife 7. Low, I.I.C., Williams, A.H., Campbell, M.G., Linderman, S.W., and Giocomo, L.M. (2021). Dynamic and reversible remapping of network representations in an unchanging environment. Neuron 109, 2967-2980 e2911."}, {"round": 2, "reviewer_comments": {"reviewer_4": "I thank the authors for carefully addressing my concerns. I have no further remarks and, in my opinion, the manuscript is now suitable for publication.", "reviewer_5": "I appreciate the additional analyses comparing unbiased border scores and the MVL wall-vs-center contrast. However, these analyses do not fully address my original concern, and this issue remains important for establishing the novelty of the manuscript’s central claim. The new results argue that HD_A cells are not primarily border cells, but some aspects of the argument remain difficult to evaluate. In particular, the interpretation relies heavily on unbiased border and spatial metrics that may be sensitive to the sampling structure of assisted navigation, where near-wall occupancy is elevated and trajectories through the center of the arena are less diverse. Under these conditions, declines in unbiased border score may reflect limitations of the estimator rather than the absence of boundary-related coding. These unbiased metrics implicitly assume relatively uniform sampling of distances to boundaries and sufficient variability in movement orthogonal to each wall; the constrained trajectories in assisted navigation can compress the range of distances from walls or under-sample central regions, causing the estimator to decrease even if a cell truly has distance- or boundary-modulated firing. One way to address this would be to recompute border scores after matching or stratifying the distance-to-wall distribution between free and assisted sessions, or by restricting analysis to behavior frames with comparable wall-distance sampling. Likewise, comparing HD_A to the broad, heterogeneous non-HD population does not fully address whether a border-like subset could influence the population-level distributions. Because the non-HD group contains many distinct spatial cell types with diverse coding properties—including grid cells, weakly modulated spatial cells, interneurons, and diffuse or noisy units—its border-score distribution is not a meaningful reference for evaluating whether HD_A cells resemble known boundary-tuned populations. A more diagnostic analysis would be to directly examine the relationship between HD tuning and border tuning across the MEC population—for example, by plotting each cell in a two-dimensional space with HD tuning strength on one axis and border/BVC tuning strength on the other, and highlighting the HD_A cells. If HD_A cells form a cluster distinct from strongly border-tuned neurons, this would support the claim that HD_A cannot be explained by boundary-vector coding. Conversely, if HD_A points fall along the same continuum as border-tuned cells, this would suggest that the interpretation should be softened. Such a targeted comparison would be more informative than comparisons to the broad non-HD population and would more directly test whether the HD_A phenotype could be wholly accounted for by boundary-related coding."}, "author_response": "Dear Editor and Reviewers: We thank the editor and all the reviewers for their constructive feedback on our manuscript titled ‘Directional dynamics in the entorhinal cortex driven by behavioral constraints’. We have conducted additional analyses, which we hope fully address the reviewer’s concerns and meet the journal’s requirements. Detailed point-to-point responses to the reviewers are provided below. The reviewers’ comments are presented in black font. Our responses are in blue font. Specific corrections introduced into the manuscript are in red font. Reviewer #4 I thank the authors for carefully addressing my concerns. I have no further remarks and, in my opinion, the manuscript is now suitable for publication. We appreciate the positive assessment of our work, and thank you for the helpful feedback. Reviewer #5 I appreciate the additional analyses comparing unbiased border scores and the MVL wall-vs-center contrast. However, these analyses do not fully address my original concern, and this issue remains important for establishing the novelty of the manuscript’s central claim. Thank you for your time and thoughtful comments on our manuscript. In response to these additional feedbacks, we have conducted new analyses, which we hope clarify our results and address your questions. The new results argue that HD_A cells are not primarily border cells, but some aspects of the argument remain difficult to evaluate. In particular, the interpretation relies heavily on unbiased border and spatial metrics that may be sensitive to the sampling structure of assisted navigation, where near-wall occupancy is elevated and trajectories through the center of the arena are less diverse. Under these conditions, declines in unbiased border score may reflect limitations of the estimator rather than the absence of boundary-related coding. These unbiased metrics implicitly assume relatively uniform sampling of distances to boundaries and sufficient variability in movement orthogonal to each wall; the constrained trajectories in assisted navigation can compress the range of distances from walls or under-sample central regions, causing the estimator to decrease even if a cell truly has distance- or boundary-modulated firing. One way to address this would be to recompute border scores after matching or stratifying the distance-to-wall distribution between free and assisted sessions, or by restricting analysis to behavior frames with comparable wall-distance sampling. We agree that balanced distributions of distance to wall would remove potential biases. We have performed additional analyses and included them in Extended Data Fig. 9. As suggested, we grouped data into bins of distance-to-wall, downsampling them within every bin to ensure identical numbers of frames across conditions. Consistent with previous results, no difference in HD cell border score was found between free and assisted A sessions, width distribution means centered around a border score of zero (Extended Data Fig. 9d). These results further confirm that HD cells show an overall poor border response. A Likewise, comparing HD_A to the broad, heterogeneous non-HD population does not fully address whether a border-like subset could influence the population-level distributions. Because the non-HD group contains many distinct spatial cell types with diverse coding properties—including grid cells, weakly modulated spatial cells, interneurons, and diffuse or noisy units—its border-score distribution is not a meaningful reference for evaluating whether HD_A cells resemble known boundary-tuned populations. A more diagnostic analysis would be to directly examine the relationship between HD tuning and border tuning across the MEC population—for example, by plotting each cell in a two-dimensional space with HD tuning strength on one axis and border/BVC tuning strength on the other, and highlighting the HD_A cells. If HD_A cells form a cluster distinct from strongly border-tuned neurons, this would support the claim that HD_A cannot be explained by boundary-vector coding. Conversely, if HD_A points fall along the same continuum as border-tuned cells, this would suggest that the interpretation should be softened. Such a targeted comparison would be more informative than comparisons to the broad non-HD population and would more directly test whether the HD_A phenotype could be wholly accounted for by boundary-related coding. We agree and have now added new analyses as suggested and included them in Extended Data Fig. 9. By plotting all cells in a two-dimensional space defined by MVL and border score, we show that, although some overlap exists with border cells (as between most pairs of functional cell types in the MEC), this overlap is rather small and actually larger for HD than for HD cells (Extended Data Fig. 9e-f), consistent with the larger overall border F A score of HD cells shown in Extended Data Fig. 9d (right panel). To quantify these F observations, we first applied a two-tailed binomial test to assess the deviation of the size of the overlap between border and HD cells from what would be expected from a random assignment process. We found that for all comparisons the overlap did not differ from chance levels, supporting the idea that the processes recruiting cells to each category are independent (Extended Data Fig. 9e-f). In addition, we used a generalized linear model with binomial distribution to model whether or not a neuron belonged to the border cell category. The model included spatial information and HD categories (HD HD or HD) as F, A I predictors of whether a cell was classified as a border cell. The results show that only spatial information was a significant predictor (p =0.029, p =0.79, p =0.50, spatial_info HDF HDA p =0.96). These findings further indicate that HD and border cells are independent HDI A categories. In response to these two points, we have added to the caption of Extended Data Figure 9 the following descriptions: (d) (Left) Behavior frames were downsampled to match the proportion of frames in each distance bin across conditions (i.q.r.; N = 11 sessions). (Right) After downsampling, distributions of border scores for different HD types (color-coded) under different conditions (within HD type Wilcoxon matched-pairs tests with p-values indicated; HD : 30 cells, HD : F A 131 cells, HD: 16 cells). Only cells with at least one spatial field under both conditions were I included in border cell statistical analyses. (e) (Left) MVL versus border score for all cells during free exploration (one dot per cell HD; category color-coded). Dashed lines indicate classification thresholds for HD cells and border cells. Two-tailed Binomial tests were used to assess the deviation from chance levels of the size of the overlap between border cell and HD categories, and their p-values indicated (same color code). (f) Same as (e) but for cells recorded under assisted condition. To further test the independence between HD A and border cells, we used a generalized linear model with binomial distribution to model the recruitment of neurons into the border cell category. The model included spatial information and HD categories (HD HD or HD) as predictors of whether a cell was F, A I classified as a border cell. The results showed that only spatial information was a significant predictor (p =0.029, p =0.79, p =0.50, p =0.96). spatial_info HDF HDA HDI"}, {"round": 3, "reviewer_comments": {"reviewer_5": "The authors have done a nice job updating manuscript and all of my previous concerns have been satisfactorily addressed. I have no further comments."}, "author_response": "Dear Editor and Reviewers: We sincerely appreciate all the constructive comments on our manuscript, ‘Directional dynamics in the entorhinal cortex of male mice driven by behavioral constraints’. The reviewers’ comments are presented in black font. Our responses are in blue font. REVIEWERS' COMMENTS Reviewer #5: The authors have done a nice job updating manuscript and all of my previous concerns have been satisfactorily addressed. I have no further comments. We greatly appreciate your time and positive feedback to our manuscript."}]

Decision letter