Convert a channel from .mod to the channel builder to modify gating in the GUI

Using the graphical user interface to build and exercise models. Includes customizing the GUI by writing a little bit of hoc.
Post Reply
aliaped
Posts: 7
Joined: Sun Aug 09, 2020 12:10 pm

Convert a channel from .mod to the channel builder to modify gating in the GUI

Post by aliaped »

Hi there!

First off, thank you in advance for reading my question.

I have a .mod file from modelDB specifying a high threshold potassium channel. I am not sure the language, but I think it is NMODL because it is a .mod file. See code below.

Code: Select all

: 	High threshold potassium chanel from 
:	Contribution of the Kv3.1 potassium channel to high-frequency firing in mouse auditory neurones
:	Lu-Yang Wang, Li Gan, Ian D. Forsythe and Leonard K. Kaczmarek
:	J. Physiol (1998), 501.9, pp. 183-194

NEURON {
	SUFFIX HT
	USEION k READ ek WRITE ik
	RANGE gbar, g, ik
	GLOBAL ninf, ntau, pinf, ptau, an, bn, ap, bp
}

: area in paper is 1000 (um2) so divide our density parameters by 10

UNITS {
	(mV) = (millivolt)
	(S) = (mho)
	(mA) = (milliamp)
}

PARAMETER {
	gbar = .015 (S/cm2) : .15 (uS)
	gamma = .1

	kan = .2719 (/ms)
	ean = .04 (/mV)
	kbn = .1974 (/ms)
	ebn = 0 (/mV)

	kap = .00713 (/ms)
	eap = -.1942 (/mV)
	kbp = .0935 (/ms)
	ebp = .0058 (/mV)
}

ASSIGNED {
	v (mV)
	ek (mV)
	ik (mA/cm2)

	ninf
	ntau (ms)
	pinf
	ptau (ms)

	an (/ms)
	bn (/ms)
	ap (/ms)
	bp (/ms)
}

STATE {
	n p
}

INITIAL {
	rates(v)
	n = ninf
	p = pinf
}

BREAKPOINT {
	SOLVE state METHOD cnexp
	ik = gbar*n^3*(1 - gamma + gamma*p)*(v - ek)
}

DERIVATIVE state {
	rates(v)
	n' = (ninf - n)/ntau
	p' = (pinf - p)/ptau
}

PROCEDURE rates(v(mV)) {
	an = kan*exp(ean*v)
	bn = kbn*exp(ebn*v)

	ap = kap*exp(eap*v)
	bp = kbp*exp(ebp*v)

	ninf = an/(an + bn)
	ntau = 1/(an + bn)
	pinf = ap/(ap + bp)
	ptau = 1/(ap + bp)
}
I have done the algebra to convert the channel parameters taken from this model to one of the equation types specified in the channel builder. It is, of course, possible that my algebra is incorrect. It is clear from the behavior of the model that my channel builder version of this channel is far from identical to the channel implemented by the .mod file.

Currently, the text to std out from the channel builder is as follows:

Code: Select all

kht_CB_1 Density Mechanism
  NonSpecific ohmic ion current
      i_kht_CB_1 (mA/cm2) = g_kht_CB_1 * (v - e_kht_CB_1)
  g = gmax * n^3 * 0
    Default gmax = 1 (S/cm2)   e = -77 (mV)
    n' = an*(1 - n) - bn*n                         (KSTrans[0])
      an = 0.2719*exp(0.04*(v - 0)))                    (Vector[7])
      bn = 0.1974                                       (Vector[8])
    p' = ap*(1 - p) - bp*p                         (KSTrans[1])
      ap = 0.00713*exp(-0.1943*(v - 0)))                (Vector[11])
      bp = 0.0935*exp(0.0058*(v - 0)))                  (Vector[12])
      
When I try to specify an ion for the channel builder version, it crashes the entire GUI. The error is below.

Code: Select all

nrniv(16193,0x106879dc0) malloc: *** error for object 0x7fc0eca58080: pointer being realloc'd was not allocated
nrniv(16193,0x106879dc0) malloc: *** set a breakpoint in malloc_error_break to debug
/Users/pedersonam/ModelMOC/Alia/Today/AMP_model/x86_64/special: line 13: 16193 Abort trap: 6           "${NRNIV}" -dll "/Users/pedersonam/ModelMOC/Alia/Today/AMP_model/x86_64/.libs/libnrnmech.so" "$@"
Clearly, there is an issue with the NonSpecific ion parameter, as mentioned above. I suspect I can fix that by creating the channel from scratch.

