Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2025 Jan 1.
Published in final edited form as: J Neurosci Methods. 2023 Oct 30;401:110000. doi: 10.1016/j.jneumeth.2023.110000

Introducing the STReaC (Spike Train Response Classification) toolbox

John E Parker a,b,*, Asier Aristieta b,c, Aryn Gittis b,c, Jonathan E Rubin a,b,**
PMCID: PMC10936710  NIHMSID: NIHMS1943032  PMID: 38486714

Abstract

Background:

This work presents a toolbox that implements methodology for automated classification of diverse neural responses to optogenetic stimulation or other changes in conditions, based on spike train recordings.

New Method:

The toolbox implements what we call the Spike Train Response Classification algorithm (STReaC), which compares measurements of activity during a baseline period with analogous measurements during a subsequent period to identify various responses that might result from an event such as introduction of a sustained stimulus. The analyzed response types span a variety of patterns involving distinct time courses of increased firing, or excitation, decreased firing, or inhibition, or combinations of these. Excitation (inhibition) is identified from a comparative analysis of the spike density function (interspike interval function) for the baseline period relative to the corresponding function for the response period.

Results:

The STReaC algorithm as implemented in this toolbox provides a user-friendly, tunable, objective methodology that can detect a variety of neuronal response types and associated subtleties. We demonstrate this with single-unit neural recordings of rodent substantia nigra pars reticulata (SNr) during optogenetic stimulation of the globus pallidus externa (GPe).

Comparison with existing methods:

In several examples, we illustrate how the toolbox classifies responses in situations in which traditional methods (spike counting and visual inspection) either fail to detect a response or provide a false positive.

Conclusions:

The STReaC toolbox provides a simple, efficient approach for classifying spike trains into a variety of response types defined relative to a period of baseline spiking.

Keywords: Spike Density Function, Interspike Interval Function, Spike Train, Optogenetics, Substantia Nigra, Globus Pallidus

1. Introduction

Spike train recordings represent a central form of data in neuroscience. A fundamental data analysis goal is to compare spike trains across two or more conditions, such as under different levels of subject arousal, different task performance scenarios, or before versus during the application of a stimulation current or other form of direct modulation. On the surface, making such a comparison seems straightforward and indeed, initial approaches based on simply checking for increases or decreases in overall firing rate can be helpful in some situations. As many researchers recognize, however, many nuances can arise that may complicate this analysis. In this work, we present a toolbox that we have recently coded and are releasing for public use, which can be used to easily implement what we call the Spike Train Response Classification (STReaC) algorithm. This algorithm provides an automated sorting of spike train responses or changes across conditions into a broad set of discrete response classes based on simple but carefully developed, easily adjustable criteria. We hope that the code for this algorithm will represent an easy-to-understand, easy-to-use tool that can readily be adopted to help standardize the analysis of activity changes in spike trains.

