Hello! Can You help me?
I build a model of potassium and sodium channels of Zebrafish. I have the tables that contains experimental datas of constants of activation and inactivation depending on membrane potential. How can I insert this tables into my .mod file?
Table with experimental datas
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
This is discussed briefly in Example 9.7: Kinetic scheme for a voltage-gated current in
The NEURON Book (pp. 240-245). However, a more explicit example, complete with hoc
code, would be useful. The first question is how to write the NMODL source code. The
second question is how to write the hoc code that is necessary to use this mechanism.
The following example is based on code from Andrew Davison's NEURON implementation
of the Bhalla & Bower olfactory mitral cell model, with some modifications for the sake of
clarity and/or to eliminate/replace deprecated items.
This example involves a potassium current described by
ik = gkbar*n*n*k*(v - ek)
where the gating states n and k are described by the HH-style ODEs
n' = (ninf(v) - n)/ntau(v)
k' = (kinf(v) - k)/ktau(v)
and the steady states and time constants are specified not by algebraic functions but by
interpolation of values from lookup tables.
The NMODL code for this mechanism uses the FUNCTION_TABLE keyword to specify
that the values of kinf, ktau, etc. are to be found by linear interpolation from lookup tables.
All that remains is to set up the tables of numerical values for kinf, ktau, ninf, and ntau,
and to attach the tables to this mechanism.
Suppose that the numerical values for the lookup tables are stored in four files, called
kfast_k.inf, kfast_k.tau, kfast_n.inf, and kfast_n.tau. The file contents are in the form
v0 p0
v1 p1
v2 p2
. . .
i.e. one pair of numbers per line, where the first number is a membrane potential in mV,
the second is the corresponding gating parameter (a steady state value, or a time
constant in ms), and the v values increase monotonically. For the sake of convenience,
let us assume that each file has exactly the same number and sequence of v values.
This hoc code reads the parameter files, stores the values in Vectors, then attaches the
Vectors to the kfast mechanism with the syntax
table_funcname_suffix(¶mvec.x[0], num, &indepvarvec.x[0])
where
funcname is the name of the function in the NMODL file
paramvec is the hoc vector that contains the sequence of parameter values
num is the number of rows in the table
indepvarvec is the hoc vector that contains the sequence of independent variable values
(in this case, the sequence of v values).
This code uses the standard run system's clipboard_retrieve(), which in turn uses the
Vector class's scanf() method and therefore requires the table of v, p values to end with
a number followed by a newline (see
http://www.neuron.yale.edu/neuron/stati ... html#scanf
).
The NEURON Book (pp. 240-245). However, a more explicit example, complete with hoc
code, would be useful. The first question is how to write the NMODL source code. The
second question is how to write the hoc code that is necessary to use this mechanism.
The following example is based on code from Andrew Davison's NEURON implementation
of the Bhalla & Bower olfactory mitral cell model, with some modifications for the sake of
clarity and/or to eliminate/replace deprecated items.
This example involves a potassium current described by
ik = gkbar*n*n*k*(v - ek)
where the gating states n and k are described by the HH-style ODEs
n' = (ninf(v) - n)/ntau(v)
k' = (kinf(v) - k)/ktau(v)
and the steady states and time constants are specified not by algebraic functions but by
interpolation of values from lookup tables.
The NMODL code for this mechanism uses the FUNCTION_TABLE keyword to specify
that the values of kinf, ktau, etc. are to be found by linear interpolation from lookup tables.
Code: Select all
NEURON {
SUFFIX kfast
USEION k READ ek WRITE ik
RANGE gkbar, ik
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
PARAMETER {
gkbar= 0.036 (mho/cm2)
}
STATE {
n k
}
ASSIGNED {
v (mV)
ik (mA/cm2)
ek (mV)
}
INITIAL {
n = ninf(v)
k = kinf(v)
}
BREAKPOINT {
SOLVE states METHOD cnexp
ik = gkbar*n*n*k*(v - ek)
}
DERIVATIVE states {
n' = (ninf(v) - n)/ntau(v)
k' = (kinf(v) - k)/ktau(v)
}
FUNCTION_TABLE ninf(v(mV))
FUNCTION_TABLE ntau(v(mV)) (ms)
FUNCTION_TABLE kinf(v(mV))
FUNCTION_TABLE ktau(v(mV)) (ms)
and to attach the tables to this mechanism.
Suppose that the numerical values for the lookup tables are stored in four files, called
kfast_k.inf, kfast_k.tau, kfast_n.inf, and kfast_n.tau. The file contents are in the form
v0 p0
v1 p1
v2 p2
. . .
i.e. one pair of numbers per line, where the first number is a membrane potential in mV,
the second is the corresponding gating parameter (a steady state value, or a time
constant in ms), and the v values increase monotonically. For the sake of convenience,
let us assume that each file has exactly the same number and sequence of v values.
This hoc code reads the parameter files, stores the values in Vectors, then attaches the
Vectors to the kfast mechanism with the syntax
table_funcname_suffix(¶mvec.x[0], num, &indepvarvec.x[0])
where
funcname is the name of the function in the NMODL file
paramvec is the hoc vector that contains the sequence of parameter values
num is the number of rows in the table
indepvarvec is the hoc vector that contains the sequence of independent variable values
(in this case, the sequence of v values).
This code uses the standard run system's clipboard_retrieve(), which in turn uses the
Vector class's scanf() method and therefore requires the table of v, p values to end with
a number followed by a newline (see
http://www.neuron.yale.edu/neuron/stati ... html#scanf
).
Code: Select all
objref kinfvec, ninfvec, ktauvec, ntauvec, vvec
clipboard_retrieve("kfast_k.inf")
kinfvec = hoc_obj_[0]
vvec = hoc_obj_[1]
clipboard_retrieve("kfast_n.inf")
ninfvec = hoc_obj_[0]
clipboard_retrieve("kfast_k.tau")
ktauvec = hoc_obj_[0]
clipboard_retrieve("kfast_n.tau")
ntauvec = hoc_obj_[0]
table_kinf_kfast(&kinfvec.x[0], vvec.size, &vvec.x[0])
table_ninf_kfast(&ninfvec.x[0], vvec.size, &vvec.x[0])
table_ktau_kfast(&ktauvec.x[0], vvec.size, &vvec.x[0])
table_ntau_kfast(&ntauvec.x[0], vvec.size, &vvec.x[0])
Thank You for Your comment! But I have another question.
I inserted hoc-code given by You into my .hoc file. When I load this .hoc file to project I watch a message about syntax error. Error is bonded with the symbol "x" in line: table_kinf_kfast(&kinfvec.x[0], vvec.size, &vvec.x[0]) Is it important what symbol I using in expression? And how I can to solve this problem with syntax error?
I inserted hoc-code given by You into my .hoc file. When I load this .hoc file to project I watch a message about syntax error. Error is bonded with the symbol "x" in line: table_kinf_kfast(&kinfvec.x[0], vvec.size, &vvec.x[0]) Is it important what symbol I using in expression? And how I can to solve this problem with syntax error?
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
To diagnose the problem I will have to see your code and reproduce the symptom myself.Oleg wrote:When I load this .hoc file to project I watch a message about syntax error. Error is bonded with the symbol "x" in line: table_kinf_kfast(&kinfvec.x[0], vvec.size, &vvec.x[0])
If you zip up the necessary files (no .dll, .c, or .o files) and send them to me
ted dot carnevale at yale dot edu
I will tell you what I find and how to fix the problem.