Introduction

The advent of high-density, large-scale multielectrode array recordings has advanced our understanding of how population of neurons represent and process information, offering crucial insights into complex network dynamics (Riquelme et al., 2023; Hemberger et al., 2019; Shein-Idelson et al., 2017, Thivierge et al., 2022). Furthermore, the use of silicon recording probes such as Neuropixels probes in vivo has helped uncovered foundational principles of neural circuits in awake behaving mice (Lak et al., 2020; Peters et al., 2021). However, it remains a challenge to distinguish neuronal cell types based on their physiological properties alone, despite a growing appreciation for the importance of heterogeneous cell types in circuit-level computations (Sylwestrak et al., 2022; Liu et al., 2021; Bugeon et al., 2022). The scalability of large-scale electrophysiological recording techniques depends not only on the detection and isolation of spikes produced by single neurons (spike sorting), but also on the reliable distinction between those triggered by different cell-types.

The recording of extracellular potentials is a popular method to investigate neural activity, offering a high spatiotemporal resolution whilst allowing for the monitoring of action potentials from thousands of cells simultaneously (Magland et al., 2020; Buzsáki, 2004). Cell-type sorting based on extracellular action potential waveforms has been extensively explored. It has been proposed that excitatory (E) and inhibitory (I) neurons can be distinguished based on action potential waveforms (Hafizi et al., 2022; Ren et al., 2020; Bathó et al., 2004). These methods typically extract features of action potentials such as peak-to-peak time difference, and full-width-half amplitude maximum, and match these features to reported values for each cell types to distinguish them. The rationale for using these features as a proxy for cell-type identity stems from intracellular recording studies, which report that inhibitory cells, such as parvalbumin-expressing GABAergic interneurons, have short-duration action potentials (Nowak et al., 2003; Peyrache and Destexhe, 2019; Kawaguchi, 1993; Connors and Gutnick, 1990), whereas excitatory pyramidal neurons have longer-duration action potentials (McCormick et al., 1985). Narrow and broad action potentials have been distinguished from one another in several neocortical areas, including prefrontal cortex (Mitchell et al., 2007; Wilson et al., 1994; Constantinidis and Goldman-Rakic, 2002; Gonzalez-Burgos et al., 2005; Hasenstaub et al., 2005, Bartho et al., 2004, Tamura et al., 2004). These differences have been hypothesized to result from the fact that repolarization of the membrane potential following a spike is slower among broad-spiking pyramidal neurons (McCormick et al., 1985; Nowak et al., 2003; Hasenstaub et al., 2005). In the extracellular signal, which resembles the negative derivative of the intracellular membrane potential, this gives both a broader and shallower peak following the initial trough (Henze et al., 2000).

Modern extracellular recording techniques allow researchers to monitor the simultaneous activity of large, intact networks of neurons. However, in dense preparations, the activity of a single cell may be captured by several electrodes, and each electrode may report the activity of several nearby cells. Thus, to segregate the activity of single cells, effective spike-sorting techniques must be employed. Spike sorting typically includes filtering the raw extracellular activity, detecting action potentials using threshold crossings, extracting spike features, and clustering to distinguish amongst neurons (Rey et al., 2015).

Several methods have been developed, each with specialized features, including Kilosort4 (Pachitariu et al., 2023), SpyKING CIRCUS (Yger et al., 2018), MountainSort (Chung et al., 2017), Herding Spikes (Hilgen et al., 2017), YASS (Lee et al., 2017), and JRCLUST (Jun et al., 2017). A detailed comparison of these methods is presented in Table 1. A common lacking feature in these methods is the ability to identify cell-types in a biologically validated fashion. Despite evidence showing differences in action potential kinetics for distinct cell-types, there exists no large-scale validation efforts, to our knowledge, showing that extracellular waveforms can be used to reliably distinguish cell-types. Methods leveraging genetic differences between cell types offer statistical measures predictive of cell types, such as Fano Factor (Becchetti et al., 2012). These methods have provided researchers with the ability to infer, in a post-hoc fashion, the most probable cell types that were sampled. Yet, a fully integrated suite offering an open-source data analysis pipeline paired with a validated experimental protocol allowing for high-density cell type-specific activation during recordings is needed. Such method will enable the investigation of dense and intricate circuits in a flexible, scalable, and generalizable manner.

