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

[Feature]: Anatomical annotation of units in spike sorting? #1064

Closed
2 tasks done
vigji opened this issue Sep 9, 2024 · 4 comments
Closed
2 tasks done

[Feature]: Anatomical annotation of units in spike sorting? #1064

vigji opened this issue Sep 9, 2024 · 4 comments

Comments

@vigji
Copy link
Contributor

vigji commented Sep 9, 2024

What would you like to see added to NeuroConv?

I am sorry if I missed this feature. I am using the KiloSortSortingInterface to load some units sorted using KS4 via spikeinterface.

For each unit, I also have a pipeline that produces the brain area where the unit is located. I am wondering what is the way you would recommend to include that information in the sorting data. Is this something advisable? What would be a neuroconv-itonic way of doing it?

Is your feature request related to a problem?

No response

Do you have any interest in helping implement the feature?

Yes.

Code of Conduct

@h-mayorquin
Copy link
Collaborator

Hi, the most straightforward way would be to do the following

from neuroconv.tools.testing import MockSortingInterface

# Here use your KiloSortSortingInterface instead
interface = MockSortingInterface()
key = "brain_area"
interface.sorting_extractor.set_property(key=key, values=["Hippocampus", "CA1", "Motor Cortex", "Another Location"])


nwbfile_path = "test.nwb"
interface.run_conversion(nwbfile_path=nwbfile_path, overwrite=True)

from pynwb import NWBHDF5IO
with NWBHDF5IO(nwbfile_path, 'r') as io:
    nwbfile = io.read()
    units_table_df = nwbfile.units.to_dataframe()
units_table_df

image

Are you also writing a raw ecephys data? If so, the "best" way would be to annotate the channels/electrodes in the electrodes table and then make a reference from the units table there.

@vigji
Copy link
Contributor Author

vigji commented Sep 10, 2024

Well that was another question I was about to ask :)

Am I correct in thinking that by looking at the RecordingEstractorImage there is no way to link the bulk of the raw data as I do for the video recordings?

I would like to bundle everything together in a single nwb file, but I was wondering if I could keep those ~100 GBs out of it, as lab policy is still not deleting OEphys source data even after succesfull nwb import.

@h-mayorquin
Copy link
Collaborator

Am I correct in thinking that by looking at the RecordingEstractorImage there is no way to link the bulk of the raw data as I do for the video recordings?

No, unless your original data is in hdf5 but that is not dandi friendly and introduces more complexity in your workflow as you need to be sure to keep the paths aligned:

https://pynwb.readthedocs.io/en/stable/tutorials/advanced_io/plot_linking_data.html

Did the annotation method above worked for you?
Let me know so I can close this question. Feel free to open more for any question you might have.

@vigji
Copy link
Contributor Author

vigji commented Sep 13, 2024

YEs it does! thank you very much :) And thanks for the clarification!

@vigji vigji closed this as completed Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants