Data from: Granule cells reorient cortical trajectories to separate contexts
Data files
Abstract
The study investigates how cortico-cerebellar circuits balance generalization across related tasks with the need to generate context-specific activity. Mice learned two sensorimotor tasks in parallel—a forelimb robotic-handle task (“Reach”) and a virtual-reality locomotion task (“VR”)—that differed in movement and sensory context but shared the temporal sequence Action → Delay → Reward. The dataset contains processed behavioral and dual-site two-photon calcium-imaging data from premotor layer 5 pyramidal tract neurons (L5PTs) and cerebellar granule cells (GrCs), tracked across recording sessions. The primary dataset comprises 18 trained cross-task Reach–VR session pairs. 9 novice cross-task pairs are included to examine how neural context separation develops during learning. 9 trained same-task pairs provide Reach–Reach and VR–VR cross-day controls. Stored data include reward-aligned behavior, licking, L5PT and GrC fluorescence, continuous fluorescence traces, cell-registration information, reliability measures, trial metadata, and session-level behavioral summaries. The deposit also includes processed trial-level licking and laser-state data from the GtACR1 optogenetic-inhibition experiment associated with Extended Data Figure 2. These data comprise four trial conditions—rewarded or reward-omission trials, each with laser off or on—for both Reach and VR. The accompanying MATLAB analysis code is maintained separately on GitHub and reproduces the principal empirical analyses and figures. The repository’s README provides file organization, variable definitions, dimensions, units, cohort definitions, and instructions for linking the Dryad data to the versioned analysis release.
This dataset supports Garcia-Garcia et al., “Granule cells reorient cortical trajectories to separate contexts” (in press, 2026). It includes processed behavioral and dual-site two-photon imaging data.
The study follows the same mice while they learn two skills in parallel:
- Reach: the mouse pushes a robotic handle with its left forepaw. A successful reach is followed by a 1 s delay and water reward.
- VR: the mouse runs along a 60 mm virtual linear track. Arrival at the target is followed by the same 1 s delay and water reward.
Although the tasks use different movements, sensory environments, and apparatuses, both share the temporal structure Action -> 1 s Delay -> Reward + ITI. Premotor layer 5 pyramidal tract neurons (L5PTs) and cerebellar granule cells (GrCs) were imaged simultaneously and tracked across sessions.
Most of the paper, including the principal analyses in Figures 1-4, concerns animals after dual-task training. The Novice recordings are used later, primarily in Figure 5 and Extended Data Figure 5, to examine how context separation develops with learning.
The workspace is organized as follows:
crossTask(27 x 1struct) contains paired VR and Reach sessions:- 18 Trained pairs, represented in the workspace by the
midandexpertlearning-stage labels. These are the primary data used to compare cortical generalization with cerebellar context separation. - 9 Novice pairs, labeled
novice. These were recorded on consecutive VR and Reach training days immediately after pre-training, before animals had learned predictive timing in both tasks.
- 18 Trained pairs, represented in the workspace by the
sameTask(9 x 1struct) contains Trained VR-VR or Reach-Reach session pairs. These are cross-day controls used to distinguish genuine context-dependent remapping from tracking noise or ordinary day-to-day variability.xlstbl(70 x 16table) is the session manifest and matching table.
In the manuscript, Trained is the group-level term encompassing the mid and expert acquisition stages.
The public analysis script consistently combines mid and expert for group-level Trained analyses:
Example stage selection:
stage = lower([crossTask.learningstage]);
trainedIdx = ismember(stage, ["mid", "expert"]);
noviceIdx = stage == "novice";
trainedCrossTask = crossTask(trainedIdx); % 18 VR-Reach pairs
noviceCrossTask = crossTask(noviceIdx); % 9 VR-Reach pairs
trainedControls = sameTask; % 9 same-task pairs
Files in this dataset
| File | Approximate size | Saved variables | Contents |
|---|---|---|---|
data1.mat |
1.488 GB | xlstbl1 |
First fragment of the session manifest and its nested processed single-session data. |
data2.mat |
2.294 GB | xlstbl2 |
Second fragment of the session manifest and its nested processed single-session data. |
data3.mat |
3.092 GB | xlstbl3 |
Third fragment of the session manifest and its nested processed single-session data. |
data4.mat |
3.760 GB | crossTask, sameTask |
Analysis-ready paired-session imaging and behavioral structures. |
optodata.mat |
0.027 GB | laser_stack, lickratestack, lickstack, tplt_s_tsk |
Processed GtACR1 optogenetic licking data for Extended Data Figure 2. |
The five files total approximately 10.662 GB. The MAT-files contain processed data; raw two-photon movies are not included.
Software and hardware requirements
The associated analysis was tested with MATLAB R2025a. Required MathWorks products are:
- MATLAB;
- Statistics and Machine Learning Toolbox;
- Signal Processing Toolbox; and
- Image Processing Toolbox.
The analysis uses MATLAB R2025a functions including kde and violinplot. Earlier MATLAB releases are not supported. Because loading the complete manifest and paired structures requires substantially more memory than the compressed files occupy on disk, a computer with at least 32 GB RAM is recommended.
Analysis code is provided in the versioned GitHub repository linked from the Dryad record. The repository contains:
GarciaGarcia2026.m- principal imaging and behavioral analysis;GarciaGarcia2026_gtacr1.m- GtACR1 optogenetic analysis; anddependencies/- custom helper functions used by the two scripts.
Loading the public data
The scripts look for the required MAT-files first in a data subdirectory beside the scripts and then beside the scripts themselves. If the files are not found, the setup section asks the user to select the Dryad download directory. A recommended local arrangement is:
GarciaGarcia2026.m
GarciaGarcia2026_gtacr1.m
dependencies/
data/
data1.mat
data2.mat
data3.mat
data4.mat
optodata.mat
Run the first setup section of GarciaGarcia2026.m before running later sections. It loads the four imaging files and constructs the combined manifest as:
xlstbl = vertcat(xlstbl1,xlstbl2,xlstbl3);
clear xlstbl1 xlstbl2 xlstbl3
Run the setup section of GarciaGarcia2026_gtacr1.m to load optodata.mat. Both scripts add the bundled dependencies directory using the saved script location, so they remain compatible with section-by-section execution in the MATLAB Editor.
The main analysis is implemented as ordered MATLAB sections. Many later figure sections use intermediate variables created by the joint-PCA section, so running isolated later sections in a fresh workspace may fail.
Optogenetic licking dataset
optodata.mat contains the processed trial-level data for the GtACR1 experiment in Extended Data Figure 2. The manuscript describes four sessions from four mice. The file contains four saved variables:
tplt_s_tsk—1 x 2cell array of reward-centered time vectors. Element 1 is Reach (801 samples,dt = 0.005 s, -2 to 2 s); element 2 is VR (20,001 samples,dt = 0.0002 s, -2 to 2 s).lickstack—2 x 1cell array. Each task element contains four binary trial-by-time lick-contact matrices.lickratestack—2 x 1cell array with the same organization, containing normalized lick-rate traces. Values were normalized to the peak lick rate in rewarded laser-off trials; filtering/normalization can produce small values below zero.laser_stack—2 x 1cell array with the same organization, containing binary laser-state matrices.
Within each task, the four groups are ordered:
- Rewarded, laser-off.
- Rewarded, laser-on.
- Reward omitted, laser-off.
- Reward omitted, laser-on.
The trial counts are [263, 34, 48, 43] for Reach and [243, 35, 39, 34] for VR. The analysis summarizes normalized lick rate from -0.7 to -0.2 s relative to reward. The detected laser epochs are -0.745 to -0.200 s for Reach and -0.7978 to -0.1058 s for VR.
The processed file pools trials and does not store mouse or session identifiers aligned to individual rows. The GtACR1 plots andcomparisons use trials as observations.
Experimental and processing summary
- L5PTs in premotor cortex expressed jRGECO1a and were imaged through the cortical arm of a custom dual-site microscope.
- GrCs expressed GCaMP6f and were imaged simultaneously in contralateral cerebellar Crus I, Crus II, or simplex.
- Imaging frames were acquired at 30 Hz.
- Movies were motion-corrected with NoRMCorre, slow fluorescence drift was removed, and sources were extracted with constrained non-negative matrix factorization followed by manual curation.
- Extracted fluorescence traces were z-scored.
- Cells were registered across the paired imaging sessions. The analysis retained cells with validated activity in both sessions.
- Unless a particular analysis states otherwise, paired neural comparisons use cells that were jointly task-locked in both sessions. Reliability was calculated from odd-versus-even trial averages, corrected with the Spearman-Brown formulas, and thresholded at adjusted reliability greater than 0.4 (except Extended Data Fig. 7 which reproduced main results with no threshold).
- Stored behavioral and neural trials span
[-3, 2]s relative to reward. Reward is att = 0, and the end of the reach/run is represented at approximatelyt = -1s. - The principal paired neural analyses generally crop the stored data to
[-2, 2]s. The movement-stereotypy calculations use task-specific pre-reward windows:[-2, -1]s for Reach and[-3, -1]s for VR. - Reward omission trials comprised approximately 20% of trials and were randomly interleaved.
MATLAB structure conventions
Call one paired-session structure curd:
curd = crossTask(i);
% or
curd = sameTask(i);
Each curd contains two sessions from one mouse. Unless noted otherwise, elements of a 1 x 2 field follow the same ordering as:
curd.dates
curd.task
curd.trials
curd.rawsigs
For crossTask, the public script assumes session order [Reach, VR]. For sameTask, the two sessions are addressed as [Day1, Day2]; the task itself is either Reach on both days or VR on both days.
Dimension symbols used below are:
Ntrial: number of retained trials in one session.NGrC: number of GrCs retained for the paired-session analysis.NL5PT: number of L5PTs retained for the paired-session analysis.Nt_beh = 5001: samples in the[-3, 2]s behavioral window, approximately 1 kHz.Nt_neural = 151: samples in the[-3, 2]s neural window, approximately 30 Hz.Nt_raw: samples in a session's continuous imaging trace, typically approximately 32,000 in this release.
Cell and trial counts vary across mice and session pairs.
Units and value conventions
- All time values and time axes are in seconds unless stated otherwise.
- Behavioral position is stored in millimeters along the task-relevant trajectory: robotic-handle displacement for Reach and virtual-track position for VR.
lickis a binary contact signal (0= no contact,1= contact).lickrateis expressed in licks per second.- L5PT and GrC fluorescence values are z-scored and therefore dimensionless.
- Cell-centroid coordinates are in image pixels.
- Reliability values and licking fractions are dimensionless.
- Trial labels use the strings
rewardedandomitted. - MATLAB missing strings are represented by
<missing>, missing numeric manifest values byNaN, and unavailable nested data by empty cells or empty arrays. NaN and empty values in the manifest indicate unavailable or inapplicable metadata, not zero.
Paired-session fields
Identification and session metadata
mouse- scalar string identifying the mouse.learningstage- scalar stage label. Usemidandexpertfor the manuscript's Trained dataset andnovicefor the Novice dataset.dates-1 x 2string array containing the paired recording dates.task-1 x 2string array containingVRorReachfor each session.ntrials-1 x 2vector containing the retained trial count for each session.
Trial-aligned behavioral and neural data
curd.trials is a 1 x 2 structure array, with one element per session:
td = curd.trials(sessionIndex);
Its fields are:
pos-Ntrial x 5001single-precision matrix of reward-aligned position. It contains robotic handle position in Reach and virtual-track/running-sphere position in VR. The public script refers to this generically as "track or handle" position.lick-Ntrial x 5001matrix of reward-aligned lick-sensor samples.lickrate-Ntrial x 5001matrix of reward-aligned lick rate. In the paper, lick events were binned at 1 kHz and smoothed with a Gaussian kernel (sigma = 20 ms).trialTypes-Ntrial x 1string array containing trial labels, including rewarded and reward-omission trials.trialNums-Ntrial x 1vector containing the original trial number of each retained trial.L5PT-Ntrial x NL5PT x 151single-precision array of reward-aligned, z-scored L5PT fluorescence, organized as trials by cells by time points.GrCs-Ntrial x NGrC x 151single-precision array of reward-aligned, z-scored GrC fluorescence, organized as trials by cells by time points.
The paired sessions can contain different numbers of trials. Within one curd, the neural arrays share the registered cell population needed for cross-session comparison.
Continuous fluorescence
curd.rawsigs is a 1 x 2 structure array containing continuous z-scored fluorescence traces:
rawsigs(sessionIndex).L5PT-NL5PT x Nt_rawsingle-precision L5PT signal matrix.rawsigs(sessionIndex).GrCs-NGrC x Nt_rawsingle-precision GrC signal matrix.
These continuous traces support analyses that use the entire recording rather than reward-aligned trial excerpts. The Figure 3 canonical-correlation/communicating-subspace analysis crops the two sessions to their common duration before concatenation.
Cell tables, counts, and retained summaries
GrCs-NGrC x 10table of GrC identifiers, registration/QC information, per-session trial averages, and cell-level analysis summaries.L5PT-NL5PT x 10table of L5PT identifiers, registration/QC information, per-session trial averages, and cell-level analysis summaries.GrCs_cellcountandL5PT_cellcount-1 x 2vectors containing the detected cell count for each session.GrCs_trackedCellsandL5PT_trackedCells-1 x 2stored cross-session tracking counts. The public script uses the first element as the number of VR/Reach-matched or Day1/Day2-matched cells for Figure 1W and Extended Data Figure 1C.auc-1 x NGrCper-GrC fraction of analyzed samples whose z-scored fluorescence exceeded 1. This field is retained from processing but is not used byGarciaGarcia2026.m.relCntB-1 x 2count of L5PTs and GrCs, respectively, whose adjusted reliability exceeded 0.4 in both paired sessions. This field is retained for reference and is not used byGarciaGarcia2026.m.
For a cross-task pair, each L5PT or GrC table has these ten variables:
cellnums-Ncell x 2registered cell indices for Reach and VR.Reach_centsandVR_cents-Ncell x 2cell-centroid coordinates in image pixels.Reach_rewardedandVR_rewarded-Ncell x 151rewarded-trial mean z-scored fluorescence.Reach_omittedandVR_omitted-Ncell x 151reward-omission-trial mean z-scored fluorescence.Reach_reliabandVR_reliab-Ncell x 1adjusted split-half reliability.rel-Ncell x 2matrix containing the two session-specific reliability values.
For a same-task pair, the table has the corresponding ten variables cellnums, Day1_cents, Day1_rewarded, Day1_omitted, Day1_reliab, Day2_cents, Day2_rewarded, Day2_omitted, Day2_reliab, and rel. Most paired analyses select cells whose reliability exceeds 0.4 in both sessions and then z-score the rewarded trial averages across time before PCA or correlation analysis.
Licking summaries and dual-task proficiency
lickPre-1 x 2vector containing the stored pre-reward licking summary. The manuscript defines the pre-reward window as[-0.5, 0]s relative to reward.lickPost-1 x 2vector containing the stored post-reward licking summary. The manuscript defines the post-reward window as[1.0, 1.5]s.lickFC2-1 x 2vector containing the predictive licking fraction used for Figure 5 and Extended Data Figure 5.lickFC-1 x 2additional derived licking summary retained by the analysis workspace. It is loaded into the general behavioral-results array but is not used as the paper's dual-task proficiency score.
The predictive licking fraction stored in lickFC2 is:
Lick_pre / (Lick_pre + Lick_post)
The dual-task score is the smaller of the predictive licking fractions from VR and Reach. This conservative definition requires predictive behavior in both tasks. One Trained pair was excluded from licking-based analyses because the VR lick sensor was stuck high; therefore those analyses use 17 Trained pairs rather than 18.
Average images
avIms-2 x 2cell array containing mean imaging fields for registration and quality control. Rows follow cell-type order[L5PT, GrCs]; columns follow the two-session order ([Reach, VR]or[Day1, Day2]). Thuscurd.avIms{1,1}is the first-session L5PT mean image andcurd.avIms{2,2}is the second-session GrC mean image.
Cell-registration fields
Registration structures contain:
dayNamesOthers- scalar string identifying the companion session used for registration.cellnums-Nmatched x 1uint16vector of registered cell indices.
The field names depend on the comparison type.
Cross-task VR-Reach pairs
Elements of crossTask contain:
GrCs_ReachandL5PT_Reach- registration information associated with the Reach session.GrCs_VRandL5PT_VR- registration information associated with the VR session.
These fields are present for both Trained and Novice cross-task pairs.
Trained same-task controls
Elements of sameTask contain:
GrCs_Day1andL5PT_Day1- registration information associated with the first session.GrCs_Day2andL5PT_Day2- registration information associated with the second session.
Same-task pairs are controls from Trained mice and contain either VR-VR or Reach-Reach comparisons.
Session manifest: xlstbl
xlstbl is a 70 x 16 table recording session identity, acquisition metadata, learning stage, and matching relationships. Its columns are:
Mouse- mouse identifier.Date- recording date.Task-VRorReachtask label.CrossTaskMatch- identifier of the matched session in the other task.CrossTaskMatchDir- direction/location information for the cross-task match.LearnMatches- legacy learning-session matching information retained from the acquisition manifest; it is not used by the released analysis.LearnMatchDir- legacy numeric field that isNaNin all 70 released rows and is not used by the released analysis.SameTaskMatch- identifier of the same-task control session.SameTaskDir- direction/location information for the same-task match.TrainingDay- legacy numeric field that isNaNin all 70 released rows and is not used by the released analysis.LearningStage- acquisition-stage label used to distinguish Novice, mid-training, and expert recordings.Lobule- imaged cerebellar lobule.x40xMag- metadata for the cerebellar 40x acquisition.x16xMag- metadata for the cortical 16x acquisition.Microscope- microscope identifier.crosstaskDat- cell containing the fuller processed single-session structure. It provides the original time axes (tmpx_left,tmpx_right, andtmpxx) and reward-aligned signals used when an analysis must include cells outside the longitudinally matched population. In particular, Figure 2L-N and Extended Data Figure 3A userewAlgn.sigFilt_left_redfor L5PTs andrewAlgn.sigFilt_right_greenfor GrCs so dimensionality can be estimated from all reliable cells in each session.
Intentional missing manifest values
CrossTaskMatch,CrossTaskMatchDir, andcrosstaskDatare missing or empty for 16 sessions without an available cross-task comparison.SameTaskMatchandSameTaskDirare missing for 52 sessions without a same-task comparison.LearnMatchDirandTrainingDayareNaNin every row and are retained only to preserve the source manifest schema.
Nested crosstaskDat fields
Nonempty crosstaskDat cells contain the fuller processed single-session structure used to construct the paired data. Its fields are grouped below.
- Acquisition dimensions and sampling:
pixh_left,pixw_left,pixh_right,pixw_right,dtb_NI,dtb_VR,dtimleft,dtimright,ntb_NI,ntb_VR,ntim_left,ntim_right, andnf. - Cell counts and locations:
nc_left_red,nc_right_green,centroids_left_red, andcentroids_right_green. - Continuous signals:
sigFilt_left_redandsigFilt_right_greenare cell-by-time z-scored fluorescence matrices;f0_left_redandf0_right_greencontain the corresponding fluorescence baselines. - Acquisition synchronization:
frame_left,frame_right,timesharefac_left, andtimesharefac_right. - Behavior and trial detection:
lick,lickrate,compMvmts,goodMvmt,goodMvmts,rewarded,startPos,truestart,midpt,trueend,endTimes,rewtimes,rewdel,mvlen, andn_mv. - Time axes:
tmpx_left,tmpx_right, andtmpxxare reward-centered time vectors for cortical imaging, cerebellar imaging, and behavioral acquisition, respectively. - Configuration:
pstores acquisition and processing parameters. rewAlgncontains reward-alignedsigFilt_left_red,sigFilt_right_green,lick,lickrate, andpos. Neural arrays are organized as trials by cells by time points; lick and lick-rate arrays are trials by time points; position is trials by coordinates by time points.
Relationship to the paper
- Figure 1: Trained cross-task behavior, simultaneous L5PT/GrC imaging, longitudinal tracking, and same-task controls.
- Figure 2: Trained VR and Reach activity profiles and low-dimensional population structure. Panels A-J use the paired structures. Panels L-N deliberately use
xlstbl.crosstaskDatand all reliable cells in each individual session rather than restricting dimensionality estimates to longitudinally matched cells. - Figure 3: Trained cross-context generalization in L5PTs versus temporal remapping in GrCs, including continuous-recording communicating-subspace analyses.
- Figure 4: Trained population geometry, trajectory reorientation, cross-task prediction, and behavioral-state decoding.
- Figure 5 and Extended Data Figure 5: comparison of Novice with Trained pairs and the relationship between GrC cross-context decorrelation and dual-task predictive licking. The modeling panels do not come directly from the imaging structures described here.
- Same-task controls: used throughout to establish that L5PT/GrC differences in cross-task remapping are not explained by ordinary cross-day variability or unequal registration quality.
How the main script uses the released fields
- Tracking and counts:
*_cellcount,*_trackedCells, andtrials.trialNumsgenerate Figure 1S, V, W and Extended Data Figure 1C. - Behavior:
trials.pos,trials.lick,trials.lickrate, andtrials.trialTypesgenerate the behavioral panels. Stuck-high lick trials are detected at analysis time fromlick; there is no separate stored validity vector in these public structures. - Single-cell response analyses: the cell-table
*_rewardedand*_reliabvariables generate peak-time, peak-width, reliability, and cross-session correlation analyses. - Single-trial population analyses:
trials.L5PTandtrials.GrCsprovide the rewarded single trials used for PCA, representational-similarity analysis, L5PT-to-GrC prediction, and delay-versus-reward decoding. - Whole-recording coupling:
rawsigs.L5PTandrawsigs.GrCsprovide continuous traces for canonical correlation analysis. - Learning analysis:
learningstageselects Novice versus combined mid/expert recordings, whilelickFC2supplies the per-task predictive licking fraction.
Basic example
% Select one primary Trained VR-Reach pair.
stage = lower([crossTask.learningstage]);
trainedIdx = find(ismember(stage, ["mid", "expert"]));
curd = crossTask(trainedIdx(1));
% Inspect session order and trial counts.
disp(table(curd.dates(:), curd.task(:), curd.ntrials(:), ...
'VariableNames', {'Date','Task','NTrials'}))
% Select one session.
td = curd.trials(1);
% trials x registered cells x reward-aligned time points
size(td.GrCs)
size(td.L5PT)
% registered cells x continuous recording samples
size(curd.rawsigs(1).GrCs)
size(curd.rawsigs(1).L5PT)
% Inspect cell-table variables.
curd.GrCs.Properties.VariableNames
curd.L5PT.Properties.VariableNames
For exact analysis windows, normalization, reliability corrections, dimensionality reduction, decoding, and statistical procedures, refer to the Methods and the code associated with the corresponding figure.
