Behavioral performance and imaging while learning a visual-association task

a) Animals were head-fixed on a running wheel, and drifting gratings were displayed in their right visual field. Task rules before and after cue reversal are illustrated. b) Raster plot showing lick detection sorted by trial type (plus, minus, neutral) for one example animal in naïve and expert sessions. c) Behavioral performance score (d’) defined as (z-score of hit rate in all trials) across all animals and sessions, aligned to cue reversal (N = 9 pre, N = 4 post). * d) Fraction of trials with a lick response within the two-second response window after cue offset. * e) Coronal illustration of mouse brain showing the implanted optical window above postrhinal cortex (POR) (upper panel). The lower panel shows a representative example of the RiboL1-jGCaMP8s expression in POR. The right panel shows a two-photon imaging field of view from one example animal. The scale bar indicates 150 µm. f) ΔF/F0 traces from five POR example neurons. The vertical scale bar indicates a 200% increase in ΔF/F0, and the horizontal scale bar indicates 15 seconds. g) Sagittal illustration of mouse brain indicating targeted Soma-jGCaMP8s expression in the MEC and position of the right-angle transcranial prism (2x2mm) (upper panel). The lower panel shows a representative example of the Soma-jGCaMP8s expression in MEC. The right panel shows a two-photon imaging example field of view from MEC. The scale bar indicates 150 µm. h) Same as in f) for five MEC example neurons. *Data is shown as mean ± SEM across mice.

Neurons become modulated as learning progresses

a) Time course of mean activity (Z-scored ΔF/F0) in response to plus-, minus-, and neutral trials (columns) for the top 150 trial active neurons (rows) across different learning stages, before and after reversal, from one POR and one MEC example mouse. Cells are sorted by peak responses during the cue-or response-window. b) The trial active cell fraction increases with learning of the task. Trial active cells are defined as cells with a significant increase in ΔF/F0 for at least one time-bin (1s) within the cue-or response-window. * c) Same as b) but sorted by trial type across training phases. * d) Absolute mean population response (ΔF/F0 across stimulus window relative to one-second preceding stimulus onset) of all trial active neurons across all training stages in POR and MEC, before and after reversal. * e) Cell masks detected for individual imaging sessions (naïve and expert reversal) from the same animal in light grey, overlaid by cell masks of cells present in both sessions (dark grey). Example of a neuron (in blue) matched across multiple imaging sessions with an overlap score for each session (lower panel). f) Examples of single-cell activity. Mean activity time courses (Z-scored ΔF/F0) in response to the different trial types for six example neurons identified across sessions. *Data is shown as mean ± SEM across mice.

An increasing number of neurons becomes modulated by behavior– and task-related variables

a) GLM prediction versus actual neural activity for one example neuron from POR (upper panel, R2 = 0.927) and MEC (R2 = 0.678) in a 50s window. b) Fraction of neurons significantly modulated across the different learning stages for POR and MEC. Pie charts show the overall fraction of modulated cells in the respective regions. * c) Distribution of R2 values (full model including all regressors) across learning stages for POR and MEC. * d) Trial-averaged GLM prediction vs actual activity of MEC example cells. For each example cell, we show the model’s prediction, including all regressors, and the model without the regressor group, which has the highest uniquely explained variance. Only the most relevant trial type is shown. e) Heatmap showing the region-specific average fraction of modulated cells across all subjects (POR: N = 4 and MEC: N = 5) across different learning stages and regressors. *Data is shown as mean ± SEM across mice

Clustering neurons with similar task-relevant tuning characteristics

