Using ion_style() to treat eca as a fixed parameter and cai as a dynamical variable

NMODL and the Channel Builder.
Post Reply
pascal
Posts: 116
Joined: Thu Apr 26, 2012 11:51 am

Using ion_style() to treat eca as a fixed parameter and cai as a dynamical variable

Post by pascal »

I am porting Bazhenov's 2002 thalamocortical model of sleep-wake transitions (https://senselab.med.yale.edu/ModelDB/s ... 189#tabs-1) to NEURON. The model has a calcium current, as well as a calcium-dependent K+ current. As far as I can tell (I am trying to get the authors to respond on this point), they fix the calcium reversal potential (setting eca=140 mV), yet they allow the internal calcium concentration (cai) to vary. The model is written in C++, but cai's dynamics are based on a mod file (cadecay.mod) written by Destexhe (found here: https://senselab.med.yale.edu/ModelDB/S ... mod#tabs-2).

It seems strange to me to allow the internal calcium concentration to change while at the same time fixing eca, but I'm pretty sure that's what they did. (I may change this in my own model once I've successfully ported it, but I need to first replicate their results.) Here my questions:

1) Reading the documentation on ion_style() (https://www.neuron.yale.edu/neuron/stat ... /ions.html), it seems I should call h.ion_style("ca_ion",3, 1, 0, 0, 0, sec) , since I'm treating cai as a state variable, eca as a fixed parameter, and I don't want initialization or fadvance to change eca. Is this correct?

2) Within the mod file defining the calcium current, I assume I should place the line eca=140 (mV) within the PARAMETER (as opposed to the ASSIGNED) block...correct?
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Using ion_style() to treat eca as a fixed parameter and cai as a dynamical variable

Post by ted »

Great questions!
It seems strange to me to allow the internal calcium concentration to change while at the same time fixing eca, but I'm pretty sure that's what they did.
If that's what their code says, those are the assumptions they made. Now you understand why NEURON has ion_style(). Welcome to the world of computational modeling, in which model creators can (and do) make whatever simplifying assumptions they wish and can justify to themselves. And in which assumptions may or may not be stated explicitly in either the published article or as comments in model source code.
I need to first replicate their results
A desirable initial goal.
Reading the documentation on ion_style() (https://www.neuron.yale.edu/neuron/stat ... /ions.html), it seems I should call h.ion_style("ca_ion",3, 1, 0, 0, 0, sec) , since I'm treating cai as a state variable, eca as a fixed parameter, and I don't want initialization or fadvance to change eca. Is this correct?
Maybe, but the way to be sure is to use a toy model to check your prediction. This should be a model that has just one section, and that section has nseg == 1. Insert a mechanism that generates a calcium current with user specified onset, duration, and amplitude. Also insert a calcium accumulation mechanism that READs ica and WRITEs cai. The mechanisms cacur.mod and cacum.mod in nrn/share/examples/nrniv/nmodl will do nicely (you'll have these files if you downloaded the gzipped tar file for the standard distribution of NEURON, or cloned NEURON's git repository).

Then run a simulation in which cacur generates a calcium current starting at t==1ms and ending at 10 ms. Examine the time course of ica, cai, and eca, and print the value returned by h.ion_style("ca_ion") just to see what "ion style" NEURON chose automatically. Finally,

Code: Select all

REPEAT
  execute h.ion_style() with what you think are the desirable arguments
  run a new simulation and check the results
UNTIL you have found the arguments that produce the result you want
kindly report your final arguments in your next post
pascal
Posts: 116
Joined: Thu Apr 26, 2012 11:51 am

Re: Using ion_style() to treat eca as a fixed parameter and cai as a dynamical variable

Post by pascal »

Okay, here’s what I put together:

Code: Select all

from __future__ import division
from neuron import h, gui
import matplotlib.pyplot as plt 
import numpy as np

soma=h.Section(name='soma') #create object 'soma,' and make object variable 'name' equal to 'soma'
soma.diam = soma.L = np.sqrt(100/np.pi)
soma.cm = 1.0
soma.nseg=1

soma.insert('cacum')
#soma.cai0_cacum=2.0 #set initial value for internal calcium concentration (in mM); default value is 50e-6 mM
#since we don't prescribe cao, it is set to the global value of cai0_ca_ion (2.0 mM)
soma.eca=150 #mV for some reason this MUST be set at the NEURON level to take effect; if I simply assign it as a parameter within a mod file, it does not appear to be recognized

soma.insert('cacur')
soma.del_cacur = 1 #ms
soma.dur_cacur = 10 #ms
soma.amp_cacur = -1 #nA

 #record soma ica, cai, and eca
t_vec = h.Vector()
t_vec.record(h._ref_t)
ica_soma = h.Vector()
ica_soma.record(soma(0.5)._ref_ica)
cai_soma = h.Vector()
cai_soma.record(soma(0.5)._ref_cai)
eca_soma = h.Vector()
eca_soma.record(soma(0.5)._ref_eca)

h.ion_style("ca_ion",3,1,0,0,0,sec=soma) #use (3,1,0,0,0) in order for cai to vary, but eca to remain fixed
#use either (3,2,1,1,1) or (3,2,1,1,0) [not sure which one] for cai to vary (as dynamical variable) and for eca to be calculated from cai/cao every time step

#run simulation
h.tstop = 50 #ms
h.run()

plt.figure(figsize=(8,4))
plt.plot(t_vec,ica_soma,label='ica')
plt.xlabel('Time (ms)')
plt.ylabel('mA/cm2')
plt.legend(loc='upper right')
plt.show()

plt.figure(figsize=(8,4))
plt.plot(t_vec,cai_soma,label='cai')
plt.xlabel('Time (ms)')
plt.ylabel('mM')
plt.legend(loc='upper right')
plt.show()

plt.figure(figsize=(8,4))
plt.plot(t_vec,eca_soma,label='eca')
plt.xlabel('Time (ms)')
plt.ylabel('mV')
plt.legend(loc='upper right')
plt.show()

print(h.ion_style("ca_ion",sec=soma))
I first ran the program without using ion_style to prescribe anything (i.e., the call to ion_style in the middle of the program was commented out). I got the following results:

Image

Clearly cai is a dynamical variable, and eca is varying. The last line of the program, print(h.ion_style("ca_ion",sec=soma))("ca_ion"), output the number 247. I figured out for some reason you first need to subtract 128 before applying
c_style + 4*cinit + 8*e_style + 32*einit + 64*eadvance (from ion_style documentation, linked in my first entry of this post). So we have
119 = c_style + 4*cinit + 8*e_style + 32*einit + 64*eadvance,
which implies cstyle=3, e_style=2, einit=1, eadvance=1, cinit=1.

It also appears that my initial guess was right. Issuing the command h.ion_style("ca_ion",3,1,0,0,0,sec=soma) gave the following output:

Image

Explicitly reverting back to the default values, by issuing the command h.ion_style("ca_ion",3,2,1,1,1,sec=soma), recovers the original results (as it should).

However, as far as I can tell, the command h.ion_style("ca_ion",3,2,1,1,0,sec=soma) gives identical results. In fact, I actually understand this latter call (with cinit=0) better than the first call (with cinit=1). Setting cinit=1 is supposed to initialize the internal and external concentrations to their default, global values (for calcium, this is cai=50e-6 mM and cao=2.0 mM). Yet if I uncomment the line soma.cai0_cacum=2.0 near the top of my program and run it again with cinit=1, I get exactly the same results as before. In other words, it does not appear setting cinit=1 actually changes cai to 50e-6 mM. Any idea what is going on?

And one more question: when I used h.ion_style("ca_ion",3,1,0,0,0,sec=soma), I was able to successfully specify eca by issuing the command soma.eca=150 at the NEURON level. However, when I went into cacum.mod and added eca as a READ variable, then set eca=150 in the PARAMETER block, it had no effect. It therefore appears I need to specify eca at the NEURON level if I want my command to be recognized. Why?
Post Reply