Spike sorting with Kilosort4.
Pachitariu M, Sridhar S, Pennington J, Stringer C. · 2024
Read Spike sorting with Kilosort4. by Pachitariu M, Sridhar S, Pennington J, Stringer C. (2024) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/europmc-pmc11093732.txt.
Introduction
Pachitariu, Sridhar, Pennington, and Stringer present a new version of a brain signal sorting tool in this 2024 paper. Electrodes in the brain record mixed electrical spikes from many nerve cells at once. Spike sorting is the computing task of assigning each spike to one cell. It is hard because recordings drift and the fields of nearby cells overlap.
Their tool, Kilosort4, adds clustering methods inspired by graph maths, the study of linked networks. To test it fairly, they built simulations from densely sampled real recordings with realistic noise and drift. Kilosort4 beat rival tools in all tested conditions, they report. It correctly found even faint cells and tiny cells under heavy drift. Earlier versions also beat most rivals. The framework is developed openly for the field to use.
Catalog record
| CREATOR | Pachitariu M, Sridhar S, Pennington J, Stringer C. |
|---|---|
| YEAR | 2024 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 107 KB |
| LICENSE | CC BY 4.0 |
| RIGHTS | CC BY |
| SOURCE | Europe PMC |
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Spike sorting with Kilosort4 By Marius Pachitariu, Shashwat Sridhar, Jacob Pennington, Carsen Stringer Published in: Nature Methods DOI: 10.1038/s41592-024-02232-7 ABSTRACT Abstract Spike sorting is the computational process of extracting the firing times of single neurons from recordings of local electrical fields. This is an important but hard problem in neuroscience, made complicated by the nonstationarity of the recordings and the dense overlap in electrical fields between nearby neurons. To address the spike-sorting problem, we have been openly developing the Kilosort framework. Here we describe the various algorithmic steps introduced in different versions of Kilosort. We also report the development of Kilosort4, a version with substantially improved performance due to clustering algorithms inspired by graph-based approaches. To test the performance of Kilosort, we developed a realistic simulation framework that uses densely sampled electrical fields from real experiments to generate nonstationary spike waveforms and realistic noise. We found that nearly all versions of Kilosort outperformed other algorithms on a variety of simulated conditions and that Kilosort4 performed best in all cases, correctly identifying even neurons with low amplitudes and small spatial extents in high drift conditions. Subject terms: Computational neuroscience, Computational platforms and environments MAIN Classical spike-sorting frameworks require a sequence of operations, which can be categorized into preprocessing, spike detection, clustering and postprocessing. Modern approaches have improved these steps by introducing new algorithms. Some frameworks1–3 took advantage of new clustering algorithms such as density-based approaches4 or agglomerative approaches using bimodality criteria5. In contrast, the original Kilosort6 used a simple clustering approach (scaled k-means) but combined two steps of the pipeline into one (spike detection + clustering = template learning) and added an extra matching pursuit step for detecting overlapping spikes, sometimes referred to as solving the ‘collision problem’7–12. These early algorithms for large-scale electrophysiology required substantial human curation, as the clustering results were imperfect. This was mainly due to the nonstationary nature of data from real experiments. The electrical field of a unit sampled by a probe, called a spike waveform, should be fixed and reproducible across long time periods. Yet in many experiments, the shape of the waveform seemed to change over the course of hours and sometimes much faster. The main reason for these changes was identified as vertical probe movement or ‘drift’, using high-density electrodes13. Correcting for drift resulted in substantial improvements in spike-sorting performance (see Methods in ref. 13). The main goal of this paper is to describe Kilosort4 and demonstrate its performance. Some of the algorithmic steps in Kilosort4 (see Table 1 for an overview) are directly inherited from previous versions, so we do not describe them in detail here (drift correction13 and matching pursuit6). The main algorithm introduced in Kilosort4 is a graph-based clustering approach based on modularity optimization. We combined this approach with a merging tree strategy that uses meta information (such as refractory period violations and projection bimodality) to make merge/split decisions. We describe Kilosort4 in detail and benchmark it against other algorithms. [Table: The evolution of Kilosort] RESULTS At the core of Kilosort4 lies a graph-based clustering algorithm, which we describe below. Before that, however, we describe the feature extraction pipeline that provides the input to the clustering algorithm. We leave the description of the graphical user interface (GUI) (Extended Data Fig. 1) and the practical implementation details to the Methods section. [Figure: Kilosort4 graphical user interface.The GUI for Kilosort4 enables the user to load in and view the binary file both raw and whitened. Next the user runs the spike-sorting pipeline. The message log box allows the user to monitor the progress of the spike-sorting algorithm.] Template deconvolution The goals of the feature extraction pipeline (Fig. 1a) are to (1) detect all spikes, including overlapping ones; and (2) extract spike features after subtracting the influence of the background. We refer to the spike detection and feature extraction steps jointly as ‘template deconvolution’. This module generates a set of templates that correspond to the average spatiotemporal waveforms of neurons in the recording. The templates are used in the matching pursuit step for detecting overlapping spikes6. A template deconvolution step has been used in all versions of Kilosort and the background-corrected spike features have been used for visualization in Phy14. In Kilosort4, we go one step further and use the background-corrected features as inputs to a more powerful clustering algorithm. [Figure: Spike detection and feature extraction.a, Schematic of the pipeline for detecting spikes and extracting spike features. b, Short segment of preprocessed data over 70 channels and 1,000 time points (data from elsewhere16). Insets show an expanded section with multiple overlapping spikes. c, Example simple templates centered at a single position on the probe. Templates are repeated at 1,536 positions for a Neuropixels probe. d, Example learned templates centered at different positions on the probe. e, Reconstruction of the data in b based on the inferred templates and spike times. f, Residual after subtracting the reconstruction from the data. g–i, t-SNE visualization of spike features from a 40-μm segment of the probe. Spike features were extracted using either simple templates (g) or learned templates without (h) or with (i) background subtraction. j, Spatial distribution of a subset of the final extracted spikes colored by their template norm.] We illustrate the template deconvolution process using a recording shared by the Neuropixels paper15,16, containing the visual cortex, hippocampus and thalamus. First, a set of initial spike waveforms are extracted from preprocessed data using a set of simple templates that are designed to span a wide range of spatial positions, spatial sizes and waveform shapes (Fig. 1b,c and elsewhere13). The waveform shapes are extracted from the recording by k-means clustering of single-channel waveforms (Extended Data Fig. 2a). To extract features from the spikes, we use a set of principal components (PCs) identified also from the single-channel waveforms (Extended Data Fig. 2a). The spike PC features are then clustered using the graph-based algorithm from Kilosort4 (described in the next section). The centroids of the clusters are the ‘learned templates’, which are then aligned temporally (Fig. 1d). The templates are compared to each other by cross-correlation and similar templates are merged together to remove duplicates. The learned templates are then used in the matching pursuit step, which iteratively finds the best-matching templates to the preprocessed data and subtracts off their contribution. The subtraction is a critical part of the matching pursuit and allows the algorithm to detect spikes that were overlapped by the subtracted ones. Among the major current spike-sorting platforms, Kilosort is the only one that performs this subtraction, which allows it to resolve spike collisions better than all other approaches12. The final reconstruction of the data with the templates is shown in Fig. 1e. The residual is the difference between the data and the reconstruction and can be informative if the algorithm fails to find some units (Fig. 1f). [Figure: Kilosort adapts to other probes.a, Single-channel principal components (PCs) and templates identified from either the entire IBL repository (predefined), from two individual neuropixel recordings, from a 64-channel linear probe or from tetrodes. b, Eight out of 65 single units identified from a public dataset recorded with a 64-channel linear probe. (top) Waveforms across channels. Panel title represents the number of spikes for that unit. (bottom) Autocorrelograms.