a) Histogram of total cell counts in the seven identified clusters. The colored pie chart shows the fraction of each cluster per region (POR: postrhinal cortex, MEC: medial entorhinal cortex). b) Cells represented by their task-relevant regression weight vectors in two-dimensional UMAP space. c) Same as b) with region-specific coloring. d) The average weight vector of each cluster across sessions. Note the stimuli-induced activity in C3-C5. e) Trial-averaged responses of cells in each cluster for each trial type in an example session from POR (upper panel) and MEC. Thin lines indicate individual cell responses and bold lines indicate the respective mean of all cells in that cluster. C6 was not present in most MEC animals. f) Cell responses from an example session from POR (upper panel) and MEC (lower panel) are sorted by cluster, and each row represents one cell. Color bars on top indicate visual stimuli (plus cue: green; minus cue: orange; neutral: grey. Note the licking-related activity in C1 and C2 and the cue-modulated activity in C3-C5. g) Average fraction of cells in relevant clusters across different stages showing an increase for the two lick-related clusters C1 and C2 in both regions. h) Sankey diagram of cluster dynamics between learning stages for one POR example animal. i) Same as h) but for a MEC example animal. j) Examples of one POR and one MEC neuron matched across eight sessions before reversal. Left panels indicate two-photon FOVs highlighting with the cell mask consistently matched across sessions in shades of green. The right panel shows mean activity time courses (fractional change in fluorescence, ΔF/F0) for the same neuron across indicated sessions in response to plus trials. Both neurons remain within their respective clusters across all sessions. k) Cluster stability scores for pairs of subsequent sessions (each dot represents one such pair). The stability score measures the fraction of cells found in the same cluster in the subsequent session. Here, we only included C1 and C2 clusters and session-cluster pairs with stability higher than chance (see Methods).

The POR encodes more visual information than the MEC, while both regions show increased choice information across learning with a more robust correlation structure MEC.

a) Cell fractions in stimulus clusters across learning stages for the two regions. * b) Decoding accuracy for the stimulus clustered cells is higher in POR than MEC with no difference between plus-, minus-, and neutral cues. The dotted line indicates chance. * c) Region-specific decoding accuracy for stimulus clusters across all defined learning stages. * d) Region-specific and trial-type sorted decoding accuracy for stimulus clusters across learning stages. * e) Histogram showing the offsets between the lick signal and deconvolved traces for C2 cells (negative offset means spikes precede licking). f) Mutual information between neuronal response and choice (i.e., lick vs. no-lick, MI(R;C)), shown as the mean of the population. Overall, the choice information was virtually non-existent in naive mice but increased with learning in both brain areas. g) Same as in (f) but for each of the functional cell clusters. In both brain areas, the choice information was highest in clusters 2 and 4, i.e. those most closely linked to the rewarded cue-outcome pair (reward consumption and Plus-cue, respectively) h) Cluster-sorted correlations of a baseline run before training and a spontaneous run after training for one POR and one MEC animal. i) Distribution of intra-cluster versus inter-cluster correlations for the different clusters in POR (top) and MEC (bottom). j) Most relevant linear mixed effects model coefficients and their 95% confidence interval. Significant coefficients (p < 0.05) are marked in red (see Supplementary Fig. 5j for a complete list of coefficients). *Data is shown as mean ± SEM across mice P < 0.05, ∗∗P < 0.01, ∗∗∗P < 0.001.

Functional cell groups are also anatomically clustered in MEC

a) Anatomical distribution of cell masks of C1 (blue) and C2 cells (orange) in two example mice from each region. All other cells are shown in light grey. The scale bar indicates 150 µm. b) Distributions of subsampled k-nearest neighbor (k = 5) distances within the clusters C1 and C2 compared to a baseline with shuffled cluster identities in POR and MEC. c) The Distribution between C1 and C2 distances to a shuffled distribution shows that the clusters are also significantly separated in MEC. d) Fraction of eligible sessions (more than 12 cells in each cluster) across all mice that show significant anatomical clustering of C1 cells (left panel) and C2 cells (right panel). e) Fraction of sessions with significant separation between C1 and C2 cells across regions. f) Anatomical distribution of cell masks for C1 and C2 cells in a representative MEC mouse at different learning stages (from naive to naive reversal sessions). Note the recruitment of task-modulated cells from naive to expert and the anatomical clustering. The scale bar indicates 150 µm. g) Distribution of R-values for the lick regressor across all detected cells in different sessions throughout the learning stages for the mouse shown in panel f. Cells belonging to clusters C1 and C2 are color-coded accordingly.

a) Behavioral performance scores (z score of hit rate and false alarm rate) for individual POR and MEC animals, aligned to cue reversal (N = 4 POR animals and N= 5 MEC animals). b) Performance score for mouse 4 (MEC animal) with naive (N), learning (L), expert (E), naive reversal (NR), learning reversal (LR), and expert reversal (ER) sessions indicated. c) Trial sorted time to first lick after cue-onset across animals from naive to expert stages pre-reversal. * d) Lick rate to plus trials within the trial structure for naive (light green) and expert (dark green) sessions. * e) Fraction of trials with a lick response within the two-second response window after cue offset for two POR and two MEC example animals. f) Coronal sections from one POR animal indicating RiboL1jGCaMP8s expression in the imaged hemisphere (upper left panel). Upper right panel shows a series of saggital sections from one MEC-targeted mouse (M1) indicating the spread of Soma-jGCaMP8s expression from lateral (3.66mm) to more medial coordinates (3.10mm). Saggital sections indicating the expression center of Soma-jGCaMP8s targeted to MEC from four mice. Orange bar indicates visible impact on the tissue from the transcranial prism (2x2mm) implant (lower panel). *Data is shown as mean ± SEM across mice.

