Bug in the Cell Builder or Distributed Mechanisms manager

The basics of how to develop, test, and use models.
Post Reply
Danko Georgiev
Posts: 8
Joined: Fri Oct 15, 2010 10:41 am
Location: Varna, Bulgaria
Contact:

Bug in the Cell Builder or Distributed Mechanisms manager

Post by Danko Georgiev »

Dear Ted,

Today I have uninstalled completely my NEURON 7.1 version and installed fresh copy. This is just to ensure that the "bug" is really there and not because I customized my NEURON (as you suggested in your previous reply to my post). I have found manual solution to the bug that I am reporting, maybe you can fix this or explain why the bug occurred.
The problem is as follows: so far I was using the Cell Builder to input channels into a reconstructed 3D neuron. Also I was setting the reversal potentials E_Na and E_K through the Tools Menu > Distributed mechanisms > Na and K ion (Global), as well as Celsius menu for temperature. Unfortunately when the Cell Builder exports .hoc file it does not input code for reversal potentials E_Na and E_K and also if I load .hoc that does not contain information about reversal potentials E_Na and E_K even if I set these through the Tools menu (as i explained above), and try to perform current clamp, the values for reversal potentials E_Na and E_K that NEURON uses to compute action potentials are the default for mollusk neurons, not the values inputted by me.
In summary: setting intracellular and extracellular concentrations of Na+ and K+ ions through the Tools menu does not work. Also exporting fresh .hoc file from the Cell Builder does not take into account the settings for intracellular and extracellular concentrations of Na+ and K+ ions and does not create the appropriate .hoc code.
I performed manual fix for this. After exporting the .hoc file, I followed advice from "A NEURON Programming Tutorial" by Andrew Gillies and David Sterratt - http://www.anc.ed.ac.uk/school/neuron/t ... /tutD.html - who said that the reversal potentials for E_Na and E_K .."should be set after the channel mechanisms are inserted into a section, and must be set for each section that has channels using that ionic species inserted."
Thus I added in my .hoc file the following code at the end of each section after the channel mechanisms were inserted:

Code: Select all

  
forsec somatic {
    insert channel
      gmax_channel = 0.045
    ena = 71.5
    ek = -89.1  
  }
  forsec axonal {
    insert channel
      gmax_channel = 0.045
    ena = 71.5
    ek = -89.1  
  }
  forsec basal {
    insert channel
      gmax_channel = 0.045
    ena = 71.5
    ek = -89.1  
  }
(in the above code I deleted the code for most of the channels)

This manual fix ensured that the reversal potentials are set properly after all channel mechanisms.
(Note: I tried to insert in my .hoc file with the command forsec all, however NEURON complained that in some section there are no K+ or Na+ channels.)

After I run the current clamp with the fixed .hoc file everything was nice, and I was able to see clearly effects by manipulating the reversal potentials.
I am wondering why the Tools menu did not work, and why setting the ion concentrations and temperature had no effect on the current clamp performed through the Tools > Point Process Manager.
I am not aware whether this problem is available only under Windows XP OS, etc. For now I will input the missing code on reversal potentials in my .hoc files manually.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Bug in the Cell Builder or Distributed Mechanisms manager

Post by ted »

No bug. This is how things are supposed to work. Equilibrium potentials, ionic concentrations, and celsius are global parameters, and global parameters are not managed by the CellBuilder. That's not what it was designed to do. The CellBuilder is for specifying the geometry and topology of a cell, and the density mechanisms that are inserted. A hammer would make a poor screwdriver, but that doesn't mean that the hammer has a "bug."

So when you export hoc code from a CellBuilder, expect the code to contain statements that specify geometry, topology, and density mechanisms, and expect that it will NOT contain statements that specify celsius or ionic concentrations or equilibrium potentials. If you need to specify global parameters, you can do that either by writing your own hoc statements or by retrieving session files for the GUI tools that manage global parameters.
Danko Georgiev wrote:setting intracellular and extracellular concentrations of Na+ and K+ ions through the Tools menu does not work.
If you used the GUI to specify the values of nai0_na_ion and/or nao0_na_ion, ena would be affected only in sections for which the ion_style specifies that ena is to be calculated from the Nernst equation. Please read about ion_style in the Programmer's Reference.
http://www.neuron.yale.edu/neuron/stati ... #ion_style
I am wondering why . . . setting the . . . temperature had no effect on the current clamp performed through the Tools > Point Process Manager.
celsius will affect the equilibrium potential for an ion if the ion_style specifies that equilibrium potential is computed from the Nernst equation. celsius will also affect a point process or a density mechanism if the NMODL code for that mechanism declares celsius in the ASSIGNED or PARAMETER block and also contains one or more statements by which celsius alters what the mechanism does.
Danko Georgiev
Posts: 8
Joined: Fri Oct 15, 2010 10:41 am
Location: Varna, Bulgaria
Contact:

Bug in the Distributed Mechanisms manager?

Post by Danko Georgiev »

Dear Ted,

Thanks for your reply. Actually I was doing what you suggest here
"... you can do that either by ... or by retrieving session files for the GUI tools that manage global parameters."

Indeed, first I loaded .ses files for the modeled channels, then I loaded .hoc file with the 3D neuron with inserted channels as exported from the Cell Builder, then I loaded .ses file with IClamp of the soma, as well as three Global .ses for Na+, K+ and T changed to desired values. I assumed that by using these customized Global .ses files the simulation should run differently. Unfortunately these .ses files do not affect in any way the reversal potentials (it also does not work if I modify these Global .ses anew, without loading previously saved .ses files). For example reversing the intracellular with extracellular concentrations for the K+ does not block the firing, etc.

