Spike sorting with Kilosort4

Marius Pachitariu, Shashwat Sridhar, Jacob R. Pennington, Carsen StringerNature Methods 2024

TL;DR

Kilosort4 is a new, open-source spike-sorting algorithm that significantly improves the accuracy of identifying individual neuron firing times from complex neural recordings. It achieves this through novel graph-based clustering and a robust feature extraction pipeline, outperforming previous methods, especially in challenging conditions like probe drift.

What Problem Does This Paper Address?

Neuroscience research relies on understanding when individual neurons "fire" (emit electrical signals). This process, called spike sorting, is crucial for deciphering neural circuits. However, it's incredibly difficult due to:

  • Nonstationarity: The electrical signals recorded from neurons can change shape over time due to factors like probe movement (drift).
  • Dense Overlap: Neurons are packed closely together, making it hard to distinguish their individual signals, especially for neurons with weak signals or small spatial footprints.

Existing spike-sorting tools often struggle with these challenges, requiring significant manual curation and sometimes missing important data.

Methods

Kilosort4 builds upon the previous Kilosort framework but introduces key algorithmic improvements:

  • Graph-Based Clustering: The core innovation is a new clustering algorithm inspired by graph theory and modularity optimization. This approach treats data points (spikes) as nodes in a graph and identifies clusters based on how densely connected these nodes are. This is particularly effective at separating overlapping or similar signals.
  • Hierarchical Merging Tree: To refine the graph-based clustering, Kilosort4 uses a "merging tree" that incorporates domain knowledge (like refractory periods and waveform properties) to make informed decisions about merging or splitting clusters.
  • Template Deconvolution with Background Subtraction: The pipeline first extracts "templates" representing typical neuron waveforms. Crucially, it then uses these templates to subtract the influence of background noise and overlapping spikes before extracting features. This "background-subtracted" feature extraction is key to improving clustering accuracy.
  • Drift Correction: Kilosort4 retains and refines drift correction methods, essential for handling recordings where the probe moves relative to the brain tissue.

Datasets

The authors used several datasets for their work:

  • Neuropixels Datasets: Recordings from Neuropixels probes, a high-density electrophysiology tool, were used for developing and testing the algorithms. Specific datasets from N. Steinmetz and the International Brain Laboratory (IBL) are cited.
  • Realistic Simulation Framework: A novel simulation framework was developed using densely sampled electrical fields from real experiments. This framework generates nonstationary spike waveforms and realistic noise, allowing for rigorous benchmarking under controlled conditions, including various drift scenarios (no drift, medium, high, fast, and step drift).
  • Other Probe Data: Kilosort4 was also tested on data from a 64-channel linear probe and 128-channel tetrode arrays to demonstrate its adaptability.

Key Insights and Ideas

  • Graph-based clustering is powerful: The paper demonstrates that graph-based approaches, particularly those optimizing modularity, are highly effective for spike sorting, outperforming traditional methods.
  • Background subtraction is critical for feature extraction: Removing the influence of overlapping spikes before extracting features significantly cleans up the data, leading to more distinct clusters.
  • Drift is a major challenge, and Kilosort4 handles it well: The development of realistic drift simulations was crucial for testing algorithms. Kilosort4's performance degradation in high-drift conditions was significantly less than other methods.
  • Kilosort4 is robust to low-amplitude and small-spatial-extent neurons: The algorithm's ability to correctly identify even weak or spatially confined neurons is a major advancement.

Key Results

  • Kilosort4 outperforms other algorithms: Across a variety of simulated conditions, Kilosort4 consistently achieved the best performance, correctly identifying a higher percentage of ground-truth units.
  • High accuracy in drift conditions: Kilosort4 maintained high accuracy even in challenging high-drift scenarios, where other algorithms struggled significantly.
  • Improved identification of difficult units: Kilosort4 successfully identified neurons with low amplitudes and small spatial extents, which are often missed by other methods.
  • Competitive runtimes: While not the primary focus, Kilosort4's performance was achieved with reasonable computational costs, comparable to other advanced algorithms.

Limitations and Future Work

  • Drift correction timescale: In very fast drift conditions, the 2-second bin size used for drift estimation posed a slight limitation, though Kilosort4 still performed well.
  • Nonrigid motion correction: The authors noted that disabling nonrigid motion correction had a surprisingly small effect, suggesting that other steps in Kilosort4 might compensate for this. Further investigation into the interplay of these steps could be beneficial.
  • Data types and probe geometries: While Kilosort4 is adaptable, certain probe geometries (e.g., very sparse or non-vertical arrangements) or extremely large datasets might require specific considerations or further optimization.
  • Future work: The authors encourage users to continue checking results with visualization tools like Phy and suggest that computational requirements will continue to drive the development of future neural recording devices and algorithms.

Summary updated

BibTeX
@inproceedings{pachitariu2024spike,
  author = {Marius Pachitariu and Shashwat Sridhar and Jacob R. Pennington and Carsen Stringer},
  title = {{Spike sorting with Kilosort4}},
  booktitle = {Nature Methods},
  year = {2024},
  doi = {10.1038/s41592-024-02232-7},
}
Figure