lang.: Programming language, # elect.: Maximum number of electrodes tested on, data preproc.: Data preprocessing (formatting, filtering, artefact removal) included, event/channel loc.: Localization of single events, waveform extrac.: Spike features (such as peak to peak distance and full-width half max) are extracted from waveforms, e/i sorting: excitatory and inhibitory cell sorting, validation: validation of cell-type sorting (+) = ground truth validation via intracellular recordings, but not e/i validation, experim. prot.: integrates an experimental protocol to allow for network manipulation, unsuper.: unsupervised, requiring no manual user-intervention, source code available: entire code is open-source and available.

Here, we introduce spikeMAP, an open-source, unsupervised and scalable spike sorting analysis pipeline which performs cell-type classification as validated on high density MEAs. Crucially, we tightly integrate our analysis with an experimental protocol utilizing a stabilized step function opsin to dynamically probe distinct populations and validate sorting while avoiding the light-induced artefacts common on CMOS-based chip designs (Fiscella et al., 2012). Our analysis pipeline, taking advantage of dense sampling, estimates cell-body location for each detected spike, yielding well separated clusters associated with single neurons. Spike waveform features were extracted utilizing signal interpolation to estimate half-amplitude and peak-to-peak durations. These values were then entered in a principal component analysis with k-means clustering to identify uncorrelated signals from single channels on the array. Optimal separability of clusters was assessed by linear discriminant analysis. Each channel’s source location was identified using spatiotemporal characteristics of spike waveforms across the array. We further classified cells as putative excitatory or inhibitory based on their waveform properties. As a final validation, we introduced a method taking advantage of long timescale optogenetics (step function opsins) to perform cell-type-specific stimulation in acute prefrontal cortex slices from mice, providing a biological verification to our statistical methods. Together, spikeMAP provides a comprehensive toolkit for experimenters to flexibly interrogate cell type-specific computations in a variety of neural circuits throughout the brain.

Results

Spike sorting

Our spike sorting pipeline (Figure 1) performs three main tasks: (i) the detection of voltage deflections associated with putative somatic spikes, (ii) the identification of individual putative neurons using spike clustering, and (iii) the spatial localization of single cells in high-density recordings. We demonstrate the use of this pipeline through targeted high-density recording from medial prefrontal cortex of mouse (Figure 2A; see Materials and Methods). First, putative spike times were detected as threshold crossings (Figure 2Bi; Lewicki, 1998), identifying negative signal peaks from the mean of the filtered signal (see Materials and Methods). Optimal threshold choice is key in discriminating spikes from noise, as the number of spikes detected per electrode is highly dependent on the threshold used (Figure 2C). Here, the optimal threshold for detection was selected by fitting the voltage histogram of each channel with a Gaussian distribution to separate spiking activity from normally distributed noise (Figure 2D). To avoid multiple detections of the same event, an absolute refractory period was imposed to discard successive events within <2 ms. Although filtering is crucial in event detection, it can introduce signal distortion (Yael and Bar-Gad, 2017). To resolve this issue, the unfiltered voltage around the time of each spike was extracted (Figure 2Bii), yielding a series of high-frequency (18 kHz) waveforms for each channel.

Workflow diagram of the proposed method.

(A) Filtering of the data is achieved through bandpass filtering (300 to 5000 Hz). Spike detection is done on filtered voltages, however raw voltages around each spike to avoid signal distortion. (B) Spike sorting on each electrode. (Bi) Events are detected using a threshold method (6 SD from the mean of the filtered signal). (Bii) PCA and k-means on individual waveforms (k = 2) (C) Precise soma location on the array. (D) Excitatory and inhibitory sorting. (Di) Spike time constants kinetics are extract at the full width at half maximum and peak to peak distances. (Dii) Interpolated voltage for increased resolution (Diii) k-means to distinguish cell-type based on their waveform kinetics.

Isolation of single-cell action potential for each electrode.

(A) Multielectrode array recording set up (B) Extracellular voltage on a single electrode (Bi) Spike detection on filtered voltage (Bii) Raw voltage extraction around detected spike (C) Firing rate per electrode depends on threshold selection. Inset shows firing rate values at the selected threshold (4 SD) D) Threshold selection to part cellular activity from normally distributed noise (E) Spike sorting on a single electrode (F) Current sink signal from single neuron spans multiple electrodes (4 different neurons are shown in different colors) (G) Histogram distribution of ten-fold cross-validation with chance performance indicated in red for all electrodes in a single recording. (H) Voltage amplitude as a function of distance from highest electrode peak, inset shows the directions measured from the center electrode(I) Center of mass location of all spikes for a single soma, mean is indicated in red.

