making a template from a neuromorpho morphology

Managing anatomically complex model cells with the CellBuilder. Importing morphometric data with NEURON's Import3D tool or Robert Cannon's CVAPP. Where to find detailed morphometric data.
Post Reply
maria.kesa
Posts: 36
Joined: Thu Nov 12, 2015 10:45 am

making a template from a neuromorpho morphology

Post by maria.kesa » Sun Nov 29, 2015 1:18 pm

Hello,

My name is Maria and I'm learning Neuron for my master's thesis.

I would like to create a simulation with real neuron morphologies from neuromorpho.org that are connected in a network.

I read some forum posts on this topic. I downloaded a cell morphology from neuromorpho and opened it with import3d and cellbuilder. I didn't modify any parameters and simply exported the model to file.

My questions are-- 1. with a cell from neuromorpho do I have to define the parameters such as L by hand through the cellbuilder? There are a lot of branches and parameters in real cells.
2. Would NeuroConstruct provide any advantages for my aims?
3. I'm sorry I'm a beginner this is a simple question, but once I export the cell from cellbuilder into a hoc file, how can I create a template out of it as is said in the instructions in http://www.neuron.yale.edu/phpbb/viewto ... =15&t=2306

That's what I'm thinking about now, but I think that I will frequent this forum. Thank you!

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

Re: making a template from a neuromorpho morphology

Post by ted » Sun Nov 29, 2015 3:42 pm

First, let me thank you for using NEURON in your project.
1. with a cell from neuromorpho do I have to define the parameters such as L by hand through the cellbuilder?
When the Import3D tool reads a morphometric data file, it captures all of the length and diameter information in that file. Whatever you export from the Import3D tool contains all that information. If you export to a CellBuilder, that CellBuilder will contain all of that information.

"But the drawing of the cell in the CellBuilder looks strange--every branch is a straight line, not at all like the irregular neurites that real cells have."

That's because the CellBuilder takes a shortcut when it renders the shape of the cell on its canvas--each neurite is shown as a straight line between its endpoints. But all the morphometric data still exists inside the CellBuilder. If you click Continuous Create and then bring up a Shape plot (NEURON Main Menu / Graph / Shape plot) you'll see the real shape of the cell, with all those irregular wiggles--and you can see the diameter changes too, if you click in the Shape plot's menu box (square in upper left corner of the canvas) and select Shape Style / Show Diam. Some of the narrowest branches may not be visible unless you expand the size of the graph or zoom in on the figure.

"But if I go to the CellBuilder's Geometery page, I don't see any information about section length and diameter."

There are two ways to specify section geometry: stylized (section L and diam are specified explicitly), and 3-D (section geometry is specified by a series of x,y,z,diameter measurements). Suggest you read
https://www.neuron.yale.edu/neuron/stat ... metry.html

The CellBuilder's Geometry page only shows L and diam for sections that were specified by the stylized method. Importing a morphometric data file produces a model cell with geometry specified by the 3-D method, and the CellBuilder doesn't show you the L or diam of anything. If your CellBuilder was created by the Import3D tool, don't use its Geometry page to tinker with the L or diam of any section unless you want to cause a lot of confusion for yourself. If your model cell is based on imported morphometric data, the only part of the Geometry page's user interface that is relevant is the stuff used to specify the spatial grid.
maria.kesa wrote:I downloaded a cell morphology from neuromorpho and opened it with import3d and cellbuilder. I didn't modify any parameters and simply exported the model to file.
. . . once I export the cell from cellbuilder into a hoc file, how can I create a template out of it as is said in the instructions in http://www.neuron.yale.edu/phpbb/viewto ... =15&t=2306
Well, first of all, that discussion thread does not say anything about exporting hoc files and then converting them to templates.

If you exported a "top level" model cell (a model specification that is NOT in a template), and now you want to convert that to a template, you have a lot of programming to do--you'll have to add ion channels, and you'll have to encapsulate all that code in a template. Not advisable. This is tedious if you are an expert on writing templates. It is quite arduous if you are just starting to work with NEURON.

If you exported a template for a cell class, you face a task that is not much easier--you still have to write code that adds ion channels, but you have to do it in a way that doesn't break the template. Not advisable. Requires almost as much expertise as wrapping a top level model specification in a template, and involves nearly as much effort.

You'll get better results much faster and with far less effort if you use the CellBuilder to do as much development as possible, and defer exporting top level hoc code or templates until you are quite sure that your model cell(s) have the biophysical properties that you want, and are working properly. Here's a suggested workflow:

