Channel builder export?

NMODL and the Channel Builder.
Post Reply
Eric Thomson
Posts: 15
Joined: Thu Mar 02, 2006 11:18 am
Contact:

Channel builder export?

Post by Eric Thomson »

I am a newbie to Neuron, presently using the book and Channel Builder Tutorial to try to figure out how to add my own mechanisms. My question is about how to get results from the channel builder into an NMODL file.

In the web tutorial on Channel Builder, it says:
A configured Channel Builder can be saved to a session file that contains a human-readable, plain text specification of the mechanism.
How, exactly, is this done? I built a simple channel (leak_built) in channelbuilder, saved the session, and that doesn't seem to produce a human-readable (this human, anyway) specification of the mechanism. It produces the following:
//Begin ChannelBuild[0] managed KSChan[0]
{
load_file("chanbild.hoc", "ChannelBuild")
}
{ocbox_ = new ChannelBuild(1)}
{object_push(ocbox_)}
{genprop.set_data("leak_built", 1, 1, -1, "NonSpecific")}
{genprop.set_defstr(0.0002, -65)}
end_restore()
{genprop.set_single(0)}
{set_alias(0)}
{usetable(0)}
{object_pop()}
{
ocbox_.map("ChannelBuild[0] managed KSChan[0]", 132, 174, 199.8, 271.8)
}
objref ocbox_
//End ChannelBuild[0] managed KSChan[0]
I can understand some of that. For instance, where the parameters are (the conductance and reversal potential), that it is a nonspecific current. But is there any way to generate output from channelbuilder that is more like the NMODL code that I would write by hand? That is, can I use channelbuilder and export code that will expedite creating the mechanism in an NMODL file?
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Channel builder export?

Post by ted »

how to get results from the channel builder into an NMODL file
There is no "click of a button" way to do that, but it's not clear why one would want to in the first place. Can't be speed--mechanisms specified with Channel Builders execute just as fast as, if not faster than, compiled NMODL code. Can't be accessibility of parameters at the hoc level--aliases take care of that. Can't be interoperability with hoc and the GUI. Is there some other reason that I missed?
In the web tutorial on Channel Builder, it says:
"A configured Channel Builder can be saved to a session file that contains a human-readable, plain text specification of the mechanism."
How, exactly, is this done?
The sentence will be true if the word "session" is removed.

In the main ChannelBuild panel
Properties / Text to stdout
gives a top level description of the mechanism. Example: for a Channel Builder implementation of the HH sodium current, NOT using any aliases, the description is

Code: Select all

nahh Density Mechanism
  na ohmic ion current
      ina (mA/cm2) = g_nahh * (v - ena)
  g = gmax * m^3 * h
    Default gmax = 0 (S/cm2)
    m' = am*(1 - m) - bm*m                         (KSTrans[0])
      am = 1*x/(1 - exp(-x)) where x = 0.1*(v + 40)     (Vector[7])
      bm = 4*exp(-0.05556*(v + 65)))                    (Vector[8])
    h' = ah*(1 - h) - bh*h                         (KSTrans[1])
      ah = 0.07*exp(-0.05*(v + 65)))                    (Vector[11])
      bh = 1/(1 + exp(0.1*(-35 - v)))                   (Vector[12])
which is readable, if not executable.

For something that is executable but "only slightly readable", click on
Properties / Clone channel type / Hoc file for KSChan
Eric Thomson
Posts: 15
Joined: Thu Mar 02, 2006 11:18 am
Contact:

Re: Channel builder export?

Post by Eric Thomson »

Thanks for the helpful summary, Ted.
ted wrote:There is no "click of a button" way to do that, but it's not clear why one would want to in the first place. [...] Can't be accessibility of parameters at the hoc level--aliases take care of that. Can't be interoperability with hoc and the GUI. Is there some other reason that I missed?
In general, I was concerned about the accessibility (within hoc) of mechanisms built in channelbuilder. E.g., after creating leak_built in channelbuilder, what is the easiest way to use that mechanism in my hoc code? It looks like some of the information you provide (quoted below) will help me with this.