There have been many methodological and computational works relating to other, often more complicated, forms of spike train analysis. The goals of some of these works have included measuring spike train entropy and computing information transfer between pre- and post-synaptic units, as reflected in their spike trains (e.g. Borst and Theunissen (1999); Strong, Koberle, de Ruyter van Steveninck and Bialek (1998)); developing metrics to measure the distance between two spike trains in various ways, in order to quantify their level of similarity (Victor, 2005); and prediction of subsequent spiking based on spike train analysis (Aljadeff, Lansdell, Fairhall and Kleinfeld, 2016). The topics of neuronal encoding of stimulus information within spike trains and, inversely, decoding stimulus information within receptive fields from given spike trains are fundamental to neuroscience and hence feature significantly in classic textbooks and subsequent work (e.g., Dayan and Abbott (2001); Nirenberg and Latham (2003); Meyer, Williamson, Linden and Sahani (2017); Parida, Bharadwaj and Heinz (2021), including the development of computational tools to automate information-theoretic spike train analysis (Goldberg, Victor, Gardner and Gardner, 2009). The toolbox and associated STReaC algorithm that we present focus not on information or encoding but rather on responses to changes in conditions that are reflected in spike trains, related to traditional concepts of excitation and inhibition. The approach implemented in the toolbox is relatively straightforward and builds on the idea of computing the likelihood of certain changes in spike trains based on baseline distributions of spike train properties, which some of us used in a recent paper (Phillips, Rosner, Gittis and Rubin, 2020) and which can in a general sense be viewed as standard in the field; a contribution of this work is that we overcome certain common pitfalls associated with basing judgements about responses on the direct evaluation of firing rates.

For example, detection of increases in firing rates may be biased toward identification of spike trains in which rates are initially low, and similarly, decreases in firing can be difficult to resolve in spike trains that have low rates during the baseline period. Moreover, spike train firing rates can drift within samples, leading to complications with using methods based only on firing rates without considering spike patterns. Responses of the same neuron to the same stimulus or other change in conditions may vary significantly across repeated trials, and care must be taken in deriving an overall response type in such situations. STReaC has been designed to address these complications, in an easy-to-use and easy-to-understand way. Indeed, the power of STReaC does not lie in the use of sophisticated theory or calculations, but rather in its combination of simplicity, flexibility, and broad applicability.

The first steps of STReaC are the construction of a spike density function (SDF) and an interspike interval function (ISIF) for each baseline and comparison period in each trial. The algorithm uses SDFs to detect increases in firing and ISIFs to detect decreases (cf. Schwab, Kase, Zimnik, Rosenbaum, Codianni, Rubin and Turner (2020)), both based not on direct counting but on computing binned areas under the respective curves. The analysis of spike train responses makes use of comparisons to a baseline area distribution, to identify bins arising during response periods with areas that would be outliers in the baseline case; such a comparison can be made at the trial level or across multiple trials, in which case a baseline distribution is formed by aggregating baseline data across trials.

The layout of the rest of this paper is as follows. Section 2 discusses the STReaC algorithm in detail, starting with the structure of the data, construction of the SDF and ISIF, and how to find periods of excitation and inhibition, while providing illustrations based on the data set used to generate the examples presented later in the paper. Section 3 provides an overview and a few key details of how to use the STReaC toolbox. In Section 4, we show example results from applying STReaC to analyze a data set collected when optogenetic stimulation of rodent globus pallidus externa (GPe) was implemented in parallel with single unit recording in the substantia nigra pars reticulata (SNr), which is one of the GPe’s synaptic targets. We also discuss certain borderline cases to demonstrate that STReaC sorts responses appropriately when the average firing rate misrepresents the response. Section 5 concludes the paper with a discussion that addresses extensibility and limitations of the toolbox and the algorithm that it implements.

2. Methods

This paper illustrates the use of a toolbox that we have developed to allow for automated quantification of how neuronal spike trains recorded during some response or comparison period relate to those from a baseline period. The toolbox implements an algorithm that we have developed for this task, which we call the STReaC algorithm and which we also introduce in this paper. STReaC uses a fairly straightforward approach based on spike density functions and interspike interval functions to perform this task. A natural application of this toolbox and algorithm, which motivated this work, is a scenario in which a baseline recording is made and then optogenetic stimulation is applied to the cell bodies of the neurons presynaptic to the recording site, with spiking recorded during the subsequent response period. The algorithm would apply equally well, however, to any setting in which spike trains across two epochs are to be compared.

We will define the duration of the response period as ts time units and the duration of the baseline period as tb time units. For our exposition, we assume that recordings are made over T trials, each with a baseline and response period of durations tb and ts respectively, for some natural number T. For each recorded neuron, we will discuss T+1 responses: one for each trial and an overall average response.

The STReaC algorithm has been coded in Python, with the intention of easy implementation on a broad range of computing systems. In the remainder of this section, we will present the details of STReaC. In Section 3, we will present more information on the use of the toolbox and the source code.

2.1. Structure of the Data

The STReaC implementation assumes that the data is structured such that information for each neuron is stored in three corresponding files: a file with spike times, a file with stimulus onset times, and a file with metadata.

The first file contains the times of all recorded spikes. These should certainly include the periods intended for analysis but may also include other periods. If the experiment being analyzed involves multiple trials, the spike timing should be counted sequentially, so that there is no overlap between the times involved in periods of interest. The second file contains one reference time for each trial. These times relate to when the baseline period ends and when the response period begins, as will be described in detail below. The third file, which is optional, contains metadata about the experimental conditions associated with the other data, which does not contribute to the algorithm itself and is only used in the post-processing stage in which the algorithm generates an output file. See Section 3 for more details.

Each trial has a baseline period and a response period, both defined relative to a reference time provided in the second file described above. For convenience, suppose that a reference time for a trial is t=0. The baseline period for a trial is defined to occur during a time window before time 0 and the stimulus period for a trial is defined to occur during a window after time 0. When STReaC is called, various parameters associated with the algorithm are supplied (see Section 3 for details). The baseline period is defined by two of these parameters, tb,tb0. The parameter tb represents how much time before 0 the baseline period should begin, while tb denotes the length of the baseline period; specifically, the baseline period extends from time tb seconds to time tb+tb seconds. Similarly, the third parameter, tr0, is the start time of the response period, while the fourth, tr>0, is the duration of the response period, which correspondingly ends at time tr+tr. Typically we choose tbtb such that tb+tb<0, to avoid overlap between baseline and response periods, but that constraint is not necessary for the program to run. If the reference time is t0, then the baseline period comprises t0tb,t0tb+tb and the response period t0+tr,t0+tr+tr.

We reiterate that the STReaC algorithm simply provides a quantitative comparison between spike trains collected during different specified time periods. Through appropriate specification of the parameters associated with baseline and response times, any two spike trains can be compared to each other.

2.2. SDF and ISIF Construction

For each trial, there is a set of spikes corresponding to the baseline period and another to the response period. Let nb be the number of spikes in the baseline period and bi be the set of spike times in the baseline period, where i=1,,nb. Similarly, let nr be the number of spikes in the response period and ri be the set of spike times in the response period, where i=1,,nr. Each of the SDF and ISIF will be formed by defining a continuous function over some period of time that we will call tθ, with subsequent discretization with a default step size of 1 ms. Section 2.2.1 and Section 2.2.2 will describe the construction of these functions, respectively; since this process is identical over the baseline and response periods, in these sections we will simply refer to a set of n spikes with corresponding spike times θ=θi with i=1,,n.

2.2.1. SDF

The construction of the SDF maps discrete spike times to a continuous function, to be discretized for computational purposes, based on standard methods (Dayan and Abbott, 2001).

Consider the general set of spikes, θ. Assume that θ was recorded over a total time period tθ. For each t0,tθ, the SDF is defined as the sum of Gaussian kernels, one centered at each spike time θi, as follows:

SDF(t;σ,θ)=12πσ2i=1nexp((tθi)22σ2) (1)

The parameter σ, also called the bandwidth, corresponds to the temporal resolution of the SDF. Smaller values of σ will result in a more jagged SDF while larger values will result in a smoother SDF. The STReaC algorithm defaults to σ=25 ms, which can be adjusted by the user.

Figure 1BD illustrates an example of the SDF construction using equation (1) for a specific spike train (visualized in panel A). A Gaussian kernel is centered at each spike time, indicated as a vertical hash mark in a zoomed view in panel B. In panel C, the sum of the Gaussians specified in equation (1) is shown in blue, with each individual Gaussian given in gray (note the different vertical scales between panels B and C). The complete SDF over the entire time interval 0,tθ, with tθ=10s in this example, is shown in panel D.

Figure 1:

Figure 1:

Example of building the SDF and ISIF for a given spike train. (A) Sample spike train from the data set in Section 4. (B) Each grey curve is a Gaussian centered around each spike contained in the box in (A). Vertical marks indicate spike times. (C) Sum of the Gaussians from (B) (blue) overlaid on the individual Gaussians themselves (grey curves). (D) The SDF (blue) for the entire spike train in (A), together with spike times marked in black below. (E) Linear interpolation of the points given by the spike times and interspike intervals for those spike times contained in the right box in (A) along with vertical marks at the actual spike times. (F) Moving average of the linear interpolation in (E) (blue), superimposed on the linear interpolation itself (grey) and the spike times (vertical marks). (G) The ISIF for the entire spike train in (A) (blue), together with spike times marked in black below.

As an illustration of the impact of the choice of σ in equation (1), we consider the SDF of a spike train generated from a Poisson process with rate 25 Hz. Figure 2A shows the SDF of this spike train with σ=25ms (blue) and σ=250ms (red), with the underlying spike train underneath. The temporal encoding in the SDF has a higher resolution when σ is small, which will be important in subsequent steps of the algorithm that involve comparing areas under the SDF, as discussed in Section 2.3. This can be seen in Figure 2B, which shows the power spectrum of each SDF in panel A (the colors match). The grey curve is the ratio of the power spectrum for σ=25ms to that for σ=250ms, and we observed that at frequencies below the 25 Hz firing rate, the SDF with σ=25ms has a higher power by several orders of magnitude, indicative of the increased resolution.

Figure 2:

Figure 2:

Example of spike train and choice of SDF and ISIF parameters. (A) A spike train generated from simulating a Poisson process with rate 25 Hz over 10 seconds (black hash marks) yields an SDF that depends on the choice of bandwidth parameter (blue: σ=25ms, red: σ=250ms). (B) Power spectrum for panel A (blue: σ=25ms, red: σ=250ms). Grey curve is the ratio of the power of 25ms (blue) curve to the power of the 250ms (red) curve. (C) Power spectrum for panel D (red: μ=25ms, blue: μ=250ms). Grey curve is the ratio of the power of 250ms (blue) curve to the power of the 25ms (red) curve. (D) ISIF with two different parameters (blue: μ=25ms, red: μ=250ms) for the same spike train (black). (E) ISIF computed with μ=250ms (blue) compared with the reciprocal of the SDF function with bandwidths σ=250ms (red).

2.2.2. ISIF

STReaC uses the ISIF as an alternative to the SDF to identify periods of decreased spiking. In subsection 2.4, we will discuss the rationale for this choice. The ISIF is analogous to the SDF, except that given a collection of discrete spike times, the ISIF produces a continuous function with an amplitude proportional to the duration of pauses in firing.

From a given spike train, the interspike intervals (ISIs) are found as the set ϕj=θj+1θjj=1n1, corresponding to the pauses that occur between consecutive spikes. To generate the ISIF, STReaC first linearly interpolates over the discrete set of points θj,ϕj to produce a continuous function I(t) on the time interval θ1,θn (Figure 1E), which is then discretized using a mesh of t values within the interval 0,tθ. Two adjustments are made at the boundaries. Since there is no ISI before the first spike we set It<θ1 to θ1 if the first ISI is larger than θ1 or θ1+ϕ1/2 otherwise. A similar approach occurs after the last spike, where Itθn is set to tθθn if ϕntθθn or tθθn+ϕn/2 otherwise. The ISIF itself, ISIF(t), is finally calculated as a moving average of I(t) (Figure 1F,G). Specifically, if we denote the times in our mesh as ti with i=1N, we have

ISIFti=1i+μ/2+δj=1j=i+(μ/2)+δItj1iμ21μj=i(μ/2)j=i+(μ/2)+δItjμ2<iNμ21N(iμ/2)+1j=i(μ/2)j=NItjNμ2<iN

for some integer choice of the width parameter μ>0 with units of time, where μ/2 is treated as integer division (e.g. rounded down or the floor of μ/2) and δ=1 for even μ and δ=0 for odd μ. For the time points ti that are within n<μ/2 points of the start or end of the time interval of interest, and hence do not have μ/2 points on either side, the value of ISIFti is the average of Iti,I evaluated at μ/2 points on one side of ti, and I evaluated at the n available points on the other side of ti. For example, for the third point in the mesh, t3, we have ISIFt3=(1/(3+μ/21))j=1j=3+μ/21Itj when n<μ/2 with even μ, giving δ=1. Note that the width of the red box in Figure 1F corresponds to the size of the window, μ=250ms, that goes into computing the value of ISIF(t) on the blue curve at the time point marked in red.

STReaC defaults to a moving average of 250 points (μ=250ms for the default discretization step size of 1 ms). To understand why, we consider the same Poisson spike train in Figure 2A, which is replotted in panel D. Panel D also shows the ISIF of this spike train with a 25 point moving average (red) and with a 250 point moving average (blue). Compared to the σ=250ms curve (red) in panel A, the μ=250ms curve in panel D (blue) maintains more of the fine temporal structure, while it also features smoother variation around local extrema than does the ISIF with μ=25ms. The maintenance of temporal structure is quantified in panel C, where the power spectra of the curves from panel D are shown in corresponding colors together with a gray curve indicating the ratio between the two, analogously to panel B. Note that the ratio between the power spectra stays much more level overall, and especially up to 30 Hz or so, than does that from the SDF curves shown in panel B.

Since the SDF is proportional to firing rate, it might seem reasonable that the reciprocal 1/SDF would be proportional to the durations of pauses in firing, like the ISIF. However, the ISIF generally exhibits substantially more sensitivity, or temporal encoding, for the pauses in the spike train than does 1/SDF (e.g., Figure 2E, which shows the ISIF computed with a moving average of 250 points compared with the reciprocal of the SDF computed with σ=250ms).

2.3. Single-trial Analysis

For any single trial, STReaC can identify any excited or inhibited segments of spikes relative to the trial baseline through comparison of the areas under the SDF or ISIF, respectively, within fixed-width time bins.

Specifically, the baseline period is divided into M equally spaced bins, and the area under the SDF in each of these bins is computed. These areas are ordered and the duration corresponding to a pre-specified percentile within the distribution, to be used as a threshold, is identified. Let us call that threshold duration aθ+(a for area, + for relevance to high levels of spiking, θ for threshold).

Next, the response period is divided into equally spaced bins with the same bin width as used for the baseline period and the areas under the SDF within the bins are computed. If any bin area from the stimulus period equals or exceeds aθ+, then that bin is labeled as an excited bin of the response spike train.

This procedure of comparing the bin areas in the baseline and response periods is repeated for the respective ISIFs, with a separate choice of percentile threshold for the baseline distribution, which gives rise to a corresponding threshold aθ. Any bin of the ISIF for the response period for which the area equals or exceeds aθ is considered to be an inhibited bin of the response spike train.

STReaC uses a shuffling procedure similar to that from previous work (e.g., Schwab et al. (2020)) to enhance the number of area samples in the baseline distributions for the SDF and the ISIF. This increase in the sample size results in less weight being placed on random, low probability events within the baseline recording, such as the chance occurrence of multiple consecutive unusually short or long ISIs; with more typical samples in the distribution, the percentile associated with unusual events becomes higher. In the shuffling procedure, the ISIs for the baseline period are reordered randomly, or shuffled, to create a new proxy-baseline spike train of time length tb (i.e., the same length as the original baseline period). The shuffling process can be repeated to produce as many extra proxy-baseline data sets as desired. Construction of the SDF and ISIF is performed on each of the proxy-baseline data sets and the corresponding bin areas are included in the trial baseline distribution. Figure 3 provides an example of determining aθ+ and aθ. Several shuffled spike trains are shown in panel A, with the corresponding SDFs in panel B and ISIFs in panel C. The distributions and thresholds, aθ+ and aθ, are illustrated in panel D and panel E, respectively.

Figure 3:

Figure 3:

Example generation of SDF and ISIF area distributions for the baseline period of an individual trial. (A) A spike train (permutation 0) and nine proxy-baseline trains based on shuffling (permutations 1–9). (B) SDFs for each of the spike trains in (A). (C) ISIFs for each of the spike trains in (A). (D) Histogram of all SDF bin areas computed from (B). Dashed vertical line marks aθ+ at the 99th percentile. (E) Histogram of all ISIF bin areas computed from (C). Dashed vertical line marks aθ at the 99th percentile.

Once excited and inhibited segments within the spike train for a response period within a trial are identified by comparing bin areas to aθ+ and aθ, respectively, the response type can be evaluated. Alternatively, as we will discuss in the next subsection, it may be more useful to perform an averaging across trials before performing a classification. For the single-trial response classification, the numbers of excited and inhibited bins are each compared to a corresponding pre-set, user-selected threshold bin count, the excited bin threshold (EBT) and the inhibited bin threshold (IBT), respectively (note that for bins of constant width, the EBT and IBT could equally well be represented as times rather than numbers of bins). The algorithm computes the total numbers of excited and inhibited bins as the numbers of bins from the response period with supra-threshold SDF and ISIF areas, respectively. These bins need not be consecutive under the default settings; however, the algorithm includes an option to require a certain number of consecutive excited and inhibited bins (cEBT and cIBT, respectively) for an effect to be detected. Note that a single spike train can give rise both to excited and inhibited bins.

The type of response for a trial is determined by whether or not the counts of excited and inhibited bins within that trial exceed each threshold, as well as additional user-imposed constraints that capture aspects of temporal patterning. Specifically, beyond simple excitation or inhibition, we found it useful to allow for a variety of additional response classifications. Table 1 provides a summary of the criteria for a variety of response classes that were useful in the analysis of data described in Section 4.

Table 1.

An example of some possible response types for identification with STReaC. These classes are used to determine the response types for a data set introduced in Section 4. Note that ≥ denotes that a threshold is equalled or exceeded, while < denotes that it is not. EXC: excited, INH: inhibited.

Type IBT EBT Constraints

CI - - f < fmin
PI < -
AI < Fewer INH bins in 2nd half of response than 1st
NE -
EX < -
BPIE Last EXC bin after last INH bin
BPEI Last INH bin after last EXC bin

In the case of inhibition, the firing rate is reduced or completely vanishes. The firing rate may return to the baseline value during or after the stimulus onset. Therefore, it is helpful to distinguish several sub-categories of inhibition to reflect these possibilities. We define these categories as follows. Complete inhibition (CI) occurs when firing over the whole response vanishes is absent or occurs at a sufficiently small rate (which we denote by f<fmin). Adapting inhibition (AI) occurs when the firing rate gradually returns to baseline levels during the stimulus period. Partial inhibition (PI) comprises all other cases that have a supra-threshold number of inhibited bins and a sub-threshold number of excited bins but that do not meet the criteria for complete and adapting inhibition.

A similar approach to classification into sub-classes can be taken with excitation (EX), although this step was not needed for the experimental data set that motivated Table 1. This data set also included biphasic responses, where excitation and inhibition both occurred. We have built in a further subdivision of biphasic responses, dependent on the relative timing of excitation and inhibition within the response. If excitation and inhibition both occur but the last inhibited bin occurs after the last excited bin, then we refer to the response class as biphasic excitation-inhibition (BPEI). If this ordering switches, such that the last excited bin occurs after the last inhibited bin, then we call the response class biphasic inhibition-excitation (BPIE). Finally, if a response does not meet any of the criteria for inhibitory, excitatory, or biphasic responses, then the response is designated as no effect (NE).

A feature of the STReaC toolbox is that it allows users to select thresholds for bin detection. Of course, thresholds should be chosen based on statistical reasoning or other objective arguments, not chosen arbitrarily or hand-picked to achieve a specific outcome. Note that a simple calculation based on the binomial distribution can be used to select a threshold aθ± and a corresponding number of bins required to exceed that threshold in order for an overall response to be considered as excitation or inhibition. For example, if a user requires k out of N bins to cross the threshold aθ+ for a response to be labeled as excitation, and wants the probability of a false positive to be at most α, then aθ+ should be selected by numerically solving the equation

Nkaθ+k1aθ+Nk=α.

Here, if N=20,k=3,α=.01, then aθ+.976; that is, bins with areas above the 97.6th percentile in the baseline distribution should be labeled as excited.

An example of the single-trial application of STReaC is illustrated in Figure 4. In the left column, panels A-C demonstrate the identification of periods of excitation for a specific baseline data set and response. The histogram corresponding to the SDF bin areas for the baseline and proxy-baseline spike trains is provided in panel A, where aθ+, chosen for illustration to be the 99th percentile, lies at the vertical dashed line. This line sets the threshold that the bin areas of the response SDF must surpass to be considered excited. Panel B plots the SDF bin areas for the stimulus response as a bar graph over time. The dashed line takes the same value as that in panel A aθ+. The first five bins reach or exceed aθ+ and are therefore considered excited. Panel C provides the full SDF for the response (blue curve) on top of the spike times (vertical black hashes), with the excited bins shaded. The corresponding procedure for finding periods of inhibition is shown in panels D-F. Here, there are seven bins of inhibition. With five excited bins early in the response (panel C) and seven inhibited bins late in the response (panel F), we can apply Table 1 and see that this example represents a BPEI response.

Figure 4:

Figure 4:

Example analysis of an individual trial. (A) Distribution of shuffled baseline SDF areas, with aθ+, the 99th percentile, indicated by a vertical dashed line. (B) Bar graph of response period SDF bin areas. The height of each bar corresponds to the area under the SDF curve in that bin. The horizontal dashed line marks the area at aθ+ derived from the baseline distribution in (A). (C) SDF curve over entire response period. Each bin with area that surpasses aθ+ is shaded in blue. Vertical black lines at the bottom of the plot represent spike times. (D) Distribution of shuffled baseline ISIF areas, with aθ, the 99th percentile, indicated by a vertical dashed line. (E) Bar graph of response ISIF bin areas. The height of each bar corresponds to the area under the ISIF curve in that bin. The horizontal dashed line marks aθ derived from the baseline distribution in (D). (F) ISIF curve over entire response period. Each bin that surpasses the threshold aθ is shaded in blue. Vertical black lines represent spike times.

2.4. Comparison of ISIF with SDF

Now that we have described the steps that go into the generation of the baseline area distributions that form the basis for the evaluation of response properties in STReaC, we can revisit the issue of why the ISIF is more useful than the SDF itself (as opposed to 1/SDF considered in Figure 2) for the detection of noteworthy reductions in spiking. For a low rate spike train, the SDF always takes small values, relative to which decreases can be difficult to detect. In a somewhat extreme example of a 4 Hz train, a 50% drop in rate represents a switch from 1 spike every 250 ms to one spike every 500 ms. In relative terms, this is a large difference, but this change is difficult to detect in a spike count, especially one based on bins in which the spike counts for this train will either be 0 or 1, as might be needed to also allow for detection of spike rate increases from this baseline.

In our simulations, we find that the SDF may be of limited utility for detecting spike rate decreases at low rates, even in much less extreme cases. Shortly, we will define a frequency threshold, f˜, below which the ISIF becomes more sensitive to detecting spike rate decreases than is the SDF. Two example cases are illustrated in Figure 5, one with a baseline firing rate above f˜ (Figure 5AD) and one with a rate below f˜ (Figure 5EH). In the former (panels A-D), the underlying average spike rate is originally 40 Hz and is later reduced to 20 Hz. With the parameter tuning used, both the SDF (panel B) and the ISIF (panel D) identify reduced firing in several bins; note that for the SDF, a reduction is defined as a bin area below the lower threshold (dotted line, panel B) while for the ISIF, reduction is defined as a bin area above the upper threshold (dashed line, panel D). Despite some differences in which bins are identified as inhibited, the spike rate is sufficiently high that the SDF and ISIF give qualitatively similar results. Starting from a lower initial rate of 10 Hz and cutting that in half, however, leads to much stronger detection of reduction by the ISIF than the SDF (panels E-H). This difference only intensifies for even lower baseline firing rates (Figure 5IJ). Specifically, the ratio of detected inhibited ISIF bins to detected inhibited SDF bins, computed from 1000 spike trains with baseline rates from 5 Hz to 50 Hz to which a 50% reduction in rate is applied (as in the two examples), grows to be much larger than 1 once the baseline firing rate drops below about 15 Hz. The red curve in Figure 5I depicts the best least squares fit to the data by functions of the form f(x)=a/x+b (given by a7.96,b0.67). The value f˜=24.25 approximates where a/x+b=1 for the data in Figure 5I, which is the value where the ratio of ISIF to SDF bins equal 1. That is, the ISIF (SDF) is more sensitive to the detection of periods of inhibition when baseline firing rates lie below (above) f˜.

Figure 5:

Figure 5:

ISIF performs better than SDF at finding periods of reduced firing in relatively low-rate trains. (A) Distribution of shuffled SDF bin areas of a relatively high-rate Poisson spike train (rate parameter= 40Hz, empirical FR= 42.2Hz). Dashed (dotted) vertical line is 99th (1st) percentile. (B) SDF bin areas of Poisson spike train with reduced rate (rate parameter= 15Hz, empirical FR= 18.7Hz). Dashed (dotted) horizontal lines are values from (A). Note that reduced firing, given by bin heights below the dotted line, is detected in several time bins. (C) Distribution of shuffled ISIF bin areas of the Poisson spike train used in (A). Dashed (dotted) vertical line is 99th (1st) percentile. (D) ISIF bin areas of Poisson spike train with reduced rate, as used in (B). Dashed (dotted) horizontal lines are values from (C). Reduced firing is detected when bin height exceeds the dashed line; these events roughly but not perfectly agree with reduced firing events in (B). (E) Distribution of shuffled SDF bin areas of a lower-rate Poisson spike train (rate parameter= 10Hz, empirical FR= 10.7Hz). Dashed (dotted) vertical line is 99th (1st) percentile. (F) SDF bin areas of Poisson spike train with reduced rate (rate parameter= 5Hz, empirical FR= 5.4Hz). Dashed (dotted) horizontal lines are values from (E). Reduced firing is detected in four time bins. (G) Distribution of shuffled ISIF bin areas of the Poisson spike train used in (E). Dashed (dotted) vertical line is 99th (1st) percentile. (H) ISIF bin areas of Poisson spike train with reduced rate as used in (F). Dashed (dotted) horizontal lines are values from (G). Reduced firing is detected in 7 time bins. (I) Ratio of the number of inhibited bins from the ISIF to the number of inhibited bins from the SDF at different baseline rates for 1000 simulated Poisson spike trains (trains where no inhibited bins were detected with both the ISIF and SDF were omitted). The red curve plots the line of best fit f(x)=a/x+b(a7.96,b0.67) where the star is at coordinate (24.25, 1). The SDF flags more bins as reductions in firing rate than does the ISIF at baseline firing rate values above 24.25 Hz. (J) Histogram of ratios collected from all data at all frequencies used in (I); bin width is 0.25.

2.5. Average Response Analysis

The STReaC algorithm naturally allows for the analysis of the average neural response across multiple trials, in addition to single-trial responses, if T>1. This process starts with a direct averaging step and then follows a similar procedure to the single-trial analysis.

For the average response analysis, the areas under the SDF and ISIF in the bins for the baseline period in each trial are all collected, including all of the areas produced from shuffling the ISIs during the single trial analysis (this feature can be turned off if desired, see Section 3). Collectively, these areas are used to form the baseline distributions.

The SDFs for the response periods of all T trials are combined by a straightforward averaging procedure (i.e., the T SDF functions of time are summed and divided by T), and averaging is performed similarly for the ISIFs. Note that on individual trials, the frequency threshold f˜ can be used to determine whether the ISIF or the SDF is used for analysis of inhibited activity. When averaging is to be performed, the toolbox uses an all-or-none approach: if any trial has a baseline mean frequency below f˜, then the ISIF is used for all trials, with the SDF used for all trials otherwise. This approach ensures that the same type of functions, either ISIFs or SDFs, will be averaged across trials. Below, for concreteness, we will assume that the ISIF has been used.

The areas under the averaged SDF within the relevant bins are compared to the excitation threshold, aθ+, from the baseline distribution, and similarly for the averaged ISIF and the inhibition threshold, aθ, and thus excited and inhibited bins in the averaged response train are identified. Finally, the numbers of excited bins and inhibited bins are compared to the respective EBT and IBT (and optionally, the numbers of such bins that are consecutive are compared to cEBT and cIBT as well), and the results are combined with any additional imposed conditions to determine the response type.

Importantly, for the average response analysis, it makes sense to use a lower percentile for the thresholds (i.e., less strict detection criterion) in the baseline distributions than in single trial analysis. An event that is not extremely unlikely based on baseline statistics becomes successively more unlikely if it occurs in exactly the same time window within a larger time period over more and more trials, as is needed for it to impact the average SDF or ISIF for the response. The precise calculation of a threshold for the average response to give a specific probability of a false positive will depend on the distribution of the baseline response areas. For example, suppose that the baseline areas come from a normal distribution with mean μ and variance σ2. Note that sums of n independent samples from this normal distribution are themselves normally distributed with mean nμ and variance nσ2. If we seek a baseline area threshold aθ such that the probability that a bin area in the average response exceeds this threshold is .01, then for the observed μ,σ, we should solve for aθ such that

.01=naθ1σ2πne(snμ)2/2nσ2ds.

From here, since the .01 target corresponds to a z-score of approximately 2.33, a calculation based on a change of variables implies that we should choose aθ for the baseline distribution corresponding to a z-score of 2.33/100.737, which from standard z-tables implies that we should take aθ as the 74th percentile. Analogous calculations can be done for other baseline area distributions, and these are similarly straightforward for other special cases such as Poisson distributions and would rely more heavily on more involved numerical calculations or estimates for most other distributions.

To provide an example of an average neural response here (Figure 6), we used a more conservative choice of aθ±=0.9, which corresponds to an extremely low probability, about .005%, of false positive detection. Figure 6A provides an example of a collection of 10 trials recorded for a single unit. In each trial, positive time indicates a light-on period when an optogenetic stimulus was delivered and negative time represents the baseline period. The trials are each transformed into the respective SDFs in Figure 6B and the ISIFs in Figure 6C before being averaged together to generate the average SDF in Figure 6D and the average ISIF in Figure 6E. The shaded segments indicate the bins with areas that exceeded the 90th percentile of the baseline bin area distribution. Since there are four excited bins in total and zero inhibited bins, with EBT = IBT = 3, the average neural response would be classified as excitation, or EX.

Figure 6:

Figure 6:

Example of STReaC evaluating average response of a single unit over 10 trials of optogenetic stimulation. (A) Spike rasters for the unit for all trials, with the baseline period in negative time and the response period during the positive time interval (also indicated by thick solid red line).(B) Normalized (highest peak set to 1) SDFs for the response period for all trials. (C) Normalized (highest peak set to 1) ISIFs for the response period for all trials. (D) Trial averaged SDF, shaded where the bin areas surpass the baseline threshold aθ+ (horizontal line indicates baseline threshold converted to proper units, aθ+/bin width). (E) Trial averaged ISIF, shaded where the bin areas surpass the baseline threshold aθ (horizontal line indicates baseline threshold converted to proper units, aθ/bin width). Since there are 4 bins indicating excitation but no bins indicating inhibition, our example classification scheme with EBT = IBT = 3 (Table 1) indicates that this unit has an excitation (EX) response.

STReaC reports these classification results in an aggregate output table, along with other neural measurements, as detailed further in the next section.

3. Implementation

In this section we provide an overview of how to use the code that we have developed to apply the STReaC algorithm. We refer the reader to the official STReaC GitHub repository linked in Section 5 for a more detailed description.

To run the STReaC algorithm on a dataset, the user must specify the paths and names for two directories. The first (Data) contains the data, which should be supplied as a collection of subdirectories, one for each experimental group, each containing further subdirectories for individual neurons within in each group as specified by Section 2.1. The second directory (Results) stores the output of the STReaC algorithm.

Assuming the data is structured correctly, the STReaC algorithm can be applied to the dataset with one command using the main script, analyze_data.py. As part of the command to run this script, the user can specify a set of flags. From a high level view, these flags can be grouped into two types: (1) locations and names of the Data and Results directories as just described as well as, optionally, a third file, ParamFile, containing values of all the parameters described in the sections above, and (2) flags relating to choices about the algorithm that should be applied for that run, including flags used to set the algorithm parameter values if a ParamFile is not supplied.

The directory containing the data is provided to the main script with the following flag: –data_direc Data. The directory that will hold the results is provided to the same script with the following command line flag: –save_direc Results. A flag for a parameter file can be provided to supply the STReaC algorithm with the parameters discussed in this paper: –param_file ParamFile. Individual parameters can also be provided with the respective flags (see GitHub repository for specifics). A parameter file with the default values is provided below:

# parameter file
baseline: 10,10 
stimulus: 0,10
bin_width: 0.5
trial_percentile:99
average_percentile: 90
inhibit_bin_threshold:3
excite_bin_threshold:3
consecutive_inhibit_bin_threshold:3
consecutive_excite_bin_threshold:3
mu:250
sigma: 25/1000
isif_sdf_threshold:24.25
average_shuffling:Yes

The values given for baseline and response correspond to tb,tb and tr,tr, respectively. The parameters in ParamFile can be provided through specific flags.

Trial responses and the average response are implemented with the flags: -generate_data and-average_response, respectively. Finally, a flag can be provided, -pandas, that collects all of the results for all groups found in the Data in a large CSV file.

An example of running STReaC from a terminal is provided below:

$ python analyze_data.py \
   --data_direc DATA \
   --save_direc RESULTS \
   --param_file PARAMFILE \
   --generate_data \
   --average_response \
   -- pandas

The summary file produced as the output of the algorithm appears in the directory that is home to Results file. The summary file contains all trial response and average response information, the metadata provided for each neuron, as well as other commonly desired neural spike train quantities including firing rate, coefficient of variation (CV), average interspike interval, and timing of first and last spikes. This summary file can then be use for further analysis in interpreting the neural spike train responses.

4. Application of STReaC to Experimental Data

As an example application of STReaC, this section presents several results obtained by using STReaC to analyze single unit, in vivo recordings from mouse substantia nigra pars reticulata (SNr) collected while the external segment of the globus pallidus (GPe) was optogenetically stimulated to elicit GABA release from its synaptic terminals in SNr. For more details on the experimental methods, see Mastro, Zitelli, Willard, Leblanc, Kravitz and Gittis (2017); Phillips et al. (2020). This is an interesting scenario to consider, because past experiments have revealed a surprising diversity of SNr responses to similar forms of GPe stimulation (Freeze, Kravitz, Hammack, Berke and Kreitzer, 2013; Phillips et al., 2020).

For this experimental data set, each neuron was recorded for T=10 trials. The baseline period was considered as the tb=10s immediately preceding the optogenetic stimulus, which itself lasted tr=10s. In the construction of the SDF and ISIF for the baseline and response periods, sampling was done at 1000 Hz, giving a total of 10,000 samples in each. The SDF was constructed with a bandwidth of σ=25ms, as in Schwab et al. (2020). The moving average for the ISIF was performed with μ=250ms. Table 1 was used as the response classification table for both the single-trial and average responses. The IBT and EBT were both set to 3 bins with a bin size of 0.5s, such that a total of 1.5s of excitation and/or inhibition was needed for a response to be registered.

Canonical examples of each of the different average response types listed in Table 1 are depicted in Figure 7. For each case, the trial-averaged firing rate and the standard deviation of the rate are shown, split into baseline (black) and response (blue) periods as in Figure 6.

Figure 7:

Figure 7:

Paradigmatic examples of each of the seven response types observed in experimental recordings from SNr neurons, including firing rate averages (dots) and standard deviations (shaded regions) during the baseline (black) and response (blue) periods for each. Note that a small gap appears between the two periods in each case because the firing rate right at stimulus onset (time = 0s) is not defined.

To develop a better sense of the nuances of STReaC, it is useful to consider less clear-cut examples of SNr responses as well. Figure 8 provides an example of one such response. In panel A, the raster plots of spikes from a single SNr neuron collected across all 10 trials are given, with stimulus and hence response period onset at time 0s. It is quite difficult to detect by visual inspection, even with a zoomed view (not shown), whether the pauses or concentrations in firing here are outside of the range of expectations from the baseline firing. Similarly, inspection of the firing rate time course in panel B and the raw spike count histogram in panel C seems to suggest that firing rates gradually increase during the stimulus period, but there is also a lot of variability. Interestingly, not only are no decreases in firing rate detected (Figure 8E), but STReaC determines that only one time bin features increases in firing rate that are statistically unexpected relative to the 90th percentile of the baseline distribution that we use for averaged response analysis (Figure 8D). Due to the paucity of responses, this example neuron is classified as exhibiting “no effect” of stimulation.

Figure 8:

Figure 8:

An example in which STReaC determines that increases in firing rates are not sufficient to qualify as excitation. (A) Raster plot of the firing across 10 trials for an SNr unit, similar to Figure 6A, with a red bar showing the time when an optogenetic stimulus was applied; this defines the response period in this example. (B) Average firing rate during the baseline (negative time) and response period (positive time) with the standard deviation across all trials shown by the shaded regions. (C) Peristimulus time histogram (PSTH) of trials in panel A, with a bin width of 0.5 seconds. (D) Trial averaged SDF with baseline average threshold aθ+ (horizontal line indicates baseline threshold converted to proper units, aθ+/bin width). One bin that is considered excited occurs, meaning that this bin exceeds the 90th percentile of the baseline SDF bin area distribution. (E) Trial averaged ISIF with baseline average threshold aθ (horizontal line indicates baseline threshold converted to proper units, aθ/bin width). No inhibition occurs, meaning that no bin exceeds the 90th percentile of the baseline ISIF bin area distribution.

As a second interesting example, consider Figure 9. Panel A provides the raster plot, as in previous figures. Both during the baseline period and the response period, the rasters include periods with significant spiking interspersed with noticeable pauses; rates are elevated in some trials, perhaps more often after stimulation than before, but only for transient periods. Panel B suggests that the firing rate increases towards the end of the response period, indicating a possible excitatory response. Similarly, the PSTH in panel C shows a drop in spike count near the middle of the response period and a rise towards the end of the response period, indicating a possible biphasic response. To resolve this situation, we compare SDF bin areas and ISIF bin areas to the 90th percentiles of the respective baseline distributions. This comparison reveals only a short period of excitation (Figure 9D) along with the presence of four consecutive bins of inhibition, with three in the first half of the stimulus period (Figure 9E). Based on this outcome and Table 1, STReaC classifies the response as adapting inhibition.

Figure 9:

Figure 9:

STReaC captures a subtle adapting inhibition response. (A) Raster plot of the trials for the unit, similar to Panel A in Figure 6. (B) Average firing rate during the baseline (negative time) and response period (positive time) with the standard deviation across all trials shown by the shaded regions. (C) Peristimulus time histogram (PSTH) of trials in panel A, with a bin width of 0.5 seconds. (D) Trial averaged SDF with baseline average threshold aθ+ (horizontal line indicates baseline threshold converted to proper units, aθ+/bin width). One period of excitation occurs, meaning one bin exceeds the 90th percentile of the baseline SDF bin area distribution. (E) Trial average ISIF with baseline average threshold aθ (horizontal line indicates baseline threshold converted to proper units, aθ/bin width). Inhibition occurs in four bins, most of which are in the first five seconds, meaning that these bins’ areas exceed the 90th percentile of the baseline ISIF bin area distribution, resulting in the response being classified as adapting inhibition.

Next, consider the example in Figure 10. This example is quite challenging to assess based on visual inspection of spike rasters (panel A). The response trains show some time periods of short pauses but it is not immediately clear if the pauses are sufficiently consistent across trials or last long enough to be meaningful. Panel B shows a downward drift in firing rate during the response, but with a mean that is well within the range of rate variability present in the baseline period. STReaC resolves these issues again, determining that there are several bins with significantly inhibited spiking during the response period. Overall, this response is classified as partial inhibition because three inhibitory bins are identified and the IBT is 3 and we did not for these to be consecutive (i.e., we did not use cIBT), but of course analysts interested in inhibitory responses of other durations or sustained inhibitory responses can easily adjust the IBT or cIBT parameter, respectively, in the algorithm.

Figure 10:

Figure 10:

An example of STReaC identifying a partial inhibition response. (A) Raster plot of the trials for the unit, similar to Panel A in Figure 6. (B) Average firing rate during the baseline (negative time) and stimulus period (positive time) with the standard deviation across all trials as the shaded regions. (C) Peristimulus time histogram (PSTH) of trials in panel A, with a bin width of 0.5 seconds. (D) Trial averaged SDF with baseline average threshold aθ+ (horizontal line indicates baseline threshold converted to proper units, aθ+/bin width). No excitation occurs, meaning no bins exceed the 90th percentile of the baseline SDF bin area distribution. (E) Trial averaged ISIF with baseline average threshold aθ (horizontal line indicates baseline threshold converted to proper units, aθ/bin width). Inhibition occurs in three non-consecutive bins, which is enough to affect the classification of the unit’s response.

Finally, consider the example in Figure 11. This example is also quite challenging to assess based on visual inspection of spike rasters. The response trains show some some prolonged pauses early as well as some later time periods of sustained firing, but it is not immediately clear if the former are sufficiently consistent in time to be meaningful nor if the latter feature firing rates that exceed what occurs during the baseline period. Both panel B and panel C seem to indicate the existence of periods of excitation, whereas inhibition is more difficult to resolve visually. STReaC resolves these issues and determines that the first three time bins qualify as an inhibitory response, followed by early and late groups of bins that qualify as excitation. Overall, this response is thus classified as biphasic inhibition-excitation.

Figure 11:

Figure 11:

An example unit that STReaC classifies as having a biphasic inhibition-excitation response. (A) Raster plot of the trials. (B) Average firing rate during the baseline (negative time) and stimulus period (positive time) with the standard deviation across all trials as the shaded regions. (C) Peristimulus time histogram (PSTH) of trials in panel A, with a bin width of 0.5 seconds. (D) Trial averaged SDF with baseline average threshold aθ+ (horizontal line indicates baseline threshold converted to proper units, aθ+/bin width). Excitation occurs in nine bins, meaning that these bins’ areas exceed the 90th percentile of the baseline SDF bin area distribution. (E) Trial averaged ISIF with baseline average threshold aθ (horizontal line indicates baseline threshold converted to proper units, aθ/bin width). Inhibition occurs in the first three bins, meaning that these bins’ areas exceed the 90th percentile of the baseline ISIF bin area distribution.

4.1. Experimental Approval

Experimental procedures were approved by the Carnegie Mellon University Committee for the Use and Care of Animals and in accordance to the guidelines set forth by the National Institute of Health and Society for Neuroscience Use of Animals in Neuroscience Research. IACUC approval number: PROTO201600011

5. Discussion

In this paper, we introduce a novel tool, the Spike Train Response Classification (STReaC) toolbox, which compares spike trains across two time periods or conditions and classifies the response type using an objective, tunable procedure. Clearly, using a standardized, rigorous and unbiased approach is desirable for precise, reproducible analyses of experimental results.

Section 2 of this paper provides an overview of the computations that comprise STReaC, as well as examples of single-trial and trial-averaged response analysis (Figure 4 and Figure 6, respectively). We leveraged data from in vivo recordings of units in mouse SNr to showcase the canonical response classes listed in Table 1 (Figure 7). Beyond these canonical examples, STReaC applies equally well in cases where traditional methods, such as direct calculation of average firing rate and inspection of the spike train and SDF, may provide misleading results or may be difficult to apply. Examples of interesting cases from the SNr data are provided in Figures 811. The firing rate in Figure 8 is visually suggestive of an excitatory response in the raster plot and average firing rate curve, yet STReaC objectively shows that the average responses are not significantly different from firing during the baseline period and hence classifies the response as no effect. The cases in Figures 9, 10, 11 are similarly difficult to resolve by inspection.

Although we developed STReaC to help us identify spike train responses to optogenetic stimulation, STReaC has the flexibility to be used in any circumstances (in vivo, in vitro, or in silico) in which spike trains are being compared. The toolbox does have limitations, however, which users should take note of and which could be potentially addressed in future updates. The most apparent potential shortcoming of STReaC is that it requires the choice of several parameters used in the implementation and in the definitions of response classes. For example, the user chooses the bandwidth parameter σ of the SDF, the averaging window parameter μ for the ISIF, the width of the bins used for area calculations, and the percentile thresholds aθ+,aθ for the response classification. On one hand, the flexibility in these parameters could result in users making some choices that place too much weight on chance timing of small sets of spikes (e.g., small σ and small bin width for the SDF), to lose temporal resolution in the SDF or ISIF and hence miss responses over bounded time windows (e.g., overly large σ or μ, respectively) or have other flaws. On the other hand, this flexibility is advantageous in that it allows different users to adapt the STReaC algorithm to their specific data sets and interests. For example, Figure 10 shows a case in which a partial inhibition is only detected due to three inhibition periods that are spread out in time over the second half of the response. If users were looking for only sustained responses represented by consecutive inhibited bins within the ISIF, then the average response of this neuron would not be considered as partial inhibtion, but rather as exhibiting no effect. Future work could explore a procedure to identify the optimal STReaC parameter settings for a given data set or hypothesis testing scenario, perhaps by allowing for supervised or semi-supervised learning that harnesses exemplar data sets featuring clear responses, if these are available.

Another limitation of STReaC as it now stands is that it does not include a function to analyze firing rate drift that may occur within or across successive trials. Such drift can happen for many different reasons unrelated to an experimental manipulation being performed. Alternatively, an intervention being used to induce the possible response may lead to synaptic plasticity or some other systemic effects. Methods to detect spike train drift have been developed (Bar-Hillel, Spiro and Stark, 2006; Davey, Soto-Breceda, Shafton, McAllen, Furness, Grayden and Stebbing, 2020; Calabrese and Paninski, 2011) and, while we did not implement these due to a clear lack of systematic drift in our SNr data, incorporating them into STReaC represents another natural future step. In the meantime, users can certainly apply these methods to their data outside of the STReaC toolbox and use the results to decide whether using STReaC is appropriate. If non-stationarity is detected, then they can consider whether applying STReaC after using a method to remove the drift in firing rate would be suitable.

Despite these limitations, STReaC is easy to use, freely available, and adaptable. It applies to one of the most ubiquitous forms of data analysis in neuroscience by providing a classification of responses observed in neural spike trains collected during two comparison periods, defined however the user would like. Because its outputs are generated objectively, STReaC offers the potential to enhance reproducibility and consistency across studies.

Highlights.

  • User-friendly toolbox to automate classification of neuronal spike trains

  • Favors interspike intervals over spike density to detect decreases in firing rate

  • Accepts user inputs to accommodate a variety of experimental protocols

  • Performance demonstrated on data from optogenetic stimulation experiments

Acknowledgments

The work reported in this document was partially supported by funding from the National Institutes of Health (NIH 1R01NS125814-01).

Footnotes

Declaration of Competing Interest

The authors state no competing interests.

Declaration of interests

The authors declare the following financial interests/personal relationships which may be considered as potential competing interests:

Jonathan Rubin, Aryn Gittis reports financial support, article publishing charges, and travel were provided by National Institute of Neurological Disorders and Stroke. John Parker, Asier Aristieta reports financial support was provided by National Institute of Neurological Disorders and Stroke.

CRediT authorship contribution statement

John E. Parker - Methodology, Software, Validation, Formal Analysis, Resources, Data Curation, Writing - Original Draft, Writing - Review & Editing, Visualization; Asier Aristieta - Methodology, Validation, Investigation, Resources, Data Curation, Writing - Review & Editing; Aryn Gittis - Conceptualization, Validation, Resources, Project administration, Funding acquisition; Jonathan E. Rubin - Conceptualization, Methodology, Validation, Formal Analysis, Investigation, Resources, Writing - Original Draft, Writing - Review & Editing, Visualization, Supervision, Project administration, Funding acquisition

Publisher's Disclaimer: This is a PDF file of an unedited manuscript that has been accepted for publication. As a service to our customers we are providing this early version of the manuscript. The manuscript will undergo copyediting, typesetting, and review of the resulting proof before it is published in its final form. Please note that during the production process errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain.

Data Availability

All data corresponding to figures, as well as figure production, can be found at https://github.com/jparker25/Parker_et_al_2023_methods. The code for STReaC is maintained for open-source usage at https://github.com/jparker25/streac.

References

  1. Aljadeff J, Lansdell BJ, Fairhall AL, Kleinfeld D, 2016. Analysis of neuronal spike trains, deconstructed. Neuron 91, 221–259. URL: https://linkinghub.elsevier.com/retrieve/pii/S0896627316302501, doi: 10.1016/j.neuron.2016.05.039. [DOI] [PMC free article] [PubMed] [Google Scholar]
  2. Bar-Hillel A, Spiro A, Stark E, 2006. Spike sorting: Bayesian clustering of non-stationary data. Journal of Neuroscience Methods 157, 303–316. URL: https://linkinghub.elsevier.com/retrieve/pii/S0165027006002007, doi: 10.1016/j.jneumeth.2006.04.023. [DOI] [PubMed] [Google Scholar]
  3. Borst A, Theunissen FE, 1999. Information theory and neural coding. Nature Neuroscience 2, 947–957. URL: http://www.nature.com/articles/nn1199_947, doi: 10.1038/14731. [DOI] [PubMed] [Google Scholar]
  4. Calabrese A, Paninski L, 2011. Kalman filter mixture model for spike sorting of non-stationary data. Journal of Neuroscience Methods 196, 159–169. URL: https://linkinghub.elsevier.com/retrieve/pii/S0165027010006655, doi: 10.1016/j.jneumeth.2010.12.002. [DOI] [PubMed] [Google Scholar]
  5. Davey CE, Soto-Breceda A, Shafton A, McAllen RM, Furness JB, Grayden DB, Stebbing MJ, 2020. A new algorithm for drift compensation in multi-unit recordings of action potentials in peripheral autonomic nerves over time. Journal of Neuroscience Methods 338, 108683. URL: https://linkinghub.elsevier.com/retrieve/pii/S0165027020301059, doi: 10.1016/j.jneumeth.2020.108683. [DOI] [PubMed] [Google Scholar]
  6. Dayan P, Abbott L, 2001. Theoretical Neuroscience. The MIT Press. [Google Scholar]
  7. Freeze BS, Kravitz AV, Hammack N, Berke JD, Kreitzer AC, 2013. Control of basal ganglia output by direct and indirect pathway projection neurons. Journal of Neuroscience 33, 18531–18539. [DOI] [PMC free article] [PubMed] [Google Scholar]
  8. Goldberg DH, Victor JD, Gardner EP, Gardner D, 2009. Spike train analysis toolkit: enabling wider application of information-theoretic techniques to neurophysiology. Neuroinformatics 7, 165–178. [DOI] [PMC free article] [PubMed] [Google Scholar]
  9. Mastro KJ, Zitelli KT, Willard AM, Leblanc KH, Kravitz AV, Gittis AH, 2017. Cell-specific pallidal intervention induces long-lasting motor recovery in dopamine-depleted mice. Nature Neuroscience 20, 815–823. doi: 10.1038/nn.4559. [DOI] [PMC free article] [PubMed] [Google Scholar]
  10. Meyer AF, Williamson RS, Linden JF, Sahani M, 2017. Models of neuronal stimulus-response functions: Elaboration, estimation, and evaluation. Frontiers in Systems Neuroscience 10. URL: 10.3389/fnsys.2016.00109/full, doi:. [DOI] [PMC free article] [PubMed] [Google Scholar]
  11. Nirenberg S, Latham PE, 2003. Decoding neuronal spike trains: How important are correlations? Proceedings of the National Academy of Sciences 100, 7348–7353. URL: 10.1073/pnas.1131895100, doi: 10.1073/pnas.1131895100. [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. Parida S, Bharadwaj H, Heinz MG, 2021. Spectrally specific temporal analyses of spike-train responses to complex sounds: A unifying framework. PLOS Computational Biology 17, e1008155. URL: 10.1371/journal.pcbi.1008155, doi: 10.1371/journal.pcbi.1008155. [DOI] [PMC free article] [PubMed] [Google Scholar]
  13. Phillips RS, Rosner I, Gittis AH, Rubin JE, 2020. The effects of chloride dynamics on substantia nigra pars reticulata responses to pallidal and striatal inputs. eLife 9, 1–35. URL: https://elifesciences.org/articles/55592, doi: 10.7554/eLife.55592. [DOI] [PMC free article] [PubMed] [Google Scholar]
  14. Schwab BC, Kase D, Zimnik A, Rosenbaum R, Codianni MG, Rubin JE, Turner RS, 2020. Neural activity during a simple reaching task in macaques is counter to gating and rebound in basal ganglia–thalamic communication. PLOS Biology 18, e3000829. URL: 10.1371/journal.pbio.3000829https://dx.plos.org/10.1371/journal.pbio.3000829, doi:. [DOI] [PMC free article] [PubMed] [Google Scholar]
  15. Strong SP, Koberle R, de Ruyter van Steveninck RR, Bialek W, 1998. Entropy and information in neural spike trains. Physical Review Letters 80, 197–200. URL: 10.1103/PhysRevLett.80.197, doi: 10.1103/PhysRevLett.80.197. [DOI] [Google Scholar]
  16. Victor JD, 2005. Spike train metrics. Current Opinion in Neurobiology 15, 585–592. URL: https://linkinghub.elsevier.com/retrieve/pii/S0959438805001236, doi: 10.1016/j.conb.2005.08.002. [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

All data corresponding to figures, as well as figure production, can be found at https://github.com/jparker25/Parker_et_al_2023_methods. The code for STReaC is maintained for open-source usage at https://github.com/jparker25/streac.

RESOURCES