A Framework for the Comparative Assessment of Neuronal Spike Sorting Algorithms towards More Accurate Off-Line and On-Line Microelectrode Arrays Data Analysis

Neuronal spike sorting algorithms are designed to retrieve neuronal network activity on a single-cell level from extracellular multiunit recordings with Microelectrode Arrays (MEAs). In typical analysis of MEA data, one spike sorting algorithm is applied indiscriminately to all electrode signals. However, this approach neglects the dependency of algorithms' performances on the neuronal signals properties at each channel, which require data-centric methods. Moreover, sorting is commonly performed off-line, which is time and memory consuming and prevents researchers from having an immediate glance at ongoing experiments. The aim of this work is to provide a versatile framework to support the evaluation and comparison of different spike classification algorithms suitable for both off-line and on-line analysis. We incorporated different spike sorting “building blocks” into a Matlab-based software, including 4 feature extraction methods, 3 feature clustering methods, and 1 template matching classifier. The framework was validated by applying different algorithms on simulated and real signals from neuronal cultures coupled to MEAs. Moreover, the system has been proven effective in running on-line analysis on a standard desktop computer, after the selection of the most suitable sorting methods. This work provides a useful and versatile instrument for a supported comparison of different options for spike sorting towards more accurate off-line and on-line MEA data analysis.


General Information about the Toolbox:
The toolbox was implemented in MATLAB : version 7.7.0.471(R2008b) [The Mathworks.Inc] and it is compatible up to version R2014a.
Its main aim is to provide a Graphical User Interface (GUI) to help an interested user in analyzing its own MEA data through our framework of algorithms.  Note: despite .mex and the relative .c source codes are provided, they are not actually used in the GUIs codes because their compatibility with the users' MATLAB cannot be guaranteed.
3 Thus in the codes there are the relative MATLAB versions and the commands referred to mex-files are commented. In this way the user can decide if enable the MEX_file (a compatible compiler may be necessary, see www.mathworks.com), which is especially recommended to speed up on-line analysis.

Installation:
After receiving the .zip folder containing the toolbox unzip it and add all the folders to your MATLAB path. This should provide all the functionalities to work fine.

How to Start:
In the MATLAB command window type:

>> Main_GUI
The Main_GUI will pop-up and show three buttons ( Fig.1) : The three keys stand for: 1. 'TEST data' opens the Spike sorting GUI for simulated signals analysis.   is not possible to perform the classification immediately, therefore in a following session on the same data all the information is saved and can be loaded (skip trainingà use old training).
[5] provides some graphical commands: Scatter_FE can be used right after the selection of the FE method and display the training spike in the feature space.
Plot_class allows the visualization of the spikes colored with the 'ground truth' label and the spike sorting results in the feature space and the spike waveforms colored with the found classes. The value of cluster validity index and classification accuracy are calculated and displayed.
Raster_plot shows the raster plot for each neuron sorted ISI shows the inter-spike interval histograms for each single unit sorted.
Report creates a .txt file and a .jpeg figure with the main information of the analysis (Fig. 3).
6 Finally, the 'TEST SORTING ALGORITHMS' button [6] provides an automatic comparison of all the possible combination of FE and clustering methods. The number of decomposition levels for the wavelet algorithm and the quantization level for the DCB clustering method are to be given in advance. Results are displayed in a Figure (Fig. 4).  At the end of the conversion the button turns green.
As in the test data interface, the user has to load the data (the 60 signals). The loaded signals can be plotted on the classic MEA layout (Fig. 6).
In [2] it is possible to choose the single channel to analyze (and the GUI works like the Test Data GUI one, except for the results visualization) or by selecting the option 'all Channels'.
A GUI is presented (Fig 7), which allows the user to select the channels for a simultaneous analysis (ALL selects all the 60 signals).  [3] is the spike detection panel. If it is necessary the data can be filtered and saved by checking the relative selection check boxes ( a folder for the filtered signal is created). The frequency band is settable by the user.
If the All Channel label is on, the detection results are automatically saved in a newly created directory as .mat files named 'filename_nchannel_detection' (containing t_stamps, index_stamps, template and channel firing rate and the extracted spikes).
Plot detection opens the dialog GUI in Fig. 8 to select what to plot: filtered signals in the MEA layout or the rasterplot. Spikes opens other options: the user can plot the waveforms per channel, the number of spikes (displayed also as a colored map superimposed to the MEA layout) or the firing rate per channel. All the plot are automatically saved as .jpeg figure in a directory selected by the user (which has to be different from the ones in which the detection results are automatically saved).
[4] groups the spike sorting parameters and methods selection. The chosen algorithm is applied to all the selected channels ('compute') and the results are automatically saved. For each channel the sorting result is saved as a .mat file named 'filename_nchannel_sorting' containing : ID, FE, axis, CV value, mean intracluster variance (ICV) and the sorting parameters.
As for the simulated data, the training can be saved, but only for single channel analysis and the automatic selection of feature can be matched only with K-means.

NOTE: after the spike detection it is possible to generate a report (.txt) in which there are information about the detection (parameter chosen) and the location of the results (directory path).
Using the buttons in [5] the user can visualize the sorting outcomes for every channel, like in figure 9 (top). Otherwise the command 'plot sorting' in [4] allows to plot the analysis results in the classic MEA layout or the sorted raster plot (Fig. 9, bottom) The ISI button calculates the inter-spike interval for each channel and saves the results (.mat files) for each channel.
A report can be generate reporting the main information about the completed analysis.  The GUI in Fig.10 allows to set the sampling rate, the transmission buffer length and the maximum duration (min) of a recording to be saved in a single file. Then, the START button launches a script which establishes the real-time communication with the MEA device and perform spike detection, spike sorting and storage of results. The current version is not completely automatic, in order to let an expert user to easily modify the script code to test runtimes, select which method to apply, load training data, optimize the code, etc.

Note:
Data are saved as binary files which can then be read by the "read_bin_files.m" script.