In high density preparations, a single electrode can report the activity of multiple cells. To address this issue, we employed a principal component analysis on the identified spike waveforms from individual channels (Rossant et al., 2016), which revealed distinct clusters putatively corresponding to individual cells (Figure 2E), indicating that more than one neuron likely contributes to the voltage recorded on some channels. Next, we employed a k-means cluster analysis to extract clusters amongst the principal components. To determine how well the data was separated by this approach, we applied a linear discriminant analysis (LDA) to the labeled principal components (Hill et al., 2011), allowing our method to remain completely unsupervised.

To ensure the activity of each single cell was only reported once, we set a radius of 250 µm around the electrode where a given cell was detected. This radius corresponds to the approximate spread of extracellular electrical field around the soma of individual neurons (Jia et al., 2019). Within this radius, the channel with the largest negative deflection in mean waveform was identified. Previous work observed that the largest negative amplitude of extracellular signal originates from the axon initial segment (AIS) (Bakkum et al., 2019; Obien et al., 2015). Utilizing spatial localization of the AIS, the channel showing the greatest negative deflection was likely the closest to the putative soma of a given cell (Jia et al., 2019). Activity at this channel was consistent with the somatic activity, showing a decay in peak voltage as we moved away from the putative soma (Figure 2H; Ruz et Schultz, 2014; Pettersen and Einevoll, 2008; Linden et al., 2011; Mechler et al., 2011). Visualization of adjacent electrodes revealed a complex structure of voltage activity, possibly due to activity propagation within the compartments of single neuron (Figure 2F; Shein-Idelson et al., 2017; Obien et al., 2015). To further verify that single cells located near the same electrode could be distinguished, we estimated the precise soma locations between adjacent recording electrodes using a center-of-mass analysis (see Materials and Methods). This revealed subtle changes in position, reflected by distinct weights on each nearby electrodes (Figure 2I. Despite these subtle changes, the soma location could still be assigned to same electrode since changes in localization across spikes were far less than the inter-electrode distance.

Cell type classification based on action potential waveform kinetics

Despite technological advances, the ability to identify distinct cell types based solely on extracellular voltage has remained challenging. Current data processing methods often rely on waveform kinetics (Bathó et al., 2004) to return a classification of contributing excitatory and inhibitory units. As technological progress continuously allows for denser arrays, waveform spike analyses are increasingly sensitive to noise (contamination? Better than noise?) generated by the signal of proximal units. Here, we first implemented a classification method using current knowledge about cell-type specific waveform kinetics and spline interpolation to distinguish putative excitatory and inhibitory neurons in dense networks. We then validated this classification using a combination of viral strategies, optogenetics and pharmacology while simultaneously recording from stimulated mouse prefrontal cortex networks.

To provide a more precise description of the shape of each spike, we first fitted each waveform using piecewise cubic spline interpolation, a method allowing for the statistical inference of points within the boundaries of a set of known points. While several interpolation bases are possible, cubic splines allow for smooth interpolation between known data points and a high accuracy in terms of curve fitting (Ramsay & Silverman, 1997). Using query points at 90 kHz, we computed the mean fitted waveform (Blanche, 2006) for each putative cell (see Materials and Methods).

Next, we identified putative excitatory and inhibitory neurons using two time constants obtained from mean spike waveforms at somatic locations: (1) the full width (FW) of spikes at half-maximum amplitude; and (2) the peak-to-peak (PP) duration (Figure 3A). (Sirota et al., 2008; Sakata & Harris, 2009, Barthó et al., 2004; Insel & Barnes, 2015). Although some work has cast doubt on the accuracy of spike-width based classification (Moore and Wehr, 2013), many studies have shown good classification accuracy (Nowak et al., 2003; Kawaguchi and Kubota, 1997; Barthó et al., 2004; Madisen et al., 2012; Stark et al., 2013; Cardin et al., 2009; Cohen and Mizrahi, 2015). K-means clustering was performed on values of FW and PP obtained across all simultaneously recorded somatic electrodes, where the optimal number of clusters was chosen with a Calinski-Harabasz criterion (Calinski and Harabasz, 1974; Vendramin et al, 2009). For validation purposes, strict criteria were applied at each step of the pipeline, resulting in the low the number of neurons reported here. Clusters corresponding to putative excitatory (E) and inhibitory (I) neurons were identified based on FW and PP values (Figure 3A). I cells were identified as a single cluster with rapid time constants for both FW and PP (Barthó et al., 2004). We extracted the putative soma locations of excitatory and inhibitory neurons on the MEA (Figure 3B), and visualized firing activity in a raster plot (Figure 3C). Other properties of putative I cells were consistent with past work, including a higher Fano factor (Figure 3D; Becchetti et al., 2012) and a rapid spatial decay of pairwise correlation (Figure 3E; Peyrache et al., 2012). These results extend previous findings to large-scale recordings, yet a ground-truth validation of cell type is still required to assess the extent to which this approach offers a reasonable proxy of biological identity, as examined next.

Identification of putative excitatory and inhibitory units.

(A) Distinct waveform kinetics for E and I cells (B) Respective cell location (C) Raster plot of E and I activity. (D) Fano factor for putative E and I cells. The shaded area represents the standard error of the mean (SEM).The x-axis shows temporal bins of increasing durations employed to compute the fano factor (E) Mean cross-correlation as a function of spatial distance between pairs of electrodes. Non-overlapping bins of 100 ms were employed to compute correlations. The resulting values were averaged by spatial distance between all pairs of neurons.

A step-function opsin validation approach for cell classification

While multielectrode arrays have allowed the simultaneous recording from thousands of electrodes, the use (reliance?) of light-sensitive complementary metal-oxide-semiconductor (CMOS) circuits has limited the ability of researchers to use them in conjunction with optogenetics. As the ability to rapidly perturb distinct populations in large network provides valuable insight as to how local circuits represent information (Lemon et al., 2021; Buzsáki, 2010), it is of broad interest to validate methodologies that allow for optogenetic manipulation of defined cell populations in multielectrode arrays.

We validated an experimental protocol using a stabilized step-function opsin (Bi-stable neural state switches; Berndt et al., 2009), which is activated in a step-like fashion for prolonged periods (minutes) by brief photostimulation with blue light and inactivated by green-yellow light. This viral and optogenetic strategy, used in conjuncture with CMOS based multielectrode arrays, allows for the monitoring of induced spiking beyond the initial light-generated artefacts (Supplemental Figure 1). We demonstrated this by inducing spiking selectively in targeted PV inhibitory neurons, as more than 90% of them have been reported to be fast-spiking (Stringer et al., 2016), to verify whether cells previously identified as putative inhibitory interneurons indeed correspond to light-activated cells.

As an obligate validation step, we injected a viral vector expressing the step function opsin, pAAV-Ef1a-DIO hChR2 (C128S/D156A)-EYFP, in medial prefrontal cortex of mice, and after waiting 2-3 weeks for transfection, performed whole-cell recordings from pyramidal neurons located near identified PV interneurons using in vitro slice preparations (Figure 4A; see Materials and Methods). Photostimulation with blue light was sufficient to activate PV interneurons, as monitored by the robust, rapid and consistent appearance of light-induced inhibitory synaptic postsynaptic currents (IPSCs) recorded from pyramidal neurons (note the absence of direct photocurrent from these cells; Figure 4B). The subsequent delivery of short pulses of yellow light reduced the frequency of IPSCs onto recorded pyramidal neurons, indicating that the step-function opsin could be reliably activated and inactivated in a step-like manner by phasic delivery of light (Figure 4B). Upon PV photoactivation, recorded pyramidal neurons reliably received high-frequency barrages of 10 to 30 pA IPSCs, followed by a gradual reduction in amplitude and elevated rates of inhibitory input that persisted until deactivation with green-yellow light, reflecting some desensitization of the step-function opsin (Figure 4B).

Validation of step-function opsin by whole-cell recordings.(A) Visually identified PV neuron (B) Nearby pyramidal neuron receiving inhibitory currents following PV opto activation (C) IPSCs onto pyramidal cell with 20 s rest between trial (D) IPSCs onto pyramidal cell with 60 s rest between trial (E) IPSCs onto pyramidal cell with 120 s rest between trial

To characterize the refractory period of the step-function opsin, we delivered repeated photostimulation at various inter-trial intervals and measured steady-state activation (Figure 4C to E). Longer inter-trial intervals (≥120 seconds) (Figure 4E) allowed expressing cells to recover and prevented the reduction in steady-state activation observed with 20-second and 60-second inter-trial intervals (Figure 4C and D). Specifically, the mean IPSCs/s for 20-second, 60-second, and 120-second intervals were 12.64 ± 0.27, 17.32 ± 0.15, and 26.29 ± 0.31, respectively. Statistical comparisons, performed using the Wilcoxon rank sum test for non-parametric data on the PSTH, revealed significant differences between the 20-second and 120-second conditions (P = 1.29 × 10⁻⁶, n = 4500 and 3000 trials, respectively) as well as between the 60-second and 120-second conditions (P = 0.032, n = 3000 trials per condition). The number of trials conducted for each condition was 5 for 20 seconds, 6 for 60 seconds, and 6 for 120 seconds.

Furthermore, the reduction in firing rate upon opsin deactivation was more prominent for longer interval trials (Figure 4E). These results provided key insights to inform multielectrode array recording protocols, allowing us to selectively activate and inactivate PV interneurons in a temporally precise fashion using tools compatible with multielectrode array technology.

Optogenetic validation of E/I classification on multielectrode arrays

To validate our prior waveform-based cell-type classification in mouse prefrontal cortex slices, we selectively activated transfected PV interneurons with the step-function opsin construct while performing multielectrode recordings. To prevent the propagation of optogenetic activation throughout the network, we first recorded in the presence of 10 μM cyanquixaline (CNQX) and 100 μM picrotoxin (PTX) to block AMPA receptors and GABAA receptors, respectively (leading to a reduction in FR of 0.0937Hz, p < 0.001 from baseline). We photostimulated with brief 100 millisecond pulses of blue light and examined post-stimulation responses of all identified neurons recorded (n = 8189, 3 slices, from 3 mice) (Figure 5A). In the presence of synaptic blockers, optogenetic activation of targeted PV interneurons led to a significant increase in mean firing rate for the population of cells that had been classified as inhibitory based on their waveform properties (I neurons; Figure 5B, n = 430, p < 0.003). Neurons classified as excitatory neurons based on their waveform kinetics, on the other hand, showed only a subtle decrease in mean firing rate (Figure 5B, n = 7759, p < 0.001). The overall firing rates in slice recordings were relatively low and thus, were not permissive to the use of cross-correlations in validating putative excitatory and inhibitory neurons. While our pharmacological manipulations attempted to largely eliminate network effects, the slight reduction in firing rate of putative excitatory neurons may reflect the involvement of GABAB receptor-mediated inhibition (Kohl & Paulsen, 2010).

Optogenetic targeting of inhibitory cells for spike sorting.

(A) Average firing rate for putative excitatory and inhibitory neurons. The shaded area represents the SEM. (B) Quantification of change in firing rate in panel A (C) Delta change in firing rate (on – drugs) (D) Opto-evoked change in firing rate

Next, we examined in further detail the response profiles of individual neurons to photostimulation in order to validate our algorithm at the single cell level. In the absence of synaptic blockers (right?), individual neurons displayed a diverse range of responses to light stimulation, including neurons showing no significant change in firing rate (ΔFR ∼ 0), neurons showing an increase in firing rate (ΔFR > 0), and neurons showing a decrease in firing rate (ΔFR < 0) (Figure 5C). We applied a strict criterion to separate neurons showing a statistically robust increase in firing rate (see Materials and Methods). We found that 56% of neurons that had been classified as I displayed a light-induced increase in firing rate. Conversely, we found that only 8% of neurons which had been classified as E showed an increase in firing rate after photostimulation. The percentage of I cells responsive to light may be influenced by our viral strategy, which targets only a subset of PV-expressing interneurons largely located in the infralimbic and prelimbic cortical subregions. Additionally, non-PV inhibitory interneurons, and some excitatory neurons could have been initially classified as inhibitory based on their waveform properties. These experiments, however, unambiguously identified a subset of genetically-identified PV neurons: those that showed a transient photostimulation-induced increase in firing rate. Through a comparison with FWHM and PTP features, these results demonstrate that a step-function opsin approach is a viable and scalable method for validating spike waveform classification on multielectrode arrays.

Together, this provides evidence for cell classification of excitatory and inhibitory neurons based on their extracted waveform properties using spikeMAP, showing that cells identified as inhibitory displayed optogenetic-specific change in responses.

Discussion

Extracellular electrophysiological recordings have allowed to monitor the spiking of thousands of neurons simultaneously. To meaningfully interpret these dynamics, spike sorting is a crucial step in the analysis of those recordings. The analysis of network dynamics can be severely impacted by improper interpretation of the underlying neural activity (Rey et al., 2015; Carlson and Carin, 2019), highlighting the need for optimal methods. With technological progress constantly allowing for denser arrays, assigning spikes to single cells and determining cell-type identity requires an automated solution given that the size of the data prevents manual intervention (curation?). Most spike sorting methods are at least somewhat supervised (Marre et al., 2012; Prentice et al., 2011), which is not feasible on large-scale arrays. Here, we described an open-source, unsupervised, and scalable suite of computational tools that perform spike sorting and cell type classification on large-scale, high-density recordings. We integrated our analysis pipeline with an experimental protocol, allowing for the validation of our statistical method and for the optogenetic manipulation of distinct cell-types in dense networks.

Previous work has detailed cell-type classification based on waveform analysis, but experimental validation has been lacking. To address this and provide biological evidence that this classification indeed correlates with cell-type, we selectively activated PV interneurons using a combination of viral strategies and optogenetics while simultaneously recordings from the whole network. Analysis of optogenetically stimulated trials revealed that cells that had been classified as inhibitory were more likely to display a change in firing rate during optogenetic stimulation.

We found that clustering in two dimensions, representing the full width of spikes at half-maximum amplitude and the peak-to-peak, achieved a high level of success in classifying cell-types. By sampling electrodes from PV-positive transfected cells, we distinguished their action potentials from other cell-types. Although several measures were useful in detecting cell-types, k-mean clustering of spike waveform properties best differentiated the two principal classes of cells. Our work provides evidence that extracellular recordings can offer insights on the distinct neuronal populations that make up complex networks. Our pipeline encourages the integration of viral strategies, optogenetics and electrophysiological recordings to manipulate complex networks to better understand the contribution of each cell type.

Cortical inhibitory neurons are heterogeneous, and the fact that fast-spiking PV interneurons represent the largest population exhibiting landmark features of narrow-spike made them an attractive candidate to validate our classification. However, future work including different inhibitory interneurons could help improve the classification of all inhibitory cell types. Nevertheless, it is possible that distinguishing all inhibitory cell types based on extracellular waveforms alone may not be achievable. Despite this limitation, incremental advancements such as those presented here are crucial for refining our understanding and improving analytical approaches. Given that spike sorting features in vitro can differ from properties exhibited in vivo (Henze et al., 2000; Nowak et al., 2003; Gonzalez-Burgoset al., 2005), future work should address if these classification/waveform properties can be generalized to behaving organisms, for example with tetrodes, optrodes or implanted eletrode arrays.

In sum, our work described a fully integrated method with an open-source, unsupervised and scalable spike sorting analysis pipeline performing cell-type classification, integrated with an experimental protocol utilizing a stabilized step function opsin to validate sorting on large-scale MEAs. These tools collectively provide a framework for investigating large-scale neural dynamics of genetically defined neural populations.

Materials and Methods

Animals

PV-CRE mice were kept on a 12:12-h light/dark cycle, with access to food and water ad libitum. All experiments and procedures were performed in accordance with approved procedures and guidelines set forth by the University of Ottawa Animal Care and Veterinary Services (protocol # 3471).

Stereotaxic Injections

For stereotaxic injections, P21 mice were injected with 0.05 mg/kg buprenorphine and anesthetized by inhalation of isoflurane. Injections were performed using a 10-μL Hamilton syringe with a 33-gauge needle, and 1 μL was injected per coordinate. Stereotaxic coordinates are as follows, from the bregma landmark: mPFC [anterior–posterior (AP), +2.4 —> +2.6; medial–lateral (ML), ± 0.42; dorsal–ventral (DV), -1.5 —> -1.8]. The DV coordinate was calculated from the surface of the pia. For ChR2 expression, 400 nL of pAAV-Ef1a-DIO hChR2 (C128S/D156A)-EYFP was injected, per site, (bilaterally) and animals were left to recover for 2–3 weeks before ex vivo electrophysiological recordings.

Slices

mPFC slices were prepared from 35 to 42 day old PV-CRE mice, 2–3 weeks poststereotaxic injections. For slice preparation, mice were anesthetized by inhalation of isoflurane (Baxter Corporation) and killed by decapitation. The brain was removed, and coronal brain slices were sectioned while immersed in an ice-cold choline chloride-based cutting solution of the following composition: 119 mM choline-Cl, 2.5 mM KCl, 1 mM CaCl2, 4.3 mM MgSO4-7H2O, 1 mM NaH2PO4, 1.3 mM sodium L-ascorbate, 26.2 mM NaHCO3, and 11 mM glucose, and equilibrated with 95% O2 and 5% CO2. Slices were recovered in a chamber containing standard artificial cerebrospinal fluid solution (aCSF) of the following composition: 119 mM NaCl, 2.5 mM CaCl2, 1.3 mM MgSO4-7H2O, 1 mM NaH2PO4, 26.2 mM NaHCO3, and 11 mM glucose, at a temperature of 37 °C, continuously bubbled with a mixture of 95% O2 and 5% CO2. Slices were recovered for 1 h in the recovery chamber and equilibrated to a temperature of ∼25 °C before the recordings were performed. The tissue was continuously perfused with fresh aCSF. The recordings shown in this paper were 24 minutes long and were as follow: baseline (2 mins), opto-on (2 mins), opto-off (2 mins), CNQX wash-on (5 mins), CNQX + opto-on (2 mins), CNQX + opto-off (2 mins), PTX wash-on (5 mins), CNQX and PTX + opto-on (2 mins), CNQX and PTX + opto-off (2 mins). MEA-chip baseline (no slice) were recorded (30 secs) as control prior to adding each slice. Slices were imaged on the multi-electrode array and preserved for immunohistochemistry verification of virus expression site.

Whole-Cell Electrophysiology

Neurons were visualized for whole-cell recordings using an upright microscope: BX61WU upright microscope (60X, 1.0 NA objective; Olympus, Melville, NY). PV neurons were visually identified by EYFP expression. Whole-cell recordings were performed using borosilicate glass patch electrodes (3–6 MΩ; World Precision In-struments) pulled on a Narishige PC-10 pipette puller. Electrical signals were recorded using an Axon Multiclamp 700B amplifier, filtered at 2 kHz, and digitized at 10 kHz with an Axon Digidata 1440A digitizer. All experiments were performed at room temperature in Ringer’s solution containing (in mM) 119 NaCl, 2.5 CaCl2, 1.3 MgSO4-7H20, 1 NaH2PO4, and 26.2 NaHCO3, and 11 glucose saturated with 95% O2 and 5% CO2 (pH 7.3, 295–310 mOsm/L). Electrodes were filled with an intracellular solution of the following compositions (in mM): 115 K-gluconate, 20 KCl, 10 HEPES, 4 ATP-Mg, 0.5 GTP, 10 Na-phosphocreatine (pH = 7.2-7.3; 270-290 mOsm/L).

Multielectrode array recordings

Extracellular voltage was recorded using High-Density Multi Electrode Arrays (HD-MEAs) from 3 Brain, Switzerland (www.3brain.com). A detailed description of the technology behind this system can be found in Imfeld et al.,(2008) and in Berdondini et al.,(2009). High density recordings from the mouse’s prefrontal cortex were performed in vitro using the BioCAM X platform with HD-MEA Arena chips (3Brain GmbH, Switzerland). This system records using 4,096 square microelectrodes (pitch = 42 μm) positioned in a 64 x 64 layout (2.67mm x 2.67mm area) with a sampling rate fs of 18 kHz when recording from the entire 64 x 64 array. Activity was recorded at 12 bits resolution per channel. The data was visualized and acquired with the BrainWaveX software provided by 3Brain.

Spike sorting

A code library for SpikeMAP in Python and Matlab is available as open source software from: https://figshare.com/articles/software/_b_SpikeMAP_An_unsupervised_spike_sorting_pipeline_for_cortical_excitatory_and_inhibitory_neurons_in_high-density_multielectrode_arrays_b_/28458749

Filtering

The extracellular voltages recorded by multielectrode arrays typically reflect the dynamics of multiple cells in proximity to a given electrode (Rey et al., 2015), raising the problem of how to isolate individual units. The unfiltered voltage at individual channels was characterized by sharp deflections (Figure 2Bi) that are typical of in vitro extracellular activity in spontaneously active cortical circuits (Hemberger et al., 2019). As a necessary first step to isolate individual units, we filtered the extracellular voltage using a second order Butterworth bandpass filter (300-5,000 Hz) (Figure 2Bii) to remove slowly changing field potentials and high frequency noise (Bullman et al., 2019). Recording artefacts (voltage deflection > +-500 uV) were removed and set to the mean voltage.

Spike detection

Putative spike times were detected using a voltage-threshold method (Lewicki, 1998), identifying negative signal peaks below a threshold of x standard deviation (SD) from the mean of the filtered signal. Here, x is calculated for each recording, by plotting the filtered voltage histogram for each channel and fitting it with a Gaussian curve to determine the SD value at which non-normal, putative spike-related activity is found. An absolute refractory period was applied and successive events within <2 ms were discarded. Next, the unfiltered voltage around the time of each spike (from -5 to +5 ms) was extracted (Figure 2Bii), yielding a series of high-frequency (18 kHz) waveforms for each channel. For the data shown here, all 3 recordings used had x = 4.5 SD

Isolation of single units

To isolate single-cell activity, we employed a principal component analysis on individual channels, which revealed distinct clusters putatively corresponding to individual cells (Figure 2E). Next, clusters amongst the principal components of rrSVD were extracted using a k-means cluster analysis (k=2) (Xu and Wunsch, 2005). A linear discriminant analysis (LDA) was then applied to the labeled principal components (Hill et al., 2011) to determine how well the data were separated by this approach. LDA provides an estimate of linear classification error between the two clusters assuming equal class covariance. Ten-fold cross-validation was employed, where chance corresponds to an error estimate of 0.5 (Figure 2G). Clusters with error lower than chance were merged by applying the same label to all waveforms. Each cluster was considered as a putative neuron.

Center-of-mass triangulation

In order to precisely estimate soma locations between each recording electrode, we used a center-of-mass analysis (Muthmann et al., 2015; Hilgen et al., 2017). For each putative soma identified previously, a 3-by-3 matrix with elements aij was constructed by extracting the waveforms on adjacent electrodes. Location (2,2) of this matrix was the amplitude of the negative peak in mean waveform of the somatic electrode. Surrounding locations were populated with the amplitude of the negative peaks of all electrodes immediately adjacent to the somatic electrode. The row of the center-of-mass is given by

and the column is

Spline Interpolation

The mean waveform for each single cell were resampled at a higher rate using a piecewise cubic spline interpolation (Matlab R2015b), constructing new points within the boundaries of a set of known points using query points at 90 kHz.

E/I Classification

We used a combination of cell-type specific viral strategies and optogenetics to address cell-type distinction. We injected PV-CRE mice (B6.Cg-Pvalb<tm1.1(cre)Aibs>/J) with a stabilized step-function opsin (pAAV-Ef1a-DIO hChR2 (C128S/D156A)-EYFP) bilaterally in the medial prefrontal cortex (mPFC) (Berndt et al., 2009). This allows for selective, prolonged activation of parvalbumin (PV) interneurons with a 100 ms pulse of 465 nm blue light and deactivation with a 10 s pulse of 545-580 nm green-yellow light. Next, we computed a z-score for each neuron corresponding to photostimulation-evoked change in firing rate, expressed in units of SD from the baseline mean (Figure 5D). We isolated cells showing a robust increase in firing rate (z score >3). A total of (n = 8189, 3 slices, from 3 mices) were classified in this fashion. Overall, 7759 (94.75 %) were reliably classified as excitatory and 430 (5.25 %) were reliably identified as inhibitory.

LED Photostimulation

LED photostimulation was delivered using a PlexBright LED module and controller (465 nm; Plexon). Light was delivered through a 200-μm patch fiber cable with a bare fiber tip with ∼1 cm of glass exposed. Photodeactivation was delivered using a yellow activation wideband 545-580 nm filter (BP545-580; Olympus).

Immunohistochemistry

Brain slices used for immunohistochemistry were prepared from 35 to 42 day old mice with 1× PBS used as the solvent for all solutions. Mice were anesthetized by inhalation of isoflurane. They were then intracardially perfused with with 5mL of PBS pH=7.4 followed by 10mL of 4% paraformaldehyde/ 0.1M PBS, pH 7.4 for 10 min. Postfixation in 4% PFA was carried out for 2 h before sequential cryoprotection steps in 15% and 30% sucrose over the course of 2 d. Brains were frozen in −30 °C isopentane, mounted in cryomatrix, and cut to 40-μm slices on a cryostat (CM 3050S; Leica). Free-floating sections were blocked in 0.5% PBS-Triton-X-100 (TX-100) for 45 min, and incubated in primary anti-body against GFP (GFP-1020; 1:1000, AvesLabs) in blocking solution at 20 °C. On the following morning, slices were washed three times, for 5 min each time, with 0.5% PBS-Triton-X-100 before incubation in the secondary antibody goat anti-chicken–conjugated AlexaFluor 488 (Jackson Labs, 703-546-155) for 3 h at room temperature. Slices were washed with 0.1% Tx-100 three times, for 5 min each time, before mounting onto slides with Vectashield (Vector Labs). Additionally, all slices used for recordings were saved, kept immerged in Formalin 10% in PBS pH=7.4, for immunohistochemistry to verify viral expression. The protocol is the same as above.

Supplemental Figures

Light artefact in a recording from mouse prefrontal cortex showing that the application of a brief (1 ms) pulse of light leads to saturation lasting about 5 ms post-stimulation.

Acknowledgements

This work was supported by a discovery grant from the Natural Sciences and Engineering Council of Canada (NSERC grants 210977; 210989; 2020-06901), the Canadian Institute for Health Research (175325) by the Fonds de recherche du Québec in Nature and technologie (doctoral scholarship), by the Natural Sciences and Engineering Council of Canada (NSERC CGS M scholarship) and the University of Ottawa Brain and Mind Institute.