Skip to content

NIX to NWB #1717

Open
Open
@actionpotential

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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions