MouseLand / Kilosort

Fast spike sorting with drift correction
https://kilosort.readthedocs.io/en/latest/
GNU General Public License v3.0
488 stars 247 forks source link

FEATURE: <Use saved templates from a model recording session to run kilosort on another session> #738

Closed mberns-ru closed 4 months ago

mberns-ru commented 4 months ago

Feature you'd like to see:

Hi! First of all, thank you for all the hard work you do. Kilosort has been working very well for us in our lab.

One of the biggest challenges for us right now is comparing the activity of clusters across sessions. For example, say we want to compare the spike trains of cluster n on day 1 to cluster n on day 10. Currently, when I run each recording through KS4, the clusters are reorganized. So maybe cluster 2 on day 1 = cluster 5 on day 10. It would be great to use the templates generated by KS4 on day 1 to run KS4 on the day 10 recording. That way - in theory - cluster 2 on day = cluster 2 on day 10.

Right now, I think I'm going to use some distance measure on the generated template mectrics from both recordings to figure out which clusters match up to what. But it would be great to simply use the templates from one recording to sort another recording.

Thanks!

Additional Context

No response

jacobpennington commented 4 months ago

@mberns-ru Unfortunately there is not a straightforward way to transfer clusters between sessions like that. We are in the process of incorporating tracking of units across days into the pipeline, but it's going to take a while to develop. In the meantime, there are some existing tools that might help you match up units after sorting:

https://github.com/Julie-Fabre/bombcell?tab=readme-ov-file (ecephys metrics that you could potentially use to match units) https://github.com/EnnyvanBeest/UnitMatch (toolbox for matching single units across recording sessions)