The other issues I see are:
1) The equation for g has a zero term in it

2) That zero term really should be replaced with a (1 - gamma + gamma*p). I am not sure how to modify the equation for g in the GUI, and I don't see any place to add the gamma.

3)The .mod file provides a g_bar value, which I understand to be different from g_max. Thus, the setting for g_max is currently arbitrary. I anticipate this is also a problem. I have set the channel density value in the CellBuilder for my neuron to the g_bar specified in the .mod file.


Any help with solving any of the above problems would be greatly appreciated!

Thank you,

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

Re: Convert a channel from .mod to the channel builder to modify gating in the GUI

Post by ted »

The principal strengths of the Channel Builder over NMODL as a means for implementing ion channels are
1. It makes syntax errors impossible (unlike NMODL, which practically invites them). Anything it allows you to do will probably work.
2. Its menu of formulas for voltage gating offers only physically plausible forms.
3. It allows "at a glance" verification not only of formulas and their parameters, but also of the actual voltage dependencies of transition rates, steady state values, and time constants.
I think it is NMODL
The code is in NMODL. Time to read about NMODL--see
https://neuron.yale.edu/neuron/static/p ... /nmodl.htm
my channel builder version of this channel
You're not going to fit this entire mechanism into a single Channel Builder. The right hand side of this equation
ik = gbar*n^3*(1 - gamma + gamma*p)*(v - ek)
forces you to use two Channel Builders that are identical in all ways except one:
one will have a single gating state n, and the other will have two gating states n and p. The former will generate a current described by this equation
ik = gbar*n^3*(1 - gamma)*(v - ek)
and the latter will generate a current described by this equation
ik = gbar*n^3*gamma*p*(v - ek)

The resulting implementation will be very cumbersome to work with. It's going to occupy a lot of real estate on your desktop (after all, it will use two Channel Builders). Any parameter you change in one Channel Builder will also have to be changed in the other; responsibility for establishing and maintaining that match is entirely up to the user. Say goodbye to most of the strengths of using the Channel Builder to implement ion channels.

You're probably better off just using the NMODL implementation. All of its parameters are visible to hoc and Python, and all will appear in the "Globals" panel that pops up when you click on
NEURON Main Menu / Tools / Distributed Mechanisms / Viewers / Mechanisms (Globals) / HT because every variable declared in the PARAMETER block is automatically global unless it is also declared to be RANGE in the NEURON block. If you don't use the Channel Builder but still want to see plots of the voltage dependence of ninf, ntau etc. you'll have to write some code that evaluates and plots those values as functions of v.
aliaped
Posts: 7
Joined: Sun Aug 09, 2020 12:10 pm

Re: Convert a channel from .mod to the channel builder to modify gating in the GUI

Post by aliaped »

Dear Ted,

Thank you for your prompt and thorough answer to my question!

I have actually been doing what you suggested, graphing the ninf and pinf values from the the .mod file vs. voltage and visualising/modifying the parameters in the Mechanism Viewer.

I was drawn to the channel builder for a single powerful feature - the ability to interactively modify (drag) the activation/inactivation/inf curves in the GUI, and have those modifications reflected in the parameter values. I would like very much to write code to add this functionality to my standalone graphs, and wonder if you could point me in the right direction. Perhaps there is a bit of code in the channel builder that allows for this dynamic modification? I realise this is not a trivial problem, but because it is difficult to conceptualize the individual function of each of the provided values (gamma, kan through kbp, ean through ebp) on macro level channel dynamics, this interactive modification is very attractive. Might you have an idea of how to implement this outside the channel builder?

Many thanks,

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

Re: Convert a channel from .mod to the channel builder to modify gating in the GUI

Post by ted »

Lots of other things to do, little time. The Channel Builder's source code is in nrn/share/nrn/lib/hoc/chanbild.hoc and the subdirectory nrn/share/nrn/lib/hoc/chanbild. Have fun!
ted
Site Admin
Posts: 5896
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Convert a channel from .mod to the channel builder to modify gating in the GUI

Post by ted »

Chapter 14 of the NEURON Book contains some information about GUI programming in NEURON that might help: https://www.neuron.yale.edu/ftp/ted/boo ... ndexed.pdf
Post Reply