1. After you use Import3D to import morphometric data, export to a CellBuilder and save that CellBuilder to a session file, all by itself. Give that session file a meaningful name that reminds you what kind of a cell the data came from, and also that the session file is "bare"--that is, it has no ion channels. For example, if you have a CellBuilder that contains the morphology of a layer 5 pyramidal cell, save the CellBuilder to a file called something like
L5bare.ses
or
L5nochannels.ses
Put this file somewhere for safekeeping.
2. When it comes time to add channels or other biophysical mechanisms, first make a copy of L5bare.ses, then work on the copy--maybe call this L5devel.ses. Never work on the original file.
3. Defer exporting hoc code from the working copy of the session file until you are completely satisfied with the model specification that it contains. This assumes that you have tested your model cell in a toy simulation--at the very least, see how it responds to injected currents and synaptic inputs. Also, use Model View to verify that the properties of your model cell are what you expect them to be. You're going to spend a lot of time building and using your network model, so you need to make sure that all the pieces you put into it are correct.

Whatever else you do, be sure to save the final version of the working copy of your completed model cell, along with whatever other files are needed to explore and verify it. That way, you'll be able to find them 6 months or a year from now when you decide you need to revise it.
4. At the happy point where you are satisfied with the model in your CellBuilder, what should you do about exporting code from it? If your goal is to produce a model of a single cell, it's OK to use "Management / Export / Export to file" to write a hoc file. Executing the code in that hoc file will create a top level model cell. But if your goal is to build a model network, you need to create templates for cell classes. To export a template from a CellBuilder, click on Management / Cell Type, make sure to change the "class name" to what you want, and then click on the "Save hoc code in a file" button. That generates a hoc file that contains a template for a cell class.
2. Would NeuroConstruct provide any advantages for my aims?
Maybe, if you were already expert with NEURON. Also, how much time do you have to become proficient with yet another complex tool?

maria.kesa
Posts: 36
Joined: Thu Nov 12, 2015 10:45 am

Re: making a template from a neuromorpho morphology

Post by maria.kesa » Mon Nov 30, 2015 12:24 pm

Thank you, Ted! That's very useful.

I went through a NEURON tutorial on making NMODL files http://www.anc.ed.ac.uk/school/neuron/t ... /tutD.html How can I use the specification for custom ion channels in cell builder?

For example, if I want to insert an AMPA channel of this kind https://senselab.med.yale.edu/ModelDB/S ... /AMPAg.mod How would I do it?

Currently the options on the biophysics page of the neuron are very limited. There's only Ra, Cm, pas, extracellular and hh. What if I need more mechanisms?

I'm sorry, I'm a total beginner and I'm trying to understand how the system works. I'm also reading "The NEURON book". Thanks for your help.

Maria

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

Re: making a template from a neuromorpho morphology

Post by ted » Mon Nov 30, 2015 1:32 pm

