Figures and data

Mice learn new contingency-dependent movement trajectories after the relocation of targets.
(A) Structure of the delayed-response directional licking task. (B) Single frames from the side and bottom cameras with the history of a tongue tip trajectory indicated by colored markers. (C) Example mouse pre-shift lick trajectories, mouth and lickport locations (Correct Right: blue, N = 539; Correct Left: red, N = 347 trials). Gray manifold is the distance threshold for lick exit angle calculation (D/V: dorsal/ventral; A/P: anterior/posterior; L/R: left/right). (D) Lick exit angles for all pre-shift Correct Right and Correct Left trials in (C). Dotted line denotes the choice boundary (CB). (E) Schematic of the port shift. Note: shifted left port location obstructs old rightward tongue trajectory. (F) Classification of right-cued error trials based on exit angle of the first lick with respect to the CB. (G) Lick exit angles for all post-shift correct trials for mouse in (D) (CR: Correct Right, N = 339; CL: Correct Left, N = 214 trials). (H) Lick exit angles for post-shift error trials from the mouse in (G) (MER: Motor Error Right, N = 87; DER: Decision Error Right, N = 7 trials). (I) Fraction of all right-cued trials that were motor error trials across training epochs (N = 22 pre-shift and N = 20 post-shift mice). (J) Relative lick angle (pre-shift normalized) for all first licks targeting the right port on right-cued trials. Shaded error and error bars: hierarchical bootstrap SEM. Bottom camera images are flipped to align with top-down views. Figure 1—figure supplement 1. Tongue exit angles change after the port shift to avoid the obstructing lickport.

Longitudinal 2P calcium imaging of the tuft dendrites and somata of L5 ET neurons.
(A) L5 ET neuron labeling approach. (B) Image of an example coronal section showing labeled neurons in left ALM cortex (~0.85 mm along the A-P axis). (C) Image of the corpus callosum from a different section (~1.2 mm A-P) of the same mouse as (B) showing the absence of axonal label. (D) Experimental timeline of dendritic and somatic imaging as well as the lickport shift. (E) Pulse splitting approach to obtain extended depth-of-field 2P imaging of L1 dendrites. (F) Mean projections (over a 10 s window) of functional imaging of L1 dendrites and L5 somata (left) along with their respective locations (red lines) in an x-z projection of an anatomical imaging volume (right). (G) Overlay of all L1 dendritic NMF spatial components from one animal (All; top left). Subsequent panels show three individual components. (H) Example denoised single frame from L1 functional imaging (top) and ΔF frame (bottom). Borders correspond to a binarized ROI derived from spatial component (2) in (G). (I) Example timecourses for ROI in (H) at different stages of processing: (i) raw motion-corrected, (ii) denoised (iii) NMF-demixed (iv) deconvolved. Pink dots denote impulse locations after filtering. Lines at the top indicate timing of the right cue (blue), left cue (red), GO cue (green) and the arrow indicates the time of the frame in (H). Ticks at bottom are right (blue) and left (red) licks. (J) Same as (H), but for example L5 functional imaging. (K) Same as (I), but for the soma in (J). Figure 2—figure supplement 1. Optical design of module for extended axial 2P imaging. Figure 2—figure supplement 2. Image registration, denoising, and segmentation pipeline. Figure 2—figure supplement 3. Estimated event kinetics, noise, and impulse rates across longitudinal 2P imaging.

Diverse task-modulated activity in tuft dendrites and somata.
(A) An example dendrite spatial component (cyan) overlaid on mean projection (gray). (B) Trial-aligned activity of the example in (A) for all pre-shift Correct Left (CL; N = 163) and Correct Right (CR; N = 212) trials. Session order identity of trials relative to the session of the lickport shift (session 0) is indicated by dark and light gray bars to the left of the rasters. (C) Mean trial-aligned activity for the dendrite in (A,B) on CR (blue) and CL (red) trials. (D-F) Same as (A-C), but for an example L5 soma (magenta) for all pre-shift Correct Left (CL; N = 282) and Correct Right (CR; N = 359) trials. (G) Mean pre-shift activity of dendrites for CL and CR trial types. ROIs are sorted by response bias and peak timing (left: N = 177 ROIs, N = 20 animals; right: N = 181 ROIs, N = 20 animals; see Methods for sorting details). (H) Same as (G), but for somata (left: N = 221 ROIs, N = 19 animals; right: N = 231 ROIs, N = 20 animals). (I) Mean individual animal pre-shift right (blue) and left (red) lickport contact rates (top) and mean across all animals (bottom panels, N = 21 animals) during dendrite sessions. (J) Same as (I), but for soma sessions (N = 20 animals). Auditory cues are indicated (left: red, right: blue, GO: green). Shaded error: bootstrap SEM.

