Skip to content

Peri-Event Analysis Workflow

Compute Credits

This tool uses 1.0 compute credits per hour.

Overview

Peri-event analysis extracts and quantifies how average neural signals vary around (peri) a time window of event timestamps. Specifically, this analysis computes how the overall population neural activity changes across event occurrences as well as each individual neuron, classifying them into up-modulated, down-modulated, or non-modulated sub-populations. By performing circular shifts of the event times randomly and testing modulation with a non-parametric approach, this method makes few assumptions about the underlying distributions of neural activity or events.

Peri-event analysis is a broadly applicable workflow, and has been extensively used in the field of systems neuroscience for the analysis of signals at the sensory1 2, cognitive3 4 5 6 and motor research7 8 9.

Input Data

IDEAS users currently have the option of running the peri-event analysis workflow on their dataset. In order to do so, the user needs to have a Cellset and a corresponding Events file. The Cellset input contains time series traces for each cell in the field-of-view of the recording along with the corresponding footprints. An Events file contains information about when events occurred. Note that each event in this context refers to a single time event point. Event files supported by this tool can be generated using Convert CSV File to Events or Detect GPIO Events.

Input Data Required
Cell Set Yes
Input Events Yes

This workflow needs two files as input:

Input Data Description
Cell Set ISXD Cell Set containing traces and footprints
Input Events See below

Inputs and Parameters

Parameter Required? Default Description
Input cell sets True N/A Select cell sets to use for analysis
Input events True N/A Select event data to use for analysis
Event type True N/A Select type of event to analyze from the column names of the event file
Visual window (pre) True -2 Time in seconds to visualize before each event in output figures (not used for statistics)
Visual window (post) True 2 Time in seconds to visualize after each event in output graphs (not used for statistics)
Statistical window (pre, start) True -1 Start of time window in seconds before each event to use for statistical tests
Statistical window (pre, end) True 0 End of time window in seconds before each event to use for statistical tests
Statistical window (post, start) True 0 Start of time window in seconds after each event to use for statistical tests
Statistical window (post, end) True 1 End of time window in seconds after each event to use for statistical tests
Number of random shuffles True 1000 Number of random shuffles of event times to perform for constructing null distribution
Significance threshold True 0.05 p-value threshold for classifying neurons as up- or down-modulated
Seed True 0 Seed for the random generator used to shuffle event indices

Tip

  1. To quickly view and navigate between parameters, select the ‘Jump to Parameter’ button at the bottom of the page.

  2. Hover the mouse over the column name to get a short description of the parameter.

Algorithm Description

The workflow is summarized using a flowchart below.

graph TD A[Run peri-event analysis workflow] --> B[Peri-event for each event type]; B[Peri-event for each event type] --> C[Z-score activity for each neuron]; C[Z-score activity for each neuron] --> D[Peri-event for average neural activity across neurons]; C[Z-score activity for each neuron] --> E[Peri-event for single cells]; D[Peri-event for average neural activity across neurons] --> F[Randomization test to test whether post-pre is significant]; F[Randomization test to test whether post-pre is significant] --> G[Store output data]; E[Peri-event for single cells] --> H[Randomization test to test whether post-pre is significant]; H[Randomization test to test whether post-pre is significant] --> I[Classification of up-, down- and non-modulated neurons]; I[Classification of up-, down- and non-modulated neurons] --> J[Event aligned traces heatmap]; J[Event aligned traces heatmap] --> K[Cellmap identifying spatial locations of up-, down- and non-modulated neurons]; K[Cellmap identifying spatial locations of up-, down- and non-modulated neurons] --> L[Store output data];

The workflow begins by taking few parameters as inputs, and processes the output for multiple event types by running them independently for each event. These parameters broadly are related to visualization and testing the statistical significance of the post minus pre event activity. More details can be found in the table in next section.

For each event type, the neural activity is first z-scored (performed individually for each neuron), and then the peri-event activity is computed at two levels: population level and single-cell level. This idea has been represented as different branches in the above flowchart. It does not in any way highlight that these two aspects are happening in parallel in the code; rather it signifies the complementary aspects of the analysis.

At both population and single cell level, the statistical significance of the post minus pre event activity is performed using a randomization test. The post activity is a scalar and refers to the average of the activity in the post event statistical time window. Similar is the concept for the pre-activity.

In the randomization test, a null distribution is created by circularly permuting the event time series relative to the neural time series, and then computing the post- minus pre-event activity. This process is repeated a number of times based on the user input. Creating a null distribution this way has the advantage that it is data-driven, i.e., the distribution is generated from the data rather assuming an analytical distribution of the data. Next, the actual post minus pre activity is compared to the null distribution at a significance level specified by the user using a two-tailed non-parametric test. In this test, the pre- minus post-activity is compared to the 2.5\(^{th}\) and 97.5\(^{th}\) percentile value of the null distribution. A modulated is labeled as down-modulated if this value is less than the 2.5\(^{th}\) percentile and up-modulated if this value is greater than the 97.5\(^{th}\) percentile value.

