Import json format of morphology to NetPyNE

A Python package that facilitates development and use of models of biological neural networks

Moderator: tom_morse

Post Reply
Posts: 1
Joined: Tue May 01, 2018 12:14 pm

Import json format of morphology to NetPyNE

Post by Javad » Fri May 04, 2018 3:02 pm

Hi everyone,

I am new to NetPyNE and I have a question. Your help is appreciated!

I have a morphology in json format and I would like to read directly from NEURON. I am just wondering if netpyne package has this ability to do that for me? I know from NEURON I can read swc format of morphology, but I'd like to import json format directly to NEURON or using netpyne if possible.

Thank you for your help!


Posts: 69
Joined: Tue Aug 18, 2015 3:49 pm

Re: Import json format of morphology to NetPyNE

Post by salvadord » Sat May 05, 2018 5:37 pm

Hi Javad,

Thanks for your question. So the file format is .json but what is the data structure that the morphology is stored in? e.g is it a dictionary of sections with 3d pts, does it follow a similar structure to swc? Perhaps you can share the file to get a better idea.

NetPyNE can import morphologies from hoc templates, python cell classes, or instantiated NEURON cells. It can also import morphologies previously stored using the NetPyNE data structure. But I don't think any of these work for you case. I see 2 options:

1) Figure out how to import into NEURON (similar to how you generate a hoc file from a swc), and then import that cell into NetPyNE via netParams.importCellParams()

2) Write a script that directly converts the morphology from the json file to NetPyNE's format, i.e. populate a netParams.cellParams rule. Since NetPyNE also uses json-like format, this might be relatively easy (dependng on your Python coding skills).

Hope this helps

Site Admin
Posts: 5239
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Import json format of morphology to NetPyNE

Post by ted » Sun May 06, 2018 1:30 pm

After you import morphology data, always examine a Shape plot of the resulting model cell for three possible problems:

1. Z axis artifact. This appears as sudden jumps parallel to the Z axis. Morphology files with Z axis artifact are useless for modeling. The Shape plot's default view is a projection of the cell onto the xy plane. To rotate around the y axis, click on the Shape plot's menu box (left upper corner of the shape) and scroll down the menu to select 3D Rotate. Release the mouse button, move cursor to the middle of the Shape plot window, and press the mouse button. Hold the mouse very still and press the X key on the keyboard. Now release the mouse button and the shape will be redrawn in all its detail.
Return to the standard projection by pressing the Z key.

2. Sectioning artifact. This typically happens when a cell is so close to the surface of a brain slice that part of it has been sliced off. The plane of the section will be defined by the cut ends of the damaged branches. To see this, make sure that the Shape plot is in 3D Rotate mode, then click on the canvas off to the side of the cell and drag the cursor around. Release the mouse button to see the cell from a new angle. If part of the cell moves outside of the Shape plot's frame, use the plot's View = plot to recenter it (click on the menu box, move the cursor up a bit to expose the graph's secondary menu, and drag the cursor right to select View = plot).
Return to the standard projection by pressing the Z key. Exit 3D Rotate by clicking on Section in the Shape plot's primary menu.

3. Bad soma. Different labs use different approaches to defining the shape of the soma. Some trace out one or more outlines of the soma in different planes of focus; this is often seen in Neurolucida files, and it results in the most realistic appearance of the model's soma. Some just do a series of x,y,z,diam measurements. Unlike the Neurolucida ASCII file format, the swc file format has no notion of a "soma outline" so swc files must define the soma by a series of x,y,z,diam measurements; this approximates the soma as a chain of frusta. If an swc file tries to define the soma with an outline, the soma will end up being a long, very thin section that curls around--nothing like the soma in the real cell. To check the shape of the model cell's soma, put the Shape plot in Show Diam mode--click on the click on the Shape plot's menu box and scroll down the menu to Shape Style, then over to select Show Diam. Now zoom in on the soma--click on the menu box, hold the mouse button down while moving the cursor up a bit to expose the graph's secondary menu, then drag the cursor right to the secondary menu, then down to Zoom in/out. Release the mouse button and click on the Shape plot just to the right of where the soma should be located. Zoom in by dragging the cursor to the right. Do this as many times as needed to see the soma clearly. When done, restore the Shape plot to Centroid mode (in the menu, go to Shape Style, then drag right to select Centroid).

"I don't know anything about any of this."

Time to learn.

"I can't bother with that. I'm dealing with dozens or hundreds of different morphologies. I won't have time to check all of these things."

Are you going to tell that to the reviewers, when you try to publish your work?

"Nah, they're not going to know or care about all this detail."

Maybe, maybe not. What are you going to do about sharing your data and code? Just stonewall?

Post Reply