Tuft activity is less time-locked to action and more sensory-selective.
(A) Illustration of the estimation of GO-associated and contact-associated nonnegative response functions. (B) Mean GO-associated (top) and contact-associated (bottom) components of all dendrites (cyan) and all somata (magenta) relative to activity in the early delay period (see Methods). Contact-associated response functions were realigned to the timing of the GO cue before averaging. The vertical line indicates the start of the GO cue (green). (C) Mean relative activity during the shaded periods in (B). (D) Mean trial-aligned activity traces (pre-shift) for an example dendrite (CL: N = 264; CR: N = 334; IL: N = 15; IR: N = 74 trials). Sample cue (L/R; black) and GO cue (green) times are indicated. (E) Same as (D), but for an example soma (CL: N = 229; CR: N = 236; IL: N = 35; IR: N = 58 trials). (F) Mean normalized selectivity along the Sensory, Choice, and Outcome CDs for dendrites (cyan) and somata (magenta) (see illustrated definitions in Figure 4—figure supplement 1A and Methods). Horizontal line: zero selectivity, left vertical line: sample cue start (L/R; black), right vertical line: GO cue start (green). (G) Mean normalized selectivity for Sensory, Choice, and Outcome during the shaded time periods in (F). (H) Sensory-selectivity to choice-selectivity ratio during the shaded time in (F). (I) Same as (H), but for sensory-selectivity to outcome-selectivity ratio. Error bars: hierarchical bootstrap SEM. Figure 4—figure supplement 1. Mean trial-type projections along Sensory, Choice, and Outcome coding directions

Distinct encoding of corrective action in tuft dendrite activity during motor learning.
(A) Illustration of the classification of right-cued, right-choice trials based on the first lick (top row) and the second lick (middle row). Bottom row shows mean left (red) and right (blue) lickport contact rates aligned to the first lick (FL) contact (vertical dark yellow line) for all animals (N = 14). (B) Mean lick exit angle on CA trials for the first and second licks (N = 20 animals). (C) An example of dendrite activity on CR (N = 295) and CA (N = 94) trials (top) and mean first lick (FL)-aligned activity on CR (blue) and CA (orange) trials (bottom). The recording sessions (shift day 0) are indicated by alternating dark and light gray bars to the left of activity. (D) Mean activity of all recorded dendrites on CR, CA, and AP trial types (N = 261 dendrites, N = 14 animals; see Methods for inclusion criteria). Dendrites are sorted according to CR − CA activity 0 and 1 s after the FL contact cue (see Figure 5—figure supplement 1). Dotted box highlights activity in CA-biased ROIs. (E) Same as (C), but for an example soma (CR: N = 225; CA: N = 109 trials). (F) Same as (D), but for all somata (N = 337 somata, N = 12 animals). The dotted box highlights activity in CR-biased ROIs. (G) Illustration of CR – CA coding direction in activity space. AP activity was independently projected onto the CR − CA CD. (H) Cross-validated projections of dendritic (top panel) and somatic (bottom panel) population activity onto the CR − CA CD for CR, CA, and AP trial types. The vertical line shows the time of first port contact while the horizontal line shows the zero projection. (I) Mean projection weight defined as the average projection normalized by the sum of CR and CA projections during the time denoted by the gray shaded area in (H). Shading and error bars: hierarchical bootstrap SEM. Figure 5—figure supplement 1. Differences in mean trial-aligned CR, CA, and AP activity. Figure 5—figure supplement 2. CR − CA code stability and additional trial-type projections.