At the single cell level, the cells are further classified as down-modulated, up-modulated and non-modulated. Cells that have post-event activity significantly higher than the pre-event activity are the up-modulated neurons. Cells that have post-event activity significantly lower than the pre-event activity are the down-modulated neurons. The remaining cells are classified as non-modulated neurons. The peri-event activity of all these neurons in the form of a heatmap, and the peri-event activity and the spatial locations of the 3 classes of neurons provided as outputs to the user.

Output figures

After the user has settled on the desired parameters and clicks “run” in the pop-up window, the workflow starts executing. IDEAS offers a preview of the executed workflow in the form of 4 figures.

Panel A: Event-Aligned single cell activity heatmap

This plot shows the z-scored neural modulation around an event for each neuron in the field of view around an event (red vertical line). Data has been color coded using the viridis color map. Warmer colors represent higher activity and cooler colors represent lower activity. The cells are sorted based on the modulation; cells are top are up-modulated whereas cells at the bottom of the plot are down-modulated. This plot captures the heterogeneity of signal which is difficult to deduce just from the analysis of pooled neural signal.

**Panel B: Event-Aligned population activity **

This plot provides information about the average z-scored neural modulation (Note that neural signal has been averaged across the neurons in the field of field) around an event (red vertical line). The peri-event neural activity is shown in blue. The blue line represents the mean signal and the shaded light blue region represents the standard error of mean (SEM). The two black lines represent the upper and lower of the confidence interval obtained from the randomization test using shuffling, and is dictated by the ‘significance threshold’ parameter. In this particular example, the top and bottom lines represent the 97.5\(^{th}\) and 2.5\(^{th}\) percentile value of the null distribution.

Panel C: Event-Aligned activity by modulation group

Neurons are classified into three categories: down-modulated, up-modulated and non-modulated based on statistical significance of neural signal before and after an event. This plot shows the averaged signal for each of these classes of neurons. The bold line represents the mean and shaded region around the bold lines represent the SEM.

Panel D: Cell map

This plots provides the spatial locations of the centroids of each cell within the FOV. The color codes represent the category a cell belongs to. Blue disks are the down-modulated neurons, green disks are the up-modulated neurons and gray disks are the non-modulated neurons.

Output Data

For each event type, a total of 6 output files are produced. These output files can broadly fall into either one of the two categories: files containing actual data and files containing information for a preview. The (4) files containing the preview information have already been described in section Output preview The output files from the peri-event analysis workflow along with examples are described in detail below:

event_aligned_activity.STATISTICS.csv

A csv file containing the information about the output of statistical tests performed on each cell and some its associated metrics.

event_aligned_activity.TRACES.csv

A csv file containing the information about the event aligned activity of all cells.


  1. Baylor, DuA, B. J. Nunn, and J. L. Schnapf. "Spectral sensitivity of cones of the monkey Macaca fascicularis." The Journal of Physiology 390, no. 1 (1987): 145-160. 

  2. Turner, Maxwell H., and Fred Rieke. "Synaptic rectification controls nonlinear spatial integration of natural visual inputs." Neuron 90, no. 6 (2016): 1257-1271. 

  3. Krumin, Michael, Julie J. Lee, Kenneth D. Harris, and Matteo Carandini. "Decision and navigation in mouse parietal cortex." Elife 7 (2018): e42583. 

  4. Erlich, Jeffrey C., Bingni W. Brunton, Chunyu A. Duan, Timothy D. Hanks, and Carlos D. Brody. "Distinct effects of prefrontal and parietal cortex inactivations on an accumulation of evidence task in the rat." Elife 4 (2015): e05457. 

  5. Zolin, Aryeh, Raphael Cohn, Rich Pang, Andrew F. Siliciano, Adrienne L. Fairhall, and Vanessa Ruta. "Context-dependent representations of movement in Drosophila dopaminergic reinforcement pathways." Nature neuroscience 24, no. 11 (2021): 1555-1566. 

  6. Roitman, Jamie D., and Michael N. Shadlen. "Response of neurons in the lateral intraparietal area during a combined visual discrimination reaction time task." Journal of neuroscience 22, no. 21 (2002): 9475-9489. 

  7. Fink, Andrew JP, Katherine R. Croce, Z. Josh Huang, L. F. Abbott, Thomas M. Jessell, and Eiman Azim. "Presynaptic inhibition of spinal sensory feedback ensures smooth movement." Nature 509, no. 7498 (2014): 43-48. 

  8. Mamiya, Akira, Pralaksha Gurung, and John C. Tuthill. "Neural coding of leg proprioception in Drosophila." Neuron 100, no. 3 (2018): 636-650. 

  9. Marshall, N.J., Glaser, J.I., Trautmann, E.M. et al. Flexible neural control of motor units. Nat Neurosci 25, 1492–1504 (2022). https://doi.org/10.1038/s41593-022-01165-8