So far as I understand your explanation the Global .ses files for Na+, K+ and T should work without any requirement for extra input in the .hoc code, right? But they do not work.
That is why I assumed these Global .ses files for Na+, K+ and T need some extra input in the .hoc code (in order to get active).

So I see two possibilities, either Globals (as .ses files for Na+, K+ or T) have a bug (if they do not need some .hoc code in order to function properly), or these Globals by default cannot change anything in the simulation and the plotted results unless there is some manual change in the .hoc file (e.g. code that activates them, or simply inserting the reversal potentials manually as I did).
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Bug in the Distributed Mechanisms manager?

Post by ted »

The problem is not with how NEURON deals with ionic concentrations and equilibrium potentials. NEURON handles these exactly as it was designed to. The problem is that NEURON's built-in policy for dealing with concentrations and equilibrium potentials didn't match your expectations, so you thought there was a bug.

"Bug, shmug, the real issue is that it doesn't do what I want. A real answer would tell me how can I make it work the way I want it to."

Fair enough. Read on, and see if you find the answer in these paragraphs.

The modeling literature reveals that there is little uniformity among modelers with regard to how they themselves deal with concentrations and equilibrium potentials. In some models, concentrations and equilibrium potentials are constant parameters. In others, concentrations integrate ion fluxes, but equilibrium potentials are constants. In yet others, some ionic concentrations change and their equilibrium potentials are governed by the Nernst equation, but other concentrations are fixed. And on, and on, and on. Just about every imaginable combination of assumptions has been made somewhere, at some time, in one model or another.

That's why NEURON was designed to handle concentrations and equilibrium potentials in a way that gives users maximum control over what happens during a simulation. It has an automatic policy that is smart enough to guess correctly most of the time, based on information that was specified by USEION statements in the NMODL code for the point processes and density mechanisms that a model uses. But it's also flexible so that users can deal with special circumstances if the automatic policy isn't sufficient. Here's a short tutorial that will help show you how to use ion_style to make NEURON do what _you_ want.

Use the GUI to set up a single compartment model with hh. The user interface should include the following:
RunControl
PointProcessManager as IClamp that delivers 0.1 ms x 0.1 nA current at 1 ms
"Globals" panels for na_ion, k_ion, and celsius
Voltage axis graph that plots v(0.5), ena, and ek

Run a simulation, and note the spike waveform and the values of ena and ek.
Multiply celsius by 3 and repeat the simulation.
There is no change of ena or ek, but the spike waveform changes.
Interpretation: gating variables are affected by celsius but ena and ek aren't.
Why?

At the oc> prompt execute the command
ion_style("na_ion")
Returned value is 8. What does this mean?
From the Programmer's Reference documentation of ion_style
http://www.neuron.yale.edu/neuron/stati ... #ion_style
discover that the returned value is
c_style + 4*cinit + 8*e_style + 32*einit + 64*eadvance
so if ion_style("na_ion") returns a value of 8, this means that

Code: Select all

c_style  0  concentration unused
cinit    0  finitialze() has no effect on nai or nao
e_style  1  parameter, i.e. constant specified by user
einit    0  finitialze() does not cause computation of ena from the Nernst equation
eadvance 0  fadvance() has no effect on ena
What do you suppose
ion_style("k_ion")
will return, and what will it mean?

If you want temperature to affect ena, you have to tell NEURON to calculate ena from the Nernst equation. If the model does not have a sodium accumulation mechanism and celsius will remain constant during the simulation, it will be sufficient to make NEURON calculate ena at initialization.

In order to make this happen, it is necessary to call ion_style() with the correct arguments. What should the argument be? Review the table above and see that einit should be changed to 1

Code: Select all

c_style  0  concentration unused
cinit    0  finitialze() has no effect on nai or nao
e_style  1  parameter, i.e. constant specified by user
einit    1  finitialze() DOES cause computation of ena from the Nernst equation
eadvance 0  fadvance() has no effect on ena
The ion_style function call has the syntax
ion_style("name_ion", c_style, e_style, einit, eadvance, cinit)
so try executing
ion_style("na_ion", 0, 1, 1, 0, 0)

Now changing celsius makes ena change too.
And changing nai, e.g. by executing
nai = 20
at the oc> prompt, affects ena.

But changing nai0_na_ion or nao0_na_ion in the na_ion globals panel has no effect on ena.
Why?

Because cinit is 0. If you want nai0_na_ion or nao0_na_ion to govern nai and nao, you must tell NEURON to use these global variables to control the initial values of nai and nao. This means you have to call ion_style with cinit set to 1. So try executing
ion_style("na_ion", 0, 1, 1, 0, 1)
And now, at initialization, nai and nao will be set to the values specified by nai0_na_ion and nao0_na_ion, and you will see that these global variables do affect ena.

It is not usually necessary to call ion_style(), because NEURON can generally figure out what to do automatically from what was specified by the USEION statements in the NMODL code that specified the properties of the point processes and density mechanisms that a model uses. But in cases where NEURON's automatic policy fails, you can use ion_style() to make it do what you want. This is all discussed in the documentation of ion_style in the Programmer's Reference.
Post Reply