Julie-Fabre / bombcell

Automated quality control, curation and neuron classification of spike-sorted electrophysiology data
GNU General Public License v3.0
123 stars 30 forks source link

Altering qualityParamValues probe_type #150

Closed ryanlash closed 2 weeks ago

ryanlash commented 1 month ago

Describe your question A short description of what you want information on. How would I adjust to account for my specific probe type? I recorded on intan RHD2000 interface software using a cambrige h6 assy 236 probe (64 channel by 2 shanks). I do have a custom made channel map.mat file that works for KS4 if that would be helpful.
Describe the resources you'd like Would any changes help to make this information clearer? (e.g. additional documentation, additional example scripts, ...) I keep on running into the issue of "Output argument "goodChannels" (and possibly others) not assigned a value in the execution with "bc.load.loadEphysData" function." If there is a way to do this for bombcell I'd love to integrate into my pipeline but if you have other suggestions that would be better for this probe type that would also be more than appreciated to. Thank you!!!

Julie-Fabre commented 1 month ago

Hi Ryan, Thanks for your message! Which spike-sorter do you use on your data? If you use kilosort, the only thing you will need to change is to set the param.gain_to_uV value to the scaling factor needed to convert your raw bit data into microvolts. This is to calculate each unit's mean raw amplitude. You can also disable this calculation if you don't find it helpful by setting param.extractRaw = 0;

I keep on running into the issue of "Output argument "goodChannels" (and possibly others) not assigned a value in the execution with "bc.load.loadEphysData" function."

Bombcell doesn't need this variable anymore, so it's not issue if it is not loaded. I've updated the code to reflect this, and there shouldn't be any errors for you anymore.

ryanlash commented 1 month ago

Hi Julie!

First this is amazing and thank you for this, it's streamlined a lot of headaches that I was having to go through and that previous error is resolved! I noticed that in loadEphyData function, KS4 also outputs spike_templates.npy so the first conditional will still load spike_templates.npy as opposed to spike_clusters.npy for spike_templates_0idx. I bring this up because after manually curating units in phy to clean up some MUA units with RPVs, bombcell will not iterate through the manually curated units (or new unit IDs that are created after curation). I've tried debugging and manually setting this to equal the spike_clusters numpy file that updates from phy but then encounter an indexing error. Any suggestions? Thank you!!

Julie-Fabre commented 1 month ago

Hi Ryan, Thanks for your message! That's a great point, we need to handle this. We're working on integrating this right now. I'll come back to you very soon once we've finished :)

Julie-Fabre commented 3 weeks ago

Woops - looks like I deleted my comment by mistake.

Bombcell can now handle spike_clusters (with splitting and merging) and automatically loads this. Let me know if you run into any issues!

ryanlash commented 3 weeks ago

Hi Julie!

I'm currently testing and I'm not sure if it's you or me but I'm running into a ismember class issue. Have you ran into this issue? Screenshot 2024-11-01 144654

Julie-Fabre commented 3 weeks ago

Ah interesting spikeTemplates is not uint32 for you. I've changed this now to enforce the same datatype for both in all conditions.

ryanlash commented 3 weeks ago

Hi Julie!

It appears to be working for me however there were a couple of bugs I found. At line 90 in loadEphysData, savePath currently is unrecognized. Also, spikeClusters is unrecognized by the loadMetricsForGui function as well.

Julie-Fabre commented 3 weeks ago

Hi Ryan, thanks for your message! Could you make sure that you are inputing the variable "savePath" into the function loadEphysData (like here: https://github.com/Julie-Fabre/bombcell/blob/main/pipelines/bombcell_pipeline.m#L39 or like in the example matlab live script? To handle spikeClusters we had to make a slight change to this function.

ryanlash commented 3 weeks ago

Hi Julie!

I was just coming to comment the same thing and I was able to get it to work!:D spikeTemplates also needed to be modified to spikeClusters in the output: [spikeTimes_samples, spikeClusters, templateWaveforms, templateAmplitudes, pcFeatures, ... pcFeatureIdx, channelPositions] = bc.load.loadEphysData(ephysKilosortPath,savePath);

Julie-Fabre commented 3 weeks ago

Perfect! Let me know if there re any other issues or questions :)