Plotting different self-created current

The basics of how to develop, test, and use models.
Post Reply
pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Plotting different self-created current

Post by pass1945 »

Hi Ted,
So currently I'm creating a .mod file for several voltage-gated currents that read built-in ion concentrations such as Na and K. Here is an example of my code to write a NaP channel. Here are my NEURON, ASSIGNED, and BREAKPOINT of my .mod file (it includes other blocks too)

Code: Select all


NEURON{
SUFFIX nap
USEION na READ ena WRITE ina
RANGE gnap, gnapbar
GLOBAL winf, tauw
}

ASSIGNED{
ina (mA/cm2)
winf
gnap
tauw
}

BREAKPOINT{
SOLVE states METHOD cnexp
gnap=gnapbar*w
ina = gnap*(v-ena)
}


Now, when I'm trying to plot this NaP current in the session, it gave me ina current. However, I created another .mod for the hh Na channel, and it uses ina as well. So how do I plot the specific NaP current, even though this channel uses the same ions as the hh Na current? In other words, how do I plot these two Na currents separately? I tried to use NONSPECIFIC_CURRENT but it seems like it's adding another current into my channel, not outputing it. I feel like this should be a very simple step, but I couldn't find the answer anywhere. Thank you!
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Plotting different self-created current

Post by ted »

Good questions.

First a suggestion: your mechanism's suffix is nap, so its parameters and variables will all have hoc names that end with nap. So why is it a good idea to embed another instance of the string "nap" in any of its parameter or variable names? You'll end up with ugly hiccups like gnap_nap, and gnapbar_nap. Have you noticed that the hoc names of the hh mechanism's conductance densities are gnabar_hh, gkbar_hh, and gl_hh? Your code will look cleaner, and you'll have less typing to do, if your NMODL code calls the conductance densities g and gbar.

"Won't there be a problem if some other NMODL-specified mechanism also uses the names g and gbar?"

No. Each NMODL-specified mechanism has its own name space for user-defined parameters and variables.

"Well, at least I didn't call winf and tauw 'winfnap' and 'tauwnap'."

True, and you are to be commended for that.


I feel quite virtuous now, having struck this tiny blow for literate--or at least readable--programming. Now on with the real work.

The USEION statement does two things. It tells NEURON that your mechanism produces a current, so this is something that affects charge balance. Also, it tells NEURON that this current should be reckoned as part of the total sodium current for any mechanism that READs ina (and therefore is presumably concerned with mass balance of the sodium ion). The problem is that there isn't anythng in hoc called ina_nap--it's just called ina.

So if you want to know the current generated by the nap mechanism, you just have to declare an intermediate variable in the ASSIGNED block

Code: Select all

ASSIGNED {
  . . .
  i (mA/cm2)
and make it a RANGE variable in the NEURON block

Code: Select all

NEURON {
  . . .
  RANGE i
and finally calculate a value for it in the BREAKPOINT block

Code: Select all

BREAKPOINT{
  SOLVE states METHOD cnexp
  g = gbar*w
:  ina = g*(v-ena)
  i = g*(v-ena)
  ina = i
}
Other suggestions:
Check units with modlunit, and fix any discrepancies you find.
Make sure there is an INITIAL block.
pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Plotting different self-created current

Post by pass1945 »

Thanks a lot Ted! This is exactly what I'm looking for. I have to say that I appreciated your first few paragraphs, very much!
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Plotting different self-created current

Post by ted »

If I had a nickel for every xnathis_nathis, ykthat_kthat, and zcatheother_catheother that has appeared in user-written code, I could probably buy an iPhone.
pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Plotting different self-created current

Post by pass1945 »

Haha nice. Now I've learned a new way to save time and money for my PI.
Post Reply