maria.kesa wrote:I went through a NEURON tutorial on making NMODL files http://www.anc.ed.ac.uk/school/neuron/t ... /tutD.html How can I use the specification for custom ion channels in cell builder?
Put all mod files that your model needs in the same directory as the hoc and ses files that need them. Compile the mod files in that directory with mknrndll (or nrnivmodl if you're using UNIX/Linux). If you start NEURON with that directory as the "working directory," the NEURON will load the compiled mod files when it starts. This automatically makes the new mechanisms available to hoc, Python, and all of the GUI tools.

By the way, when NEURON starts, if it finds compiled mechanisms to load, it prints the names of those mechanism's mod files to its interpreter window. For example, here's what happens when I launch neurondemo from the command line:

Code: Select all

[ted@loki linearity]$ neurondemo
NEURON -- Release  etc. etc. etc.
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

loading membrane mechanisms from /home/ted/bin/nrn/share/nrn/demo/release/i686/.libs/libnrnmech.so
Additional mechanisms from files
 cabpump.mod cachan1.mod camchan.mod capump.mod invlfire.mod khhchan.mod mcna.mod nacaex.mod nachan.mod release.mod
"How do I start NEURON with a particular directory as the 'working directory'?"

Depends on your OS and how you prefer to run NEURON.

If you prefer to work with your mouse, open your OS's directory browser and navigate to that directory. Then either
A. double click on a hoc file in that directory
or
B. drag and drop a hoc file from that directory onto the nrngui icon (assuming you have a copy of that icon in a convenient place, like your desktop).

If you prefer to work from the command line, open a terminal and use cd to go to that directory that contains your model's files. Then type a command like
nrngui myfile.hoc
or, if you want to use Python as NEURON's interpreter,
nrniv -python myfile.py
(where myfile.py contains a model specification in Python).
For example, if I want to insert an AMPA channel of this kind https://senselab.med.yale.edu/ModelDB/S ... /AMPAg.mod
I strongly advise against using that particular implementation. It is a modification of the "saturating synapse" AMPA_S mechanism described in chapter 10 of The NEURON Book. The problem is that the modification makes specification of synaptic strength quite confusing--basically plants a trap for unwary users. Most models of spike-triggered synaptic transmission implemented for NEURON are written in a way that allows a single instance of the synaptic mechanism to handle multiple afferent streams, thereby achieving great computational efficiency in network models that involve synaptic convergence. For this to work properly, the strength of the postsynaptic response to firing of any particular presynaptic cell must be specified by the weight parameter of the particular NetCon that connects that presynaptic cell to the synapse. However, the AMPAg.mod file you cite has two additional parameters--something called g_specif and another parameter called cellu_area. These additional parameters affect the responses to ALL inputs that converge on an instance of the synaptic mechanism. Maybe the idea behind these changes was to facilitate scaling the magnitude of the postsynaptic response according to surface area of the compartment to which the synapse is attached. This may work OK in the hands of the person who made the modifications, but it invites errors by anyone else who tries to reuse AMPAg.mod.

So stick with the source code for AMPA_S that is presented in chapter 10.

maria.kesa
Posts: 36
Joined: Thu Nov 12, 2015 10:45 am

Re: making a template from a neuromorpho morphology

Post by maria.kesa » Tue Dec 01, 2015 9:10 am

Thank you, Ted!

My question is-- do you need the axons in the cell morphologies when you build a network? Can I make it work through NetCon that whenever a presynaptic cell spikes the synapses of the post-synaptic cell that I define receive the information? That way I don't have to model how the action potential propagates through the axon.

Thanks,
Maria.

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

Re: making a template from a neuromorpho morphology

Post by ted » Tue Dec 01, 2015 2:02 pm

Continuing briefly about AMPAg.mod--
The chief problem with this implementation of a saturating synapse is similar to the problem with the ion channel implementations used in this excellent paper
Mainen ZF, Sejnowski TJ (1996)
Influence of dendritic structure on firing pattern in model neocortical neurons.
Nature 382:363-6
https://senselab.med.yale.edu/ModelDB/s ... model=2488

The problem is that these implementations violate user expectations. Someone who uses one of the ion channel mechanisms from Mainen and Sejnowski may think that these statements
soma {
insert na
gbar_na = 100
}
set the sodium channel density in the soma to 100 S/cm2. After all, NEURON's default units for channel density are S/cm2. That's the user's first mistake. Reading the PARMETER block of na.mod reveals that the units of gbar_na and gna_na are pS/um2, so right from the start there's a big mismatch between what's in the user's head and what's in the computer (1 pS/um2 is equivalent to 0.0001 S/cm2).

"Well, the NMODL statement that calculates sodium current includes the conversion factor (1e-4), so that means the calculated current will be in the correct units (mA/cm2), so no harm done, right?"

Maybe, but another source of confusion lurks. Look at how na.mod's BREAKPOINT block calculates gna:
gna = tadj*gbar*m*m*m*h
Read the rest of the file and discover that the "tadj" thing makes the effective sodium channel density a function of temperature.
So even if you caught the pA/um2 vs. mA/cm2 thing, here's this new potential source of confusion.

This is discoverable only by reading the NMODL code. There's no way you could guess this by just looking at the hoc or Python source code for a model that uses this mechanism. This also means that tools that analyze and report "what's in the computer", like hoc's humble psection() function or the convenient and powerful ModelView tool, will be able to discover this. Rely on ModelView's analysis of a model that uses this na mechanism, and what you think is the sodium channel density will be way off. Use ModelView to export a NeuroML or text file that describes the model, and you're still going to have incorrect thoughts about channel densities. Unless you read and comprehend na.mod. The same is true for every ion channel mod file used with that paper.

So, returning to AMPAg.mod, the problem with this mechanism is that you might think that the NetCon's weight is _the_ "synaptic strength" parameter, but it's not. g_specif and cellu_area also affect "synaptic strength." If the model implementation required that synaptic strength be scaled to compensate for the size of the segment or section to which the point process is attached, it would have been better if the model's authors had left AMPA_S.mod unaltered, and used a procedure in hoc or Python to adjust the NetCon weights appropriately.
maria.kesa wrote:do you need the axons in the cell morphologies when you build a network? Can I make it work through NetCon that whenever a presynaptic cell spikes the synapses of the post-synaptic cell that I define receive the information? That way I don't have to model how the action potential propagates through the axon.
Good question. The answer is partly in the section on "Modeling spike-triggered synaptic transmission: an event-based strategy" in chapter 10 of The NEURON Book. The presynaptic model cell only needs as much of the axon that is necessary for it to have the desired excitability. If that can be done by omitting the axon entirely, fine. If that requires including the initial segment and a short length of axon beyond the initial segment, fine--it's entirely up to what you decide.

Post Reply