Compartmentalized changes in representation and gain across motor skill learning.
(A) An example dendrite on CL trials (N = 163 pre-shift, N = 175 post-shift trials) and CR trials (N = 212 pre-shift, N = 170 post-shift trials) (top) and the trial-aligned mean activity (bottom) during the pre-shift (black) and post-shift training epochs (post-shift CL: red; post-shift CR: blue). Session order identity (session of shift = 0) of the trials is indicated by dark and light gray bars to the left of the rasters. Auditory cue timings indicated. (B) Same as (A), but for an example soma on CL (N = 288 pre-shift, N = 223 post-shift trials) and CR (N = 258 pre-shift, N = 432 post-shift trials) trials. (C) Selectivity index (SI) distributions for task-modulated ROIs (see Methods). Pre-shift (left column) and post-shift (middle column) show SI distributions for dendrites (top) and somata (bottom). Lighter colors are proportion in each bin that were task-modulated in both training epochs, whereas darker colors are the proportion uniquely task-modulated in that training epoch. Post-shift SI distributions (right column) only show ROIs that were task-modulated in both training epochs (red portions: preferred left during pre-shift; blue portions: preferred right during pre-shift). (D) Percent change in the number of task-modulated dendrites and somata across the port shift. (E) Percent change in mean selectivity index ([CR − CL]/[CR + CL]). (F) Percent change in mean responsiveness (CR + CL). (G) Percent change in mean selectivity magnitude (CR − CL). (H) Illustration of the CR − CL CD in activity space. (I) Cross-validated selectivity between CR and CL projections along the CR − CL CD for dendritic (left) and somatic (right) ROIs during the pre-shift (black) and post-shift (colored) training epochs. Vertical lines indicate start of the sample (black) or GO (green) cue. (J) Difference between pre-shift and post-shift selectivity projections. (K) Percent change in selectivity (I) from pre-shift to post-shift, averaged across the whole trial period. Shading and error bars: hierarchical bootstrap SEM. Figure 6—figure supplement 1. Trial-type projections before and after the lickport shift. Figure 6—figure supplement 2. Selectivity CD magnitude across early and late learning. Figure 6—figure supplement 3. Selectivity CD correlations across early and late learning.

Number of animals and ROIs included in each analysis comparing compartments.

Number of sessions by training epoch.

Number of trials by training epoch.

Tongue exit angles change after the port shift to avoid the obstructing lickport.
(A) Empirical probability distributions for pre-shift correct trial types across all animals (pre-shift Correct Right N = 10610; pre-shift Correct Left N = 9302). (B) Distributions of post-shift correct trials (post-shift Correct Right N = 6568; post-shift Correct Left N = 4717). (C) Distributions of pre-shift right error trials (pre-shift Motor Error Right N = 649; pre-shift Decision Error Right N = 1534). The distribution of all pre-shift error exit angles was unimodal (ΔBIC = −28.3, Gaussian mixture model comparison, see Methods for details). (D) Distributions of post-shift right error trials (post-shift Motor Error Right N = 4010; post-shift Decision Error Right N = 754). The distribution of post-shift error exit angles was bimodal (ΔBIC = 675.5).

Optical design of module for extended axial 2P imaging.
A linearly polarized 80 MHz laser pulse train (1) was split into polarization-dependent paths via a polarizing beam splitter (PBS), where a half-wave plate (λ/2) controls the distribution of energy to each path. The S-polarized component incurred a 6.25 ns delay along the Outer Loop with respect to the un-delayed P-polarized component, which was then recombined using the same PBS to form a 160 MHz pulse train with alternating polarization (2). Next, the global polarization of the 160 MHz pulse train was rotated such that the S-polarized components of each orthogonally polarized element of the 160 MHz pulse train incurred a delay of 3.125 ns in propagation along an Inner Loop with respect to the P-polarized components. Pulses were then recombined via a PBS resulting in a 320 MHz pulse train (3). Additionally, the Outer Loop and Inner Loop both contained 1:1 optical relays arranged to impart a variable divergence such that each unique path through the pulse splitter generated a distinct downstream shift in focal plane. Each of these paths were conjugated to the back aperture of the objective lens through a series of optical relays. A home-built single prism pulse compressor was used to compensate the average group delay dispersion of all delay paths and the rest of the microscope.20 μm

Image registration, denoising, and segmentation pipeline.
(A) Schematic representation of the image analysis pipeline including rigid registration, denoising, non-rigid warp correction, and then complete timeline NMF. (B) Mean projection images for four dendrite imaging sessions showing the rigid registration output (top row), denoised output (middle row) and the non-rigid registration output (bottom row). Gray border areas are regions where the data were cropped prior to denoising to eliminate any regions that did not have consistent data throughout the imaging session following the rigid registration. White dotted box indicates the maximum shared region where no data was missing due to registration across all four imaging sessions. (C) Overlay of all four sessions for the corresponding rigid (top), denoised (middle) and non-rigid (bottom) corrected mean projections in (B). (D) Insets for regions in (C) showing that after rigid registration and denoising there are sometimes offsets in the positions of individual dendritic branches that must be corrected with the non-rigid registration. (E) Mean projection image overlay across all recorded sessions for an example dendritic FOV in Figure 2G. (F) Stability of NMF spatial components. Spatial components corresponding to components in Figure 2G, but calculated independently for each behavioral session.

