a better understanding of how to manipulate a calcium chann

NMODL and the Channel Builder.
Post Reply
Aude

a better understanding of how to manipulate a calcium chann

Post by Aude »

Hello Ted,

I am new to NEURON and currently trying to observe how internal calcium interacts with other channels in my model (these consist of a diffusison channel for the calcium and a calcium-activated K channel). I have been using Migliore's modelling as a guideline throughout but am having trouble manipulating internal calcium concentrations and the calcium current itself ('ica').

Using the cadifus mechanism, how does one initialize [Ca] in each shell? And can I use cadifus with no membrane Ca channel (i.e., set different [Ca] in each shell and watch the internal diffusion)? Currently, all I can do is observe how concentration in each of my 4 annulli changes with time by using 'ca_cadifus[]'...

Any help/input on your behalf would be much appreciated. Also, please let me know if I can be any clearer in explaining all this. Thank you for your time.

Kind regards,
Aude
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: a better understanding of how to manipulate a calcium ch

Post by ted »

Aude wrote:Using the cadifus mechanism, how does one initialize [Ca] in each shell?
First a couple of comments about mechanism names (or more properly, suffixes, since
we're discussing a density mechanism). The only "standard" names for density
mechanisms in NEURON are hh and pas. Different programmers may use the same
name for very different mechanisms, or different names for mechanisms that are
otherwise identical (although this may be less frequent). There are even cases in which
a programmer may have two or more mechanisms with the same name. Also, there is
no necessary relationship between the mechanism name and the name of the file that
contains the code that defines its properties.

Case in point: NEURON comes with two files in examples/nrniv/nmodl that are called
cadif.mod and cadifusl.mod. These define two different mechanisms--in particular, they
have quite different INITIAL blocks--but their NEURON blocks declare SUFFIX cadif.

cadif.mod has the more complex INITIAL block.

Code: Select all

INITIAL {
        if (factors_done == 0) {
                factors_done = 1
                factors()
        }

        cai = cai0
        Kd = k1buf/k2buf
        B0 = TotalBuffer/(1 + Kd*cai)

        FROM i=0 TO NANN-1 {
                ca[i] = cai
                Buffer[i] = B0
                CaBuffer[i] = TotalBuffer - B0
        }
}
This starts with an "if clause" that computes a set of factors that depend on the
geometry of Ca diffusion (radial diffusion in a set of concentric cylinders).
The other statements implement a steady state initialization under the assumptions
that (1) cai (free Ca) equals cai0 across the diameter of the section, and (2) the
buffering reaction is in steady state.

But maybe I didn't guess the source code that you referred to?
And can I use cadifus with no membrane Ca channel (i.e., set different [Ca] in each shell and watch the internal diffusion)?
You can force the initial free Ca in any of the shells to be anything you want. Chapter
8 of The NEURON Book contains a thorough discussion of initialization, and includes
a section called 8.4 Examples of custom initializations

Suppose you have set up a Vector called initial_cai with NANN elements, and you have
assigned the concentrations you want to these elements. Then you could use a custom
proc init() in your hoc code, like this:

Code: Select all

proc init() { local ii
  finitialize(v_init)
  for ii=0,NANN-1 ca_cadifus[ii] = initial_ca.x[ii]
  if (cvode.active()) {
    cvode.re_init()
  } else {
    fcurrent()
  }
  frecord_init()
}
This should be loaded _after_ the standard run system is loaded. If your model has
more than one section, or has no default section, you will need to specify which
sections are to have custom initialization of Ca. You could append the sections to a
SectionList, and change the for loop to

Code: Select all

  forsec seclistname {
    for ii=0,NANN-1 . . .
  }
If you are thinking of simulating an "uncaging" experiment, it might be better to use
an FInitializeHandler--see
http://www.neuron.yale.edu/neuron/stati ... ithnd.html
Aude

Re: a better understanding of how to manipulate a calcium ch

Post by Aude »

Hi Ted,

Thanks for the prompt reply. Just to make my posting more complete, here is the source code that I am using for my Ca diffusion channel:

Code: Select all

*****************************************************
NEURON {
	SUFFIX cadifus
	USEION ca READ cao, cai,ica WRITE cai,ica
	GLOBAL vol, Buffer0
	RANGE ipump
}

DEFINE NANN  4

UNITS {
    (mol)   = (1)
	(molar) = (1/liter)
	(mM)	= (millimolar)
	(um)	= (micron)
	(mA)	= (milliamp)
	FARADAY = (faraday)	 (10000 coulomb)
	PI	= (pi) (1)
}

PARAMETER {
	DFree = .6	(um2/ms)
	diam		(um)
	cao         (mM)
	ica         (mA/cm2)
	k1buf = 500	(/mM-ms)
	k2buf = 0.5	(/ms)
    k1=1.e10    (um3/s)
    k2=50.e7    (/s)	: k1*50.e-3
    k3=1.e10    (/s)	: k1
    k4=5.e6	    (um3/s)	: k1*5.e-4
	area        (um2)
} 

CONSTANT { volo=1  (liter)}

ASSIGNED {
	cai		(mM)
	vol[NANN]	(1)	: gets extra cm2 when multiplied by diam^2
	ipump           (mA/cm2)
	last_ipump           (mA/cm2)

}

STATE {
	ca[NANN]	(mM) <1.e-5> : ca[0] is equivalent to cai
	CaBuffer[NANN]  (mM)
	Buffer[NANN]    (mM)
        pump            (mol/cm2) <1.e-3>
        pumpca          (mol/cm2) <1.e-15>

}

LOCAL totpump, kd,totbuf

INITIAL {
           totpump=0.2
           pump=totpump/(1+1.e-18*k4*cao/k3)
           pumpca=2.e-22
	   ipump=0

           totbuf=1.2
           kd=k2buf/k1buf
           FROM i=0 TO NANN-1 {
                ca[i] = cai
		CaBuffer[i] =(totbuf*ca[i])/(kd+ca[i])
		Buffer[i] = totbuf - CaBuffer[i]
                }

}

BREAKPOINT {
	SOLVE state METHOD sparse
	last_ipump=ipump
	ica = ipump
}

LOCAL coord_done

INITIAL {
	if (coord_done == 0) {
		coord_done = 1
		coord()
	}
	: note Buffer gets set to Buffer0 automatically
	: and CaBuffer gets set to 0 (Default value of CaBuffer0) as well
	FROM i=0 TO NANN-1 {
		ca[i] = cai
	}
}

LOCAL frat[NANN] 	: gets extra cm when multiplied by diam

PROCEDURE coord() {
	LOCAL r, dr2
	: cylindrical coordinate system  with constant annuli thickness to
	: center of cell. Note however that the first annulus is half thickness
	: so that the concentration is second order correct spatially at
	: the membrane or exact edge of the cell.
	: note ca[0] is at edge of cell
	:      ca[NANN-1] is at center of cell
	r = 1/2					:starts at edge (half diam)
	dr2 = r/(NANN-1)/2			:half thickness of annulus
	vol[0] = 0
	frat[0] = 2*r
	FROM i=0 TO NANN-2 {
		vol[i] = vol[i] + PI*(r-dr2/2)*2*dr2	:interior half
		r = r - dr2
		frat[i+1] = 2*PI*r/(2*dr2)	:exterior edge of annulus
					: divided by distance between centers
		r = r - dr2
		vol[i+1] = PI*(r+dr2/2)*2*dr2	:outer half of annulus
	}
}

LOCAL dsq, dsqvol : can't define local variable in KINETIC block or use
		:  in COMPARTMENT

KINETIC state {
	COMPARTMENT i, diam*diam*vol[i]*1(um) {ca CaBuffer Buffer}
        COMPARTMENT (1.e10)*area {pump pumpca}
        COMPARTMENT (1.e15)*volo {cao}

	~ ca[0] << (-(ica-last_ipump)*PI*diam*frat[0]*1(um)/(2*FARADAY))
	FROM i=0 TO NANN-2 {
		~ ca[i] <-> ca[i+1] (DFree*frat[i+1]*1(um), DFree*frat[i+1]*1(um))
	}
	dsq = diam*diam*1(um)
	FROM i=0 TO NANN-1 {
		dsqvol = dsq*vol[i]
		~ ca[i] + Buffer[i] <-> CaBuffer[i] (k1buf*dsqvol,k2buf*dsqvol)
	}
        ~ca[0] + pump <-> pumpca ((1.e-11)*k1*area, (1.e7)*k2*area)
        ~pumpca       <-> pump + cao ((1.e7)*k3*area, (1.e-11)*k4*area)

        ipump = 2*FARADAY*(f_flux-b_flux)/area

	cai = ca[0]
}
	
COMMENT
At this time, conductances (and channel states and currents are
calculated at the midpoint of a dt interval.  Membrane potential and
concentrations are calculated at the edges of a dt interval.  With
secondorder=2 everything turns out to be second order correct.
ENDCOMMENT

************************************************
I have ordered the book and will try to implement your suggestions to manipulate my initial free Ca. Thanks for the help!

kind regards,
Aude
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

I took advantage of being moderator, by editing your post and making one change:
selecting the NMODL code, then clicking on the "Code" button. The result is that leading
spaces are displayed properly, instead of disappearing which is the default for ordinary
text.
Aude

equivalent functions for cvode.active() and cvode.re_init()

Post by Aude »

Hey Ted,

Upon trying to create a custom proc init() function in my hoc code, I realized that I can't fully implement the code that you suggested. The reason is that I am using a fixed time step dt of .05 ms to carry out my experiment. This is because our stimulus is a white-noise current injection. Given this, is there equivalent functions to cvode.active() and cvode.re_init() that I can use in my hoc file to implement your suggestion?

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

Re: equivalent functions for cvode.active() and cvode.re_ini

Post by ted »

is there equivalent functions to cvode.active() and cvode.re_init() that I can use in my hoc file to implement your suggestion?
This is not an issue. The if clause in the cusom finitialize() allows it to work regardless of
whether cvode is active (variable time steps) or not (fixed time steps).
Aude

Post by Aude »

Hey Ted,

Unfortunately, I seem to get the following error if I use cvode.active() and cvode.re_init():

/Applications/NEURON-5.7/nrn/powerpc/bin/nrniv.app/Contents/MacOS/nrniv: parse error in mainCurrentStep.hoc near line 81
if (cvode.active()) {

Do I have to initialize anything at the beginning of my hoc code for it to work?

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

Post by ted »

Maybe you're not loading the standard run system. How are you starting
NEURON? Are you opening an xterm and typing nrniv filename.hoc? or are
you dragging and dropping your hoc file on top of the nrngui icon? I'm not
very familiar with 5.7 on the PowerPC; does it include an nrniv icon, and
are you dropping your hoc file onto that?
Aude

Post by Aude »

Hey Ted,

I am starting NEURON by running a MATLAB file that calls to my mod files by means of the following path and then initiates my hoc file. The commands I use are seen below:

Code: Select all

unix('/Applications/NEURON-5.7/nrn/powerpc/bin/nrnivmodl migliore_kCa migliore_caldiff migcaln', '-echo')

unix('powerpc/special mainCurrentStep.hoc', '-echo')
The following is then printed to my screen while NEURON is running:

Code: Select all

"/Applications/NEURON-5.7/nrn/share/nrn/libtool" --mode=compile gcc -DHAVE_CONFIG_H  -I. -I.. -I"/Applications/NEURON-5.7/nrn/include/nrn" -I"/Applications/NEURON-5.7/nrn/powerpc/lib"    -g -O2 -c -o mod_func.lo mod_func.c
 gcc -DHAVE_CONFIG_H -I. -I.. -I/Applications/NEURON-5.7/nrn/include/nrn -I/Applications/NEURON-5.7/nrn/powerpc/lib -g -O2 -c mod_func.c  -fno-common -DPIC -o .libs/mod_func.o
"/Applications/NEURON-5.7/nrn/share/nrn/libtool" --mode=link gcc -module  -g -O2   -o libnrnmech.la -rpath "/Applications/NEURON-5.7/nrn/powerpc/lib"  migliore_kCa.lo migliore_caldiff.lo migcaln.lo mod_func.lo  -L"/Applications/NEURON-5.7/nrn/powerpc/lib" -lnrnoc -loc -lmemacs -lscopmath -lsparse13 -lreadline -lncurses 
rm -fr  .libs/libnrnmech.0.0.0.so .libs/libnrnmech.0.so .libs/libnrnmech.la .libs/libnrnmech.lai .libs/libnrnmech.so
gcc -bundle -flat_namespace -undefined suppress -o .libs/libnrnmech.0.0.0.so  .libs/migliore_kCa.o .libs/migliore_caldiff.o .libs/migcaln.o .libs/mod_func.o  -L/Applications/NEURON-5.7/nrn/powerpc/lib /Applications/NEURON-5.7/nrn/powerpc/lib/libnrnoc.dylib /Applications/NEURON-5.7/nrn/powerpc/lib/liboc.dylib /Applications/NEURON-5.7/nrn/powerpc/lib/libmemacs.dylib /Applications/NEURON-5.7/nrn/powerpc/lib/libscopmath.dylib /Applications/NEURON-5.7/nrn/powerpc/lib/libsparse13.dylib /Applications/NEURON-5.7/nrn/powerpc/lib/libreadline.dylib -lncurses
ld: warning multiple definitions of symbol _dlclose
/Applications/NEURON-5.7/nrn/powerpc/lib/libnrnoc.dylib(init.o) definition of _dlclose
/usr/lib/libSystem.dylib(dyldAPIsInLibSystem.o) definition of _dlclose
ld: warning multiple definitions of symbol _dlerror
/Applications/NEURON-5.7/nrn/powerpc/lib/libnrnoc.dylib(init.o) definition of _dlerror
/usr/lib/libSystem.dylib(dyldAPIsInLibSystem.o) definition of _dlerror
ld: warning multiple definitions of symbol _dlopen
/Applications/NEURON-5.7/nrn/powerpc/lib/libnrnoc.dylib(init.o) definition of _dlopen
/usr/lib/libSystem.dylib(dyldAPIsInLibSystem.o) definition of _dlopen
ld: warning multiple definitions of symbol _dlsym
/Applications/NEURON-5.7/nrn/powerpc/lib/libnrnoc.dylib(init.o) definition of _dlsym
/usr/lib/libSystem.dylib(dyldAPIsInLibSystem.o) definition of _dlsym
(cd .libs && rm -f libnrnmech.0.so && ln -s libnrnmech.0.0.0.so libnrnmech.0.so)
(cd .libs && rm -f libnrnmech.so && ln -s libnrnmech.0.0.0.so libnrnmech.so)
creating libnrnmech.la
(cd .libs && rm -f libnrnmech.la && ln -s ../libnrnmech.la libnrnmech.la)
Successfully created powerpc/special

ans =

     0

NEURON -- Version 5.7 2004-11-11 8:22:55 Main (71)
by John W. Moore, Michael Hines, and Ted Carnevale
Duke and Yale University -- Copyright 2001

loading membrane mechanisms from /Users/erik/Desktop/AudeNeuronModels/FIRSTACTIVENOISE/kCa_files/powerpc/.libs/libnrnmech.so
Additional mechanisms from files
 migliore_kCa.mod migliore_caldiff.mod migcaln.mod
Created Java VM
java version "1.3.1_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_16-root_1.3.1_050718-17:36)
Java HotSpot(TM) Client VM (build 1.3.1_09-82, mixed mode)
	1 

I am not using an nrgui icon. Does this answer your question? Let me know if I can be any clearer. Thanks!

kind regards,
Aude
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Does your hoc code contain this statement
load_file("nrngui.hoc")
or this one
load_file("noload.hoc")
?
How do you deal with simulation execution? Do you call run(), or do you
have a loop that repeatedly calls fadvance()?
Aude

Post by Aude »

Hey Ted,

I do not load nrgui.hoc and do not use noload.hoc either. I do have fadvance repeatedly called in a loop in my hoc file.

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

Post by ted »

That explains it. A lot of "legacy code" is floating around that doesn't make
use of the standard run system, and that's probably what you started from.
That's OK as long as you never need to use any of NEURON's powerful GUI
tools for model analysis and control--like ModelView, the MultipleRunFitter,
and the Variable Time Step control--and you don't mind having to deal
with low level details like how to make sure that graphs are updated.

At this point, the question is whether it's worth modifying your code so that
it uses the standard run system. The easiest tactic is to proceed as you are
doing--defer changing to the standard run system until you run into a
problem that can't be solved without it.

So in the custom init() that I showed you earlier, just comment out the
stuff that tests for, and reinitializes, cvode.

Code: Select all

proc init() { local ii
  finitialize(v_init)
  for ii=0,NANN-1 ca_cadifus[ii] = initial_ca.x[ii]
//  if (cvode.active()) {
//    cvode.re_init()
//  } else {
    fcurrent()
//  }
  frecord_init()
}
I should have mentioned this in my original message:
If nseg>1 or your model has more than 1 section, the for loop must
iterate over all segments in all sections

Code: Select all

  forall for (x,0) { for ii=0,NANN-1 ca_cadifus[ii] = initial_ca.x[ii] }
Post Reply