You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
The general outline of the pipeline is preprocessing, spike sorting by either [Kilosort2.5](https://github.com/MouseLand/Kilosort2) or {Kilosort 2.0](https://github.com/MouseLand/Kilosort/releases/tag/v2.0) , followed by cleanup and calculation of QC metrics. The original version from the Allen used preprocessing specifically for data saved using the [Open Ephys GUI](https://github.com/open-ephys/plugin-gui). This version is designed to run with data collected using [SpikeGLX](http://billkarsh.github.io/SpikeGLX), and its associated tools (CatGT, TPrime, and C_Waves). The identification of noise clusters is unchanged from the original code. Calculation of QC metrics has been updated to work with any Neuropixels probe type, rather than assuming NP 1.0 site geomtery.
18
+
The general outline of the pipeline is preprocessing, spike sorting by [Kilosort 3.0](https://github.com/MouseLand/Kilosort), [Kilosort 2.5](https://github.com/MouseLand/Kilosort2) or [Kilosort 2.0](https://github.com/MouseLand/Kilosort/releases/tag/v2.0) , followed by cleanup and calculation of QC metrics. The original version from the Allen used preprocessing specifically for data saved using the [Open Ephys GUI](https://github.com/open-ephys/plugin-gui). This version is designed to run with data collected using [SpikeGLX](http://billkarsh.github.io/SpikeGLX), and its associated tools (CatGT, TPrime, and C_Waves). The identification of noise clusters is unchanged from the original code. Calculation of QC metrics has been updated to work with any Neuropixels probe type, rather than assuming NP 1.0 site geomtery; also, the metrics code can now be run on phy output after manual curation.
19
19
20
20
The spikeGLX_pipeline.py script implements this pipeline:
21
21
@@ -37,7 +37,7 @@ Further documentation can be found in each module's README file. For more inform
37
37
38
38
5.[noise_templates](ecephys_spike_sorting/modules/noise_templates/README.md): Identifies noise units based on their waveform shape and ISI histogram or a random forest classifier.
39
39
40
-
6.[mean_waveforms](ecephys_spike_sorting/modules/mean_waveforms/README.md): Extracts mean waveforms from the raw data, given spike times and unit IDs. Also calculates metrics for each waveform. In this version the mean waveforms can be calculated using Bill Karsh's efficient C_Waves tool.
40
+
6.[mean_waveforms](ecephys_spike_sorting/modules/mean_waveforms/README.md): Extracts mean waveforms from the raw data, given spike times and unit IDs. Also calculates metrics for each waveform. In this version the mean waveforms are calculated using Bill Karsh's efficient C_Waves tool.
41
41
42
42
7.[quality_metrics](ecephys_spike_sorting/modules/quality_metrics/README.md): Calculates quality metrics for each unit to assess isolation and sorting quality.
43
43
@@ -59,7 +59,7 @@ These modules have been tested with Python 3.7.
59
59
60
60
We recommend using [pipenv](https://github.com/pypa/pipenv) to run these modules.
61
61
62
-
The SpikeGLX pipeline is dependent on three command line applications currently available only for Windows, and has not been tested in Linux or Mac. These instructions are for Windows 10.
62
+
All of the components of the SpikeGLX pipeline are available in Windows and Linux, but the pipeline has only been tested in Windows. These instructions are for Windows 10.
63
63
64
64
65
65
### Install pipenv
@@ -144,27 +144,20 @@ Parameters are set in two files. Values that are constant across runs
144
144
In **create_input_json.py**, be sure to set these paths and parameters for your system:
145
145
146
146
- ecephys_directory: parent directory that contains the modules directory
147
-
148
147
- kilosort_repository
149
-
150
148
- KS2ver -- needs to be set to '2.5' or '2.0', and be correct for the repository
151
-
152
149
- npy_matlab_repository
153
-
154
150
- catGTPath: contains the CatGT.exe file
155
-
156
151
- cWaves_path: contains the C_Waves.exe file
157
-
158
152
- tPrimePath: contains the TPrime.exe file
153
+
- kilosort_output_temp (see note below)
159
154
160
-
- kilosort_output_temp: for the kilosort residual file, also temporary copies of the config and master file. With kilosort 2.5, this "temporary" file -- which has been drift corrected--may be used for manual curation in phy. If you want it to be kept available, set the parameter ks_copy_fproc=1; then a copy will be made with the kilosort output and the params.py adjusted automatically.
155
+
>>> Note: The kilosort_output_temp folder contains the kilosort residual file and also temporary copies of the config and master file. With kilosort 2.5, this "temporary" file--which has been drift corrected--may be used for manual curation in phy. If you want it to be kept available, set the parameter ks_copy_fproc=1; then a copy will be made with the kilosort output and the params.py adjusted automatically.
161
156
162
157
Other “mostly constant” parameters in **create_input_json.py**:
163
158
164
159
- Most Kilosort2 parameters.
165
-
166
160
- kilosort post processing params
167
-
168
161
- quality metrics params
169
162
170
163
Read through the parameter list for **create_input_json.py** to see which parameters are already passed in and therefore settable per run from a calling pipeline script. These currently include the threshold parameter for Kilosort, switches to include postprocessing steps within Kilosort, and radii (in um) to define the extent of templates and regions for calculating quality metrics. These radii are converted to sites in **create_input_json.py** using the probe type read from the metadata.
@@ -199,35 +192,39 @@ To run scripts, navigate to the ecephys_spike_sorting\scripts directory and ente
199
192
If you manually curate your data in phy, you can recalculate mean waveforms and quality metrics for the curated clusters. You'll need to run a script that skips preprocessing and sorting, and just runs the mean_waveforms and metrics modules. The required changes in sglx_multi_run_pipeline.py are:
200
193
201
194
- Set variable run_CatGT = False
202
-
203
195
- Set variable runTPrime = False
204
-
205
196
- Only include mean_waveforms and quality_metrics in the list of modules to be called, e.g.
206
197
198
+
199
+
```
207
200
modules = [
208
-
#'kilosort_helper',
201
+
#'kilosort_helper',
209
202
#'kilosort_postprocessing',
210
203
#'noise_templates',
211
204
#'psth_events',
212
205
'mean_waveforms',
213
206
'quality_metrics'
214
-
]
215
-
216
-
When the mean_waveforms and metrics modules are rerun the first time, these output files just get preserved with their old names:
217
-
metrics.csv
218
-
waveform_metrics.csv
219
-
clus_Table.npy
220
-
221
-
These output files get renamed with an added "_0":
222
-
mean_waveforms.npy -> mean_waveforms_0.npy
223
-
cluster_snr.npy -> cluster_snr_0.npy
224
-
225
-
The new output files are numbered by the latest version. Output from the first re-run is in:
226
-
metrics_1.csv
227
-
waveform_metrics_1.csv
228
-
clus_Table_1.csv
229
-
mean_waveforms_1.npy
230
-
cluster_snr_1.npy
207
+
]
208
+
```
209
+
210
+
When the mean_waveforms and metrics modules are re-run the first time, these output files are preserved with their old names:
211
+
212
+
- metrics.csv
213
+
- waveform_metrics.csv
214
+
- clus_Table.npy
215
+
216
+
These output files are renamed with an added "_0":
217
+
218
+
- mean_waveforms.npy -> mean_waveforms_0.npy
219
+
- cluster_snr.npy -> cluster_snr_0.npy
220
+
221
+
The new output files are numbered by the latest version. Output files from the first re-run are named:
222
+
223
+
- metrics_1.csv
224
+
- waveform_metrics_1.csv
225
+
- clus_Table_1.csv
226
+
- mean_waveforms_1.npy
227
+
- cluster_snr_1.npy
231
228
232
229
Another re-run will create a full set with _2, etc
0 commit comments