My (likely faulty) thinking was: based on Chapter 9 on NMODL, I can build a mechanism and then easily call it in hoc. It wasn't clear to me how to use hoc to call a channelbuilder-constructed mechanism, and NMODL is the only way I know to build a mechanism that I can call in hoc. Hence, I thought there might be a way to connect channelbuilder and NMODL, but it sounds like I may be able to get from channelbuilder to hoc more directly.
ted wrote:In the main ChannelBuild panel
Properties / Text to stdout
gives a top level description of the mechanism. Example: for a Channel Builder implementation of the HH sodium current, NOT using any aliases, the description is

Code: Select all

nahh Density Mechanism
  na ohmic ion current
      ina (mA/cm2) = g_nahh * (v - ena)
  g = gmax * m^3 * h
    Default gmax = 0 (S/cm2)
    m' = am*(1 - m) - bm*m                         (KSTrans[0])
      am = 1*x/(1 - exp(-x)) where x = 0.1*(v + 40)     (Vector[7])
      bm = 4*exp(-0.05556*(v + 65)))                    (Vector[8])
    h' = ah*(1 - h) - bh*h                         (KSTrans[1])
      ah = 0.07*exp(-0.05*(v + 65)))                    (Vector[11])
      bh = 1/(1 + exp(0.1*(-35 - v)))                   (Vector[12])
which is readable, if not executable.

For something that is executable but "only slightly readable", click on
Properties / Clone channel type / Hoc file for KSChan
Great, that is very helpful. This gives me enough to start hacking away at this.

Also, you mentioned aliases a couple of times. Is there an introduction to aliases in the documentation?
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Channel builder export?

Post by ted »

Documentation of Channel Builder usage could be much improved. Something we need to do in the next NEURON book.

Channels specified with the Channel builder appear automatically in the appropriate GUI tool menus, just like other density mechanisms or point processes. For example, density mechanisms specified with the Channel Builder will appear in the list of mechanisms on the CellBuilder's Biophysics page, and Channel Builder specified point processes will appear in the PointProcessManager's list of mechanisms.

The basic syntax of hoc usage is identical to that of mechanisms specified in NMODL. That is, density mechanisms are inserted and their state variables, density parameters, and equilibrium potentials are referenced with suffix notation (e.g. m_abc, i_abc, g_abc, e_abc), while point processes are created as instances of a class and have state variables etc. that are referenced with dot notation.

Parameters of the rate functions that govern state transitions are not ordinarily accessible from hoc. However, they can be made accessible by clicking on
Properties / Provide transition aliases
in the main Channel Builder panel. For future use, be sure to save the Channel Builder with "Provide transition aliases" enabled.

Here's how to use a graph's Plot what? to discover the alias names. Suppose you have a Channel Builder for a potassium channel with state variable n where n' = an*(1 - n) - bn*n and the forward and backward rate constants an and bn are governed by functions of membrane potential that involve parameters A, k, and d.
(You can do this yourself right now--start NEURON, bring up a Channel Builder, click on Properties and select HH potassium channel, then click on the equation that appears in the gray field at the bottom of the Channel Builder to see the ChannelBuildGateGUI tool with the formulas for an and bn).

Code: Select all

NEURON Main Menu / Graph / Current axis (this does not require a default section)
  Graph's menu box / Plot what?
  Plot what? / Show / Objects
  scroll down list in first column to ChannelBuild_
  double click on ChannelBuild_ -->
    ChannelBuild_ appears in text edit field at top of Plot what?,
If there is only one Channel Builder, Plot what?'s middle column will contain a single entry: the numeral 0.
  Double click on the 0. in middle column -->
    edit field changes to ChannelBuild[0].,
    and middle column shows a list of names
  double click on aliases. in middle column -->
    edit field changes to ChannelBuild[0].aliases.,
    and right column shows an. and bn.
  double click on an. in right column -->
    edit field changes to ChannelBuild[0].aliases.an.,
    and right column shows A, d, k
So the "complete" hoc names of these three parameters would be ChannelBuild[0].aliases.an.A, ChannelBuild[0].aliases.an.d, and ChannelBuild[0].aliases.an.k
Guess what the aliases for bn's parameters would be called. Verify your prediction.
Eric Thomson
Posts: 15
Joined: Thu Mar 02, 2006 11:18 am
Contact:

Re: Channel builder export?

Post by Eric Thomson »

Many thanks for taking the time to explain this to me. I look forward to figuring this stuff out!
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Channel builder export?

Post by ted »

Thanks for asking the questions. User questions help us understand what needs better documentation.
Post Reply