Eden-Kramer-Lab / replay_trajectory_classification

State space models for decoding hippocampal trajectories and determining their type using sorted or clusterless data
MIT License
44 stars 16 forks source link

Tutorial for using clusterless spikes, and applying this library to neuropixels #14

Closed AngCamp closed 2 years ago

AngCamp commented 2 years ago

The tutorial on data formatting for the clusterless spikes data does not make it clear what is in the data aside from nans. So when a spike is detected should there be potentials there?

Also this may be a special use case but I am trying to use neuropixels data with this library. How should I pick which channels on the probes to include? For instance I have 34 channels in CA3 region on one recoriding. Could I use all 34 or is your code built assuming you have a tetrode?

edeno commented 2 years ago

Hi @AngCamp ,

The tutorial on data formatting for the clusterless spikes data does not make it clear what is in the data aside from nans. So when a spike is detected should there be potentials there?

The clusterless data corresponds to spike waveform features. We typically use the amplitude for each wire/contact at the time of a detected spike.

Also this may be a special use case but I am trying to use neuropixels data with this library. How should I pick which channels on the probes to include? For instance I have 34 channels in CA3 region on one recoriding. Could I use all 34 or is your code built assuming you have a tetrode?

This code can theoretically be used for probe data, however practically the dimensionality of the mark space means that you need quite a lot of data to estimate the space. We are actively working on solutions to this, but you could try some sort of dimensionality reduction of the 34 channels before inputting them into the algorithm.

We have only tried using 32 channels on PFC probe data where we have much less intuition about what the decodes, so it's possible that it would work better in hippocampus...or it should be easier to validate as you should see things like replays, theta sweeps, etc. You would want to use this likelihood if you do that because it will be more numerically stable in 34 dimensions: multiunit_likelihood_integer_gpu_log.

The other thing you could try is defining smaller groupings of contacts. Not sure how that will work though.

AngCamp commented 2 years ago

Intersting also I noticed in your SWR detector it also expects a fair number of NaNs. I just realized if you only input amplitudes during confirmed spiking events (well I mean not confirmed but high confidence) then you don't have to worry about movement. So can I use your SWR detector even during movement intervals? Then I could confirm they are SWRs by showing they are occuring less frequently during high theta band and movement. Or more frequently following reward and during deliberation. Ideally often concurrently with replay.

AngCamp commented 2 years ago

Also I guess I can just use the clustered replay functions instead since I don't think I can easily get the data out of the LFP and produce the data in the format you suggest. Will I still be able to detect replay during movements?