Estimated event kinetics, noise, and impulse rates across longitudinal 2P imaging.
(A) Mean impulse response function (IRF, normalized to peak before averaging) estimated for tuft dendrites (N = 402 dendrites from N = 21 animals) and somata (N = 528 ROIs from N = 20 animals) from fits to an AR(2) model using constrained FOOPSI (Pnevmatikakis et al., 2016). (B) Probability densities for the rise time constant (τ) of the fits. Vertical dotted lines indicate the population median. * indicates p < 0.05 Kolmogorov-Smirnov (K-S) test. (C) Same as (B), but for the decay time constant (τ). (D) Standard deviation of the noise averaged across ROIs of each animal by imaging session for 5 days prior to port shift and 5 days following port shift in dendrites (left) and somata (right). Black line indicates the average noise estimate across all animals. Noise was estimated from high frequencies in the power spectral density of the trace of each ROI (Pnevmatikakis et al., 2016). (E) Same as (D) but for estimated impulse rates after thresholding the deconvolved traces (see Methods). Error bars: ±SEM (not bootstrapped).

Mean trial-type projections along Sensory, Choice, and Outcome coding directions.
(A) Illustration of the calculation of Sensory, Choice, and Outcome coding directions within activity space. For each coding direction, dotted lines indicate trial types that were first summed and the dash-dotted line indicates subsequent subtraction of the results to obtain the CD. (B) Cross-validated projections of trial-averaged activity across Sensory, Choice, and Outcome axes for dendrites. Correct and incorrect trial projections shown in the top and bottom of each panel, respectively. (C) Same as (B), but for all somata. Error bars: hierarchical bootstrap SEM.

Differences in mean trial-aligned CR, CA, and AP activity.
(A) All individual ROI differences in the mean CR minus the mean CA activity (top) or mean CR activity minus mean AP activity (bottom). ROI order is same as in Figure 5D. (B) Same as (A) for somata from Figure 5F.

CR − CA code stability and additional trial-type projections.
(A) Illustration of CR − CA CD calculation (left) and cross-validated correlations of CR − CA CD across trial time relative to first lickport contact (FL; dark yellow line). (B) Illustration of CR−CL CD calculation (top), as well as dendrite (middle) and somata (bottom) normalized cross-validated projections along the CR − CL CD. Projections were normalized by division by |CR| + |CL| in shaded region. (C) Illustration of CR − CA CD calculation (top), as well as dendrite (middle) and somata (bottom) normalized cross-validated projections along the CR − CA CD for additional trial-types. Projections were normalized by division by |CR| + |CL| in shaded region of (B) to allow for direct comparisons of magnitude. Trial-type abbreviations are CR: Correct Right; CL: Correct Left; CA: Correction Attempted; AP: Abandoned Port; CA(RC): Correction Attempted (second lick made Right port Contact); CA(LC): Correction Attempted (second lick made Left port Contact); AP(LC): Abandon Port (second lick made Left port Contact); AP(NC): Abandon Port (second lick did Not make Port contact); DER: Decision Error Right.

Trial-type projections before and after the lickport shift.
(A) Schematic of the CR−CL CD. (B) Cross-validated projections of CR and CL trials along the CR−CL CD. Same data as used for Figure 6I,J. Shaded error: hierarchical bootstrap SEM.

Selectivity CD magnitude across early and late learning.
(A) Illustration of the calculation of the coding magnitude in selectivity space. (B) Coding magnitude of dendrites (left) and somata (right) during pre-shift (black), early post-shift (top row), and late post-shift (bottom row) training epochs. (C) Percent change in coding magnitude from pre-shift to early post-shift averaged within the four time windows indicated by gray rectangles in (B). (D) Same as (C), but from pre-shift to late post-shift. (E) Same as (C) but from early post-shift to late post-shift. Shaded error and error bars: hierarchical bootstrap SEM.

Selectivity CD correlations across early and late learning.
(A) Illustration of correlation (cosine similarity) calculation between CDs in selectivity space. (B) Correlation between CDs calculated from pre-shift activity and CDs calculated from early post-shift activity for dendrites (top left, cyan line) and somata (top right, magenta line), as well as correlation between CDs calculated from pre-shift activity and CDs calculated from late post-shift activity for dendrites (bottom left, cyan line) and somata (bottom right, magenta line). Black lines indicate the estimated maximum possible correlation (“ceiling”) across the training epochs given correlations of repeated measures within each epoch (i.e., the limit due to degradation by measurement noise; see Methods). (C) Ratios between the early post-shift to pre-shift correlations and the correlation ceilings in (B) averaged within the four time windows indicated by gray rectangles in (B). A ratio ≈1 indicates no change in the CD pattern across the training epochs beyond measurement noise, whereas a ratio significantly < 1 indicates significant change across the training epochs in the CD pattern. (D) Same as (C), but for correlation of late post-shift to pre-shift. (E) Same as (C), but for correlation of late post-shift to early post-shift. Shaded error and error bars: hierarchical bootstrap SEM.