flatironinstitute / ironclust

Spike sorting software being developed at Flatiron Institute, based on JRCLUST (Janelia Rocket Cluster)
Apache License 2.0
28 stars 7 forks source link

IronClust logo

IronClust

Terabyte-scale, drift-resistant spike sorter for multi-day recordings from high-channel-count probes

Getting Started

Probe drift handling

IronClust tracks the probe drift by computing the anatomical similarity between time chunks (~20 sec) where each chunk contains approximately equal number of spikes. For each chunk, the anatomical snapshot is computed from the joint distribution bwteen spike amplitudes and positions. Based on the anatomical similarity, each chunk is linked to 15 nearest chunks (self included) forming ~300 sec duration. The linkage is constrained within +/-64 steps (~1280 sec) to handle rigid drift occuring in faster time-scale while rejecting slower changes. The KNN-graph between the spikes is constrained to the linked chunks, such that the neighborhood of spikes from a given chunk is restricted to the spikes from the linked chunks. Thus, drift-resistance is achieved by including and excluding the neighbors based on the activity-inferred anatomical landscape surrounding the probe.

Prerequisites

Installation

Quick tutorial

This command creates irc2 folder in the recording directory and writes output files there.

irc2 `path_to_recording_file`

Examples

irc2 [path_to_my_recording.mda] (output_dir)  # for .mda format
irc2 [path_to_my_recording.imec#.bin] (output_dir)  # for SpikeGLX Neuropixels recordings (requires `.meta` files)
irc2 [path_to_my_recording.bin] [myprobe.prb] (output_dir) # specify the probe file, output to `myprobe` the recording directory
irc2 [path_to_my_recording.dat] [myprobe.prb] (output_dir)  # for Intan (requires `info.rhd`) and Neuroscope (requires `.xml`) format

IronClust caches the path_to_prm_file for subsequent commands. To display the currently selected parameter file, run

irc2 which

To select a parameter file (or a recording file):

irc2 select [path_to_my_param.prm]
irc2 select [path_to_my_recording]

Rerun using new parameters (up to four parameters can be specified, no spaces between name=value pairs):

irc2 rerun [path_to_my_param.prm] [name1=val1] [name2=val2] [name3=val3]
irc2 rerun [name1=val1] [name2=val2] [name3=val3] [name4=val4]  # uses a cached parameter file

To visualize the raw or filtered traces and see clustered spikes on the traces, run (press 'h' in the UI for further help)

irc2 traces [path_to_my_recording] 
irc2 traces [path_to_my_param.prm]

Manual clustering user interface

irc2 manual [path_to_my_recording] 
irc2 manual [path_to_my_param.prm]

This command shows the parameter file (.prm extension) used for sorting

irc2 edit `path_to_recording_file`

To select a new parameter file, run

irc2 select `path_to_prm_file`

You can re-run the sorting after updating the sorting parameter by running

irc2 `path_to_recording_file`

IronClust only runs the part of sorting pipeline affected by the updated parameters.

You can initialize the sorting output by running either of the following commands:

irc2 clear `path_to_recording_file`
irc2 clear `output_directory`
irc2 clear `path_to_prm_file`

Importing multiple .bin files from SpikeGLX

irc2 import-spikeglx [path_to_my_recording.bin] [path_to_probe_file.prb] (path_to_output_dir)

Importing multiple .dat files from Intan RHD format

irc2 import-intan [path_to_my_recording.bin] [path_to_probe_file.prb] (path_to_output_dir)

Deployment

Export to Phy

Export to Phy for manual curation. You need to clone Phy and set the path path_phy_x where x={'pc,'mac','lin'} to open the output automatically.

irc2 export-phy [path_to_prm_file] (output_dir)   # default output location is `phy` under the output folder

If Phy doesn't open automatically, run the following python command to open Phy

phy template-gui path_to_param.py

Export to Klusters

Export to Klusters for manual curation. You can set the path path_klusters_x in user.cfg where x = {'pc', 'mac', 'lin'} to open the output automatically.

irc2 export-klusters [path_to_prm_file] (output_dir)

If Klusters doesn't open automatically, open Klusters GUI and open .par.# file (#: shank number).

Export to JRCLUST

Export to JRCLUST for manual curation. You need to clone JRCLUST and set the path path_jrclust in user.cfg (you need to create this file if it doesn't exist).

irc2 export-jrclust [path_to_prm_file]

If JRCLUST doesn't open automatically, run jrc manual [my_jrclust.prm]

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

To display the current version, run

irc2 version

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments