Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit 3e08594

Browse files
update readme and cartoon
1 parent 6c15f0f commit 3e08594

2 files changed

Lines changed: 29 additions & 32 deletions

File tree

README.md

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ https://github.com/AllenInstitute/ecephys_spike_sorting
1515

1616
## Overview
1717

18-
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.
1919

2020
The spikeGLX_pipeline.py script implements this pipeline:
2121

@@ -37,7 +37,7 @@ Further documentation can be found in each module's README file. For more inform
3737

3838
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.
3939

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.
4141

4242
7. [quality_metrics](ecephys_spike_sorting/modules/quality_metrics/README.md): Calculates quality metrics for each unit to assess isolation and sorting quality.
4343

@@ -59,7 +59,7 @@ These modules have been tested with Python 3.7.
5959

6060
We recommend using [pipenv](https://github.com/pypa/pipenv) to run these modules.
6161

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.
6363

6464

6565
### Install pipenv
@@ -144,27 +144,20 @@ Parameters are set in two files. Values that are constant across runs
144144
In **create_input_json.py**, be sure to set these paths and parameters for your system:
145145

146146
- ecephys_directory: parent directory that contains the modules directory
147-
148147
- kilosort_repository
149-
150148
- KS2ver -- needs to be set to '2.5' or '2.0', and be correct for the repository
151-
152149
- npy_matlab_repository
153-
154150
- catGTPath: contains the CatGT.exe file
155-
156151
- cWaves_path: contains the C_Waves.exe file
157-
158152
- tPrimePath: contains the TPrime.exe file
153+
- kilosort_output_temp (see note below)
159154

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.
161156
162157
Other “mostly constant” parameters in **create_input_json.py**:
163158

164159
- Most Kilosort2 parameters.
165-
166160
- kilosort post processing params
167-
168161
- quality metrics params
169162

170163
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
199192
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:
200193

201194
- Set variable run_CatGT = False
202-
203195
- Set variable runTPrime = False
204-
205196
- Only include mean_waveforms and quality_metrics in the list of modules to be called, e.g.
206197

198+
199+
```
207200
modules = [
208-
#'kilosort_helper',
201+
#'kilosort_helper',
209202
#'kilosort_postprocessing',
210203
#'noise_templates',
211204
#'psth_events',
212205
'mean_waveforms',
213206
'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
231228

232229
Another re-run will create a full set with _2, etc
233230

ece_pipeline_cartoon.png

53 KB
Loading

0 commit comments

Comments
 (0)