a) Time course of mean activity (Z-scored ΔF/F0) in response to plus-, minus-, and neutral trials (columns) for the top 150 trial active neurons (rows) in the learning session, before and after reversal, from the same POR and MEC example mice shown in Fig. 2a. Cells are sorted by peak responses during the cue-or response-window. b) The total fraction of trial active cells for individual animals. Trial active cells defined as cells with significant increase in ΔF/F0 for at least one time-bin (1s) within the cue-or response-window.

a) Example design-matrix including all regressors for the Generalized Linear Model (GLM). b) Median R2 values of the initial parameter grid search using expert sessions. The parameters leading to the highest value (α = 0.001 and l1-ratio = 0.9) were used for all subsequent experiments. c) Distribution of all R2 values of models where all regressors were shuffled. The black line indicates 95th percentile and red line indicates chosen threshold at R2 = 5% d) Distribution of values for the different regressors across all sessions for POR and MEC. Cells modulated by the different regressors are indicated in light grey. e) Distribution of R2 values of modulated cells for individual animals across sessions. f) Fraction of cells modulated by single or multiple regressors across regions.

a) Area under the curve (AUC) of the eCDF calculated for each consensus matrix. b) Eight clusters were selected as the optimal number of clusters using the Elbow method, where the AUC showed minimal improvement ( 0.1) for cluster numbers greater than eight. c) Histogram showing the total number of cells in each cluster. We set the inclusion criterion for further analysis to a minimum of 50 cells per cluster. d) Cells represented by their task-relevant regression weight vectors in two-dimensional UMAP space color-coded by region-specific animal ID. e) Total number of cells clustered per session for the nine different animals. f) Same as e) but showing the total fraction of cells clustered. g) Fraction of cells in C1-C6 for two POR and two MEC example animals across sessions. h) Relationship between cluster consistency scores and the p-values determined using a shuffled distribution (see Methods). Each dot represents one session. i) Relationship between consistency scores and the minimum number of cells of a cluster in the two relevant sessions used to determine the score. j) eCDF plots of the sessions of each animal over the p-value determined for the consistency scores of each session-cluster pair. k) Distributions of significant consistency scores for all clusters. Each dot represents one session (see Methods).

a) Mean decoding accuracy per cell using a support vector machine (SVM) classifier with a linear kernel, using a 5-fold cross-validation scheme repeated 10 times. Data points are color-coded according to the respective regions. b) Overall decoding accuracy for the three different cell groups tested: stimulus clusters (C3-C5), GLM-based (stimulus modulation determined by GLM), and not clustered cells. c) same as b) reporting absolute number of cells per region, per cell group. d) Decoding accuracy for the stimulus cluster, sorted by stimulus type for individual animals, color-coded by animal ID. e) Histogram showing the distribution of offsets between the lick signal and deconvolved traces for modulated cells in individual animals (negative offset means spikes precede licking). f) Scatterplot of the fitted values vs observed values in the linear mixed effects model applied to the pairwise correlations. g) Residuals over fitted values of the linear mixed effects model did not show a systematic trend. h) Distribution of residuals. i) Q-Q plot of residuals of the linear mixed effects model. j) All coefficients of the linear mixed effects models and their 95% confidence intervals. All significant coefficients (p < 0.05) are marked in red.

a) Relationship between p-values and number of cells for the clustering of C1 (left), and C2 (center), and the separation of the two (right). Each dot represents a session. For the separation, the minimum number of cells of C1 and C2 was chosen. b) eCDF plots for the p-values of the clustering of C1 and C2 and the separation of the two for different values of k in POR. c) Same as in b) but for MEC sessions. d) Distributions of normalized mean distances (normalized by the shuffled distribution) C1 cells (left) and C2 cells (center) as well as the distances between C1 and C2 (right) for different animals.