DOI: 10.5061/dryad.qnk98sft9
title: A vector calculus for neural computation in the cerebellum

description: Null space theory suggests that neurons often produce spikes not to drive
 behavior, but to nullify other neurons' effects on behavior. What has
 been missing is a direct way to test this idea in the brain. We found that
 in the marmoset cerebellum, each Purkinje cell (P-cell) had a unique
 vector that moved the eyes along a specific direction. Interestingly,
 P-cells fired during all saccades, not just those aligned with their
 vector. Simultaneous recordings showed that spikes in different cells
 combined their vectors, conforming to superposition, creating population
 activity where contributions perpendicular to the intended action were
 present but canceled. Mossy fibers conveyed motor commands and movement
 goals, while interneurons transformed these signals, enabling P-cells to
 collectively signal movement termination. Thus, the cerebellum placed
 neurons in competition, canceling the downstream impact of one cell’s
 spike by another’s, producing a fast-changing output via a population of
 slow neurons.
description: # A vector calculus for neural computation in the cerebellum
 [https://doi.org/10.5061/dryad.qnk98sft9](https://doi.org/10.5061/dryad.qnk98sft9) ## Description of the data and file structure Data and code to generate main and supplementary figures of the manuscript *"A vector calculus for neural computation in the cerebellum"* Mohammad Amin Fakharian, Alden M. Shoup, Paul Hage, Hisham Y. Elseweifi, and Reza Shadmehr Corresponding authors' email: [ma.fakharian@gmail.com](mailto:ma.fakharian@gmail.com), [shadmehr@jhu.edu](mailto:shadmehr@jhu.edu) Laboratory for Computational Motor Control, Dept. of Biomedical Engineering, Johns Hopkins School of Medicine ## Necessary Packages [Boundedline](https://www.mathworks.com/matlabcentral/fileexchange/27485-boundedline-m), [UMAP](https://www.mathworks.com/matlabcentral/fileexchange/71902-uniform-manifold-approximation-and-projection-umap), [gmregress](https://www.mathworks.com/matlabcentral/fileexchange/27918-gmregress), [violinplot](https://github.com/bastibe/Violinplot-Matlab/tree/master), and modified [PolarpColor](https://www.mathworks.com/matlabcentral/fileexchange/49040-pcolor-in-polar-coordinates) to plot polar heatmaps. ## Description of Data and File Structures The provided code loads the dataset and processes it to generate all the main and supplementary figures in the paper. Below is a brief overview of each data file and its contents. --- ### 1. **Figure 1 Data** * **`fig1_waveforms.mat`** Contains waveforms of 18 example P-cells, MLIs, and mossy fibers for Fig. 1C. * `cell_list_name`, `cell_lists`: name and id of the cells * `cells`: waveform information for each cell. Function MAF_plot_waveform plots the waveforms in correct channel position getting each struct variable as input. The structs include these variables: * `ch_map`: channel map of the probe (positions `x`,`y`(micro-meter) of each channel and the mapping in variable `map`). * `ss_wave`(mV), `cs_wave`(mV): simple and complex spike (SS and CS) average waveform, 32 channels x 82 time samples (30KHz sampling rate). * `ss_wave_ch`,`cs_wave_ch`: corresponding channel numbers for 32 waveforms in `ss_wave` and `cs_wave`. * **`fig1_sample_adj_mat.mat`** Contains corrected cross-correlogram interactions for a sample session in Fig. 1D. * `cell_names`, `cell_types`: Corresponding cell names and types * `cell_cliques`: Clique ID for each cell * `Adj`: Adjacency matrix (corrected cross-correlograms in Hz) * `Adj_xline`: x positions of dividing the cliques on adjacency matrix. * **`fig1_clique_interactions.mat`** Contains categorized pairwise interactions by cell types. * `bet_inter`(Hz) and `wit_inter`(Hz): 10x1 cell arrays for between- and within-clique interactions (Hz) across various cell type pairs (SS-SS, MLI-MLI, MLI2-MLI2, CS-CS, SS-MLI, SS-MLI2, MLI-MLI2, MLI-CS, MLI2-CS, SS-CS respectively). Each cell is number of pairs x time delays of cross-correlogram (-50:50 milliseconds). * `bet_inter_ids`, `wit_inter_ids`: Corresponding cell IDs --- ### 2. **Figure 2 Data** * **`fig2_cs_on_data.mat`** Contains von Mises fits to 520 complex spikes across visual and motor phases (see Methods). * `cs_cell_ids`: cell names * `cs_rate`(Hz), `cs_vm`(deg/sec): 4D matrices of 520 cells × 500 timepoints (-249:250ms) × 8 directions × 2 conditions (visual cue onset & saccade onset) * `cs_on_data` von Mises fit results for each cell for visual (`vis` 40:85ms from cue onset), and motor period (`sac` -70:30ms from saccade onset). Each of these structs have the following variables: * `fr_avg`(Hz): average firing rate to each direction. 8 directions aligned to preferred direction x 1 array. * `ang_avg`(deg): preferred direction of the cell. * `rho_avg`(normalized): sharpness of tuning of each cell. * **`fig2BtoE_S7.mat`** Includes cell-specific kinematic and electrophysiological data to generate figure 2 SS pause followed by CS perturbation results: * `cell_ids`**: **corresponding id for each cell represented in these figures. * `cs_data_one_lite`: all information for each cell pertinent to these figures with trials concatenated across recordings, 1x520-cells with 6 fields. * `neural_data_dir`: all electrophysiological and kinematic data concatenated across recordings and binned by direction. * `SS`: SS raster aligned to saccade onset (-249:250ms) x number of successful primary saccades, logical. * `CS`: CS raster aligned to saccade onset (-249:250ms) x number of successful primary saccades, logical. * `eye_vx`(deg/sec): horizontal eye velocity aligned to deceleration onset (-49:50ms) x number of successful primary saccades. * `eye_vy`(deg/sec): vertical eye velocity aligned to deceleration onset (-49:50ms) x number of successful primary saccades. * `eye_vm_onset`(deg/sec): eye velocity magnitude aligned to saccade onset (-249:250ms) x number of successful primary saccades. * `sac`: kinematic and electrophysiologic information for each saccade used to remove outlier saccades, each variable size is 1 x number of successful primary saccades * `has_cs`: logical indicating whether the CS of this cell was present in the recording containing a given saccade/trial. * `has_ss`: logical indicating whether the SS of this cell was present in the recording containing a given saccade/trial. * `eye_amp`(deg): amplitude of each saccade. * `eye_vm_max`(deg/sec): maximum velocity of each saccade. * `time_offset`(sec): time of saccade offset wrt start of recording for each saccade. * `time_vmax`(sec): time of onset of deceleration wrt start of recording for each saccade. * `time_onset`(sec): time of saccade onset wrt start of recording for each saccade. * `eye_px_onset`(deg), `eye_py_onset`(deg): horizontal and vertical position of eye at saccade-start wrt to fixation cue for each saccade, respectively. * `eye_px_offset`(deg), `eye_py_offset`(deg): horizontal and vertical position of eye at saccade-end wrt to fixation cue for each saccade, respectively. * `CS_ang`(rad): preferred direction for each cell. * `vis` * `rho_avg`(normalized): sharpness of tuning for given cell wrt to onset of visual cue (40:85ms from cue onset). * `sac` * `rho_avg`(normalized): sharpness of tuning for given cell wrt to onset of saccade (-70:30ms from saccade onset). * `reaction_time`(sec): 1 x number of successful primary saccades containing the time from saccade onset (sec) to visual cue onset (sec). * `sess_cumu`: session number that given cell was recorded. * `cs_data_two_lite`: All information for each cell pertinent to simultaneous CS figures, with trials binned by recordings. 1x520-cells with 6 fields. * `neural_data_dir`: All electrophysiological and kinematic data binned by recording and then by direction. * `SS`, `CS`, `eye_vx`(deg/sec), `eye_vy`(deg/sec): same as for corresponding variable names in cs_data_one_lite * `eye_pxi`(deg): same as `eye_px_onset` in cs_data_one_lite. * `eye_pyi`(deg): same as `eye_py_onset` in cs_data_one_lite. * `eye_pxf`(deg): same as `eye_px_offset` in cs_data_one_lite. * `eye_pyf`(deg): same as `eye_py_offset` in cs_data_one_lite. * `rxn_time`(sec): time from saccade onset (sec) to visual cue onset (sec). * `sac`: kinematic and electrophysiologic information for each trial used to remove outlier saccades, each variable size is 1 x number of successful primary saccades. * `has_cs`, `has_ss`, `eye_amp`(deg), `time_onset`(sec), `time_offset`(sec), `time_vmax`(sec), `eye_vm_max`(deg/sec): same as for corresponding variable names in cs_data_one_lite. * `vis_ang`(deg): location of target wrt to fixation point. * `eye_ang`(deg): location of eye at saccade end wrt to fixation point. * `CS_ang`(rad): preferred direction for each cell. * `vis_rho`(normalized): sharpness of tuning for given cell wrt to onset of visual cue. * `sac_rho`(normalized): sharpness of tuning for given cell wrt to onset of saccade. * `rec_flag`: 1 x number of recordings in session, logical indicating whether the CS of the given cell was recorded during a recording. * `sess_cumu`: session number that given cell was recorded. * `ind_bursters`, `ind_pausers`: burster/pauser indices amongst the prior three variables. * `pert_` a variable storing the number of successful primary saccades per recording (field 2) and total number across all recordings (field 3) per session. Additionally, data used to filter out outlier saccades `sac_crit_ms `= field 4, `sac_crit_ma `= field 1. `sac_crit_ms` and `sac_crit_ma` have the gaussian binomial fit to main-sequence (log(amplitude)-log(velocity)) and log(amptlitude)-log(deceleration to acceleration duration ratio) plots. We used these fits to filter outlier false positive saccades detected by the UNEYE method (deep neural network to detect saccades, see methods section). --- ### 3. **Figure 3 Data** * **`fig3_burst_pause_ind.mat`** UMAP + k-means clustering results for simple spike (SS) burster/pauser classification. * Variables: `ind_b`, `ind_p`: bursters and pausers logical flags respectively. * **`fig3_SS_population_clique.mat`** SS population activity aligned to reward-relevant saccade max velocity. * `data.rate_tot_sac`(Hz), `data.vm_tot_sac`(deg/sec): Average SS rate and corresponding saccade velocity magnitude, cells × time aligned to deceleration onset (-249:250ms) × directions aligned to cliques' potent direction * `data.cs_on_ang_tot`(deg), `data.cs_on_rho_tot`(normalized): Clique's potent direction and amplitude * `data.cell_ids_tot`, cell names based on the date of recording and channel number. * `data.cliques` Assigned cliques to each cell within a session. * **`fig3_MLI_population_clique.mat`** Same structure as above, for MLI1 cells. * **`fig3_MLI2_population_clique.mat`** Same structure as above, for MLI2 cells. --- ### 4. **Figure 4 Data** * **`fig4_SS_population_clique_amp_vel.mat`** Extension of Fig. 3 SS data, binned by amplitude, velocity, and acceleration duration. * `data.rate_tot_sac_amp`(Hz), `data.vm_tot_sac_amp`(deg/sec): 5D array: cells × time aligned to deceleration onset (-249:250ms) × directions aligned to cliques' potent direction × amplitude bins × reward condition * `data.rate_tot_sac_vel`(Hz), `data.vm_tot_sac_vel`(deg/sec): 5D array: cells × time aligned to deceleration onset (-249:250ms) × directions aligned to cliques' potent direction × velocity bins × reward condition * `data.rate_tot_sac_acc_time`(Hz), `data.vm_tot_sac_acc_time`(deg/sec): 5D array: cells × time aligned to deceleration onset (-249:250ms) × directions aligned to cliques' potent direction × acceleration duration bins × reward condition * `data.cs_on_ang_tot`(deg): Clique's potent direction and amplitude for each cell. * `data.cell_ids_tot`: cell names based on the date of recording and channel number. * `data.cliques`: Assigned cliques to each cell within a session. * **`fig4_MLI_population_clique_amp_vel.mat`** Same structure as above, for MLI1 cells. * **`fig4_MLI2_population_clique_amp_vel.mat`** Same structure as above, for MLI2 cells. * **`fig4_MF_dataset_types.mat`** Mossy fiber (MF) data, including visual and motor tuning: * `data_out.BG`, `data_out.GL`: Info for state (velocity) and goal mossy fibers * `cell_ids`, cell names based on the date of recording and channel number. * `pref_ang`(radians): preferred angle of the cells. * `delay`(ms): delay response of the cell (peak rate time minus peak velocity of the eye). * `rate_vis`(Hz): response to cue onset (-249:250ms) aligned to reward relevant cue onset time. * `tgt` and `spnt`: tuning curves and rates aligned to peak velocity time of saccade for reward relevant and irrelevant saccades. * `rate_sample`(Hz), rate of cells aligned to deceleration onset for saccades with similar peak velocities (150-250deg/sec), figure 4A, right. Array of number of cells x number of time points (-249:250ms). * `rate_plr`(Hz), rate of the cells binned by amplitude and direction (angles x cells x amplitude). * `dir_tune`(normalized), normalized rate of each cell for different directions (`ang_span` variable contains the corresponding angles in radians). * `amp_tune`(normalized), normalized rate of each cell for different amplitude (`amp_span` variable contains the corresponding angles in degrees). * `spk_amp`(count), number of spikes during saccade (-50:110ms + cell response delay around saccade onset) for different amplitudes of saccade (`amp_span_lin` variable in degrees). * `acc_time`, `vel`, `amp`: 4D matrices of average rate (Hz) and velocity (deg/sec) binned by each kinematic variable: cells x time samples aligned to peak velocity (-249:250ms) x 8 directions (aligned to mossy fiber preferred direction) x number of behavior bins. * `data_out.BGGL`: UMAP+kmeans coordinates and labels for separating state (velocity) and goal mossy fibers (Fig S13G) * `red_dim`: UMAP coordinates. * `clust`: clustering ids. * `data_out.fix`: Info for state (position) mossy fibers * `cell_ids`, cell names based on the date of recording and channel number. * `rate_rot`(Hz): average rate for 78 state (position) neurons across interpolated directions bins x amplitudes bins. * `pref_ang`(radians): preferred angle for 78 state (position) neurons. * `data_out.bl` * `cell_ids`, cell names based on the date of recording and channel number. * `rate`(Hz): average rate of mossy fibers with high baseline rate. cells x time aligned to deceleration onset (variable `time` -240:240ms) x directions (aligned to preferred direction). --- ### 5. **Supplementary Figures Data** * **`figS3_neural_prop_clique.mat`** Electrophysiology properties of 1428 recorded simple and complex spikes and molecular layer interneurons 1 and 2. * `acorr_tot_ss`(Hz): autocorrelogram of simple spikes and MLIs, number of cells x time delays (-50:50milliseconds) * `acorr_tot_cs`(Hz): autocorrelogram of complex spikes, number of cells x time delays (-500:5:500milliseconds) * `xcorr_tot`(Hz): SS-CS cross correlogram, number of cells x time delays (-50:50milliseconds) * `rate_bl_ss`(Hz): simple spikes and MLIs baseline rates, number of cells x 1 * `rate_bl_cs`(Hz): complex spikes baseline rates, number of cells x 1 * `wave_tot_ss`(normalized): interpolated spatio-temporal waveforms for simple spikes and MLIs, number of cells x flattened 2D waveform (7500 = 150 distance between channels (micro-meter) x 50 time samples (sampling rate: 30KHz)). * `wave_tot_cs`(normalized): interpolated spatio-temporal waveforms for complex spikes, number of cells x flattened 2D waveform (7500 = 150 distance between channels (micro-meter) x 50 time samples (sampling rate: 30KHz)). * **`figS4_behav.mat`** Saccade kinematics and parameters for all sessions and animals. Each variable is a 2x1 cell array (Monkey C, Monkey B) * `sess_id`: session ids * `sac_amp`(degree): saccade amplitude. * `sac_vel`(degree/sec): saccade peak velocity. * `sac_tag`(degree/sec): tags 1, 4, 6, and 7 are reward relevant (1.primary, 4.secondary, 6 and 7. center saccades) and tag 10 is reward irrelevant. Tag 2 and 3 are unsuccessful primary saccades and tag 5 is unsuccessful secondary saccades. * `sac_ang`(degree): saccade direction angle. * `sac_acc_dur`(milliseconds): saccade acceleration duration. * `sac_dec_dur`(milliseconds): saccade deceleration duration. * **`figS5_CS_population_clique.mat`** Activity of 154 complex spikes from complete P-cell recorded units (with both SS and CS). * `rate_tot_sac`(Hz), `vm_tot_sac`(deg/sec): 4D arrays like in **`fig2_cs_on_data.mat`** (cell x time x direction aligned to cliques' potent direction x condition: visual and motor) * `cs_on_ang_tot`(deg), `cs_on_rho_tot`(normalized): Clique's potent direction and amplitude * `cell_ids_tot`, cell names based on the date of recording and channel number. * `cliques` Assigned cliques to each cell within a session. - **`figS10_neural_prop_MF.mat`** Electrophysiology properties of 1931 recorded granular layer interneurons and mossy fibers. * `cell_types`,`cell_ids`: Corresponding cell types and names * `acorr_tot`(Hz): autocorrelogram of each cell, number of cells x time delays (-50:50milliseconds) * `rate_bl`(Hz): baseline rates, number of cells x 1 * `wave_tot`(normalized): interpolated spatio-temporal waveforms, number of cells x flattened 2D waveform (7500 = 150 distance between channels (micro-meter) x 50 time samples (sampling rate: 30KHz)). * **`figS13_MF_state_position.mat`** MF state (position) rates for saccades followed by fixation, grouped by fixation edge * `rate_offset`(Hz), `rate_onset`(Hz), `vel_offset`(deg/sec), `vel_onset`(deg/sec): rates and velocities for center out and back to center saccades followed by successful fixation aligned to saccade onset. data structure is for 78 mossy fibers x 4 position bins (edges in `edges` variable) x 600 time points in `time` variable (milliseconds). * `edges`(deg): Fixation position edges * `onset` and `offset` folders: data to generate figure S19. `offset` folder has the same variables ending with `_offset.mat` with same data structure. * **`SS_population_clique_onset.mat`** Same structure as **`fig3_SS_population_clique.mat`**, aligned to saccade onset. * **`MLI_population_clique_onset.mat`** Same structure as above, for MLI1 cells. * **`MLI2_population_clique_onset.mat`** Same structure as above, for MLI2 cells. * **`SS_population_clique_amp_vel_onset.mat`** Same structure as **`fig4_SS_population_clique_amp_vel.mat`**, aligned to saccade onset. * **`MLI_population_clique_amp_vel_onset.mat`** Same structure as above, for MLI1 cells. * **`MLI2_population_clique_amp_vel_onset.mat`** Same structure as above, for MLI2 cells.