Skip to content

NIX to NWB #1717

Open
Open

Description

@actionpotential

We have physiology datasets from large scale simulations on supercomputers (see https://dandiarchive.org/dandiset/001444). We use NetPyNE for our simulations, which providers well structured outputs (json) but not in NWB. I’ve been using NEO to give these data a standard neurophysiology structure and save them in NIX format.

We tried the NEO export for NWB based on the NEO documents, which only show examples for intracellularElectrode recording (we understand this is a work in progress). The below works in that the analog LFP data are encapsulated by the acquisition group … however, of course, they are not patch clamp data and the cell_id is added just to make the whole thing work. The keywords does something strange so that is commented out.

This passes DANDI validation and inspector.

from neo.io import get_io
reader_file = get_io(f'data/{experimentID}.nix')
file_data = reader_file.read()

global_metadata = {
'session_start_time': file_data[0].rec_datetime.fromisoformat('2023-12-12T15:23:00-05:00'),
'identifier': f'mouse1',
'session_id': f'{experimentID}',
'session_description': 'control, quiet wakefulness',
'experiment_description': 'Simulated mouse primary motor cortex in control and 6-OHDA induced parkinsonism.',

'keywords': ["Parkinson's disease", 'mouse', 'primary motor cortex', 'M1', 'beta'],

'institution': 'SUNY Downstate Health Sciences University',
'lab': 'NeuroSim Lab',
'experimenter': 'Doherty, Donald',
"related_publications": "https://doi.org/10.1101/2024.05.23.595566",

}

signal_metadata = {
"nwb_group": "acquisition",
"nwb_neurodata_type": ("pynwb.icephys", "PatchClampSeries"),
"nwb_electrode": {
"name": "patch clamp electrode",
"description": "These are actually LFP data",
"device": {"name": "patch clamp electrode"},
"cell_id": "100",
},
"nwb:gain": 1.0,
}

for segment in file_data[0].segments:
signal = segment.analogsignals[0]
signal.annotate(**signal_metadata)

writer = neo.io.NWBIO(f'data/{experimentID}.nwb', mode='w', **global_metadata)
writer.write_block(file_data[0])

I’ve been struggling to get LFP to work. Something like the following:

signal_metadata = {
"nwb_group": "acquisition",
"nwb_neurodata_type": ("pynwb.ecephys", "LFP"),
'nwb_electrical_series': {
‘ name': 'LFP’,
},
}

So far I haven’t been able to add the appropriate metadata. Maybe LFP data are not supported yet?

Am I going down the correct path at all?

Alternatively, I was hoping I could export my NIX data files into a format that the DANDI NWB Guide recognizes but it looks like the guide doesn’t recognize any of the formats that NEO exports to (but definitely supports some of the formats NEO is able to import).

Activity

  1. zm711 commented on May 28, 2025

    @zm711
    Contributor

    @apdavison can comment more on specifics that we support, but yes full nwb support is a work in progress. We are hoping to have get motivated developers to help update our nwb support.

  2. apdavison commented on May 28, 2025

    @apdavison
    Member

    @actionpotential I will take a look at this next week. It will be good to have this concrete use-case to help improve Neo's NWB support.

  3. self-assigned this
    on May 28, 2025
  4. actionpotential commented on May 28, 2025

    @actionpotential
    Author
  5. actionpotential commented on Jun 18, 2025

    @actionpotential
    Author
  6. added this to the 0.15.0 milestone on Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions