Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in plotting quality metrics of data sorted with kilosort4 #80

Closed
JohannaMankel opened this issue Apr 8, 2024 · 4 comments
Closed

Comments

@JohannaMankel
Copy link

Hello, I'm trying to set up bombcell on data spike-sorted with Kilosort4. However, I run into the following error when trying to compute the quality metrics:

Index exceeds the number of array elements. Index must not exceed 0.

Error in bc_upSetPlot (line 27)
pType = sPPos(dPPos);

Error in bc_upSetPlot_wrapper (line 62)
bc_upSetPlot(UpSet_data_mua, UpSet_labels_mua, figHandle_mua);

Error in bc_plotGlobalQualityMetric (line 17)
bc_upSetPlot_wrapper(qMetric, param, unitType)

Error in bc_runAllQualityMetrics (line 200)
bc_plotGlobalQualityMetric(qMetric, param, unitType, uniqueTemplates, forGUI.tempWv);

Error in bc_qualityMetrics_pipeline (line 55)
[qMetric, unitType] = bc_runAllQualityMetrics(param, spikeTimes_samples, spikeTemplates, ...

I tried with both, the matlab package available via file exchange and the cloned repo from github but the error remains.
Any idea why this is the case? Thank you so much,
Johanna

@Julie-Fabre
Copy link
Owner

Hi Johanna,

Thanks for your message! Bombcell hasn't been fully tested with Kilosort4 yet. Would you be able to send me your qMetric and param structures that bombcell computes (the inputs to bc_plotGlobalQualityMetric) so I can troubleshoot?

@JohannaMankel
Copy link
Author

Hi Julie, sure. Here are the files:
param_Johanna.csv
qMetric_Johanna.csv

@Julie-Fabre
Copy link
Owner

Hi Johanna,

Thank you very much!

I had a quick look at the error was because in this dataset no units were being classified as Good or MUA (so there was nothing to plot on the second upSet plot, and that caused on error) - you can see in the first upSet plot (below)
image. This is now fixed - bombcell will display a text warning you there are no units in a catagery but won't error anymore.

This classification was due to most of your units being classified as noise with a waveform baseline flatness above the threshold, and this is because Kilosort4 extracts templates differently than previous Kilosort versions. It used to be 82 samples and it is now 61, which means the baseline window we define with param.waveformBaselineWindowStart, param.waveformBaselineWindowStop awas now wrong, and usually included the units' main trough/peak. I have now added an input kilosortVersion in bc_qualityParamValues to get values that make more sense for kilosort4.
image

Let me know if this works better for you!

@JohannaMankel
Copy link
Author

Hi Julie, this works perfectly! Thank you so much,
Johanna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants