Synaptic conductance driven by a waveform

NMODL and the Channel Builder.
Post Reply
Corinne
Posts: 38
Joined: Wed Feb 09, 2011 7:13 pm

Synaptic conductance driven by a waveform

Post by Corinne »

I am trying to model a synapse by changing the membrane conductance (as opposed to injecting a current) according to a wave form I specify. In order to do this I am using a dynamic clamp code provided at http://www.neuron.yale.edu/phpbb/viewto ... land#p5920 which I am also posting below.

Code: Select all

COMMENT
    This is a dynamic clamp (a.k.a conductance clamp). To use it, play a stimulus conductance vector into the g range variable. Set the reversal potential of the conductance with the e range variable. Record the injected current with the i range variable.
    ENDCOMMENT

    NEURON {
       POINT_PROCESS GClamp
       RANGE g, i, e
       ELECTRODE_CURRENT i
    }

    UNITS {
       (mV) = (millivolt)
       (uS) = (micromho)
       (nA) = (nanoamp)
    }

    PARAMETER {
       g (micromho)
       e (millivolt)
       v (millivolt)
    }
    ASSIGNED { i (nanoamp) }

    INITIAL {
       i = g*(v-e)
    }

    BREAKPOINT {
       i=g*(v-e)
    }
I am using the gui to use this code. To do this, first I add a GClamp via the Tools>>Point Process. In order to load the conductance vector into the GClamp I go to the NEURON Main Menu and go to Vector>>Retrieve From File and load the appropriate file. This file has two columns of data: the first column is time the second is the conductance wave form. Then I choose Vector>>Play which creates a VectorPlay window. Within this window I tell it to get the Vector from clipboard and Specify that this vector is played into the GClamp. I have tested to make sure this all works as expected on several different 'test' wave forms such as a Gaussian and a square wave. However; when I input the particular wave I would like to use (which looks similar to the wave created by an alpha synapse) the voltage oscillates out of control (this file is the same length and has the same time steps as the 'test' waves). I am not sure why this wave would create problems but believe it is the integration method that is the issue. I think this because if I try to use the variable time step method or change secondorder=1 or secondorder=2 some of the other 'test' waves no longer work (i.e. the voltage out put starts oscillating out of control). So I am wondering if it is possible to change the integration method to something like the cnexp in the gui?

Any help would be greatly appreciated! Thanks!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

To diagnose the problem and suggest a fix it will be necessary to reproduce it. If you zip up the relevant code (hoc, ses, mod, and one or two "waveform data files") and send them to me
ted dot carnevale at yale dot edu
I'll let you know what I find out.
Corinne
Posts: 38
Joined: Wed Feb 09, 2011 7:13 pm

Re: Synaptic conductance driven by a waveform

Post by Corinne »

I have sent it via email. Thanks so much for your help on this!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

Change the
ELECTRODE_CURRENT i
declaration in the NEURON block to
NONSPECIFIC_CURRENT i
and it will work properly.

Comments:
1. The underlying cause, and why only a particular conductance time series caused trouble, remain to be determined and fixed. Either ELECTRODE_CURRENT or NONSPECIFIC_CURRENT should have worked equally well for this application.
2. The GClamp mechanism isn't really necessary. While looking into this problem, I found that one could simply use an AlphaSynapse with onset = 0, and play the conductance data into the gmax parameter.
3. The troublesome data have a problem of their own, in that values become negative near the end of the vector; you should decide what to do about that (replace all negative values with 0?). However, this is not responsible for the instability that occurs early in the course of the simulation.
4. The model is not initialized to steady state. Notice what happens to v in the absence of "synaptic input." This means all responses for the first [however many] ms are contaminated by a hyperpolarizing shift of membrane potential. The simplest fix for this completely passive model with uniform e_pas is to ensure that e_pas and v_init have the same value. By default, e_pas == -70 mV but v_init == -65 mV (resting potential of the HH mechanism). You could either specify
v_init = -70
with the RunControl panel (numeric field adjacent to the Init button), or execute the statement
forall e_pas = v_init
after loading the session file that contains the model specification.
Corinne
Posts: 38
Joined: Wed Feb 09, 2011 7:13 pm

Re: Synaptic conductance driven by a waveform

Post by Corinne »

Thanks Ted! Happy New Year!
Corinne
Posts: 38
Joined: Wed Feb 09, 2011 7:13 pm

Re: Synaptic conductance driven by a waveform

Post by Corinne »

Hi Ted,

I have been trying to get this thing to work but I don't understand it. Below are some question to your comments.

1. I changed the ELECTRODE_CURRENT i to a NONSPECIFIC_CURRENT i. Although it took care of the instability near the beginning of the voltage trace it still blows up toward the end of the trace. I thought that maybe it is because as you mentioned in #3 perhaps it is because the data go negative in my trace. I was aware of this, but, I wasn't sure why this would break the GClamp. I assumed this would just change the sign of the current. Is there something you think I am missing? The whole thing is very strange. A friend sent me a session file where she used this GClamp in the same way. Her conductance waveform oscillates above/below zero and it works for her. So I am not sure what the problems might be. The GClamp code is extremely simple:

Code: Select all

    INITIAL {
       i = g*(v-e)
    }

    BREAKPOINT {
       i=g*(v-e)
    }
2. I tried to bypass all of this confusion and use an AlphaSynape as you mentioned. I played the conductance trace in to gmax. However, I was not sure what to do with tau. I set it to the smallest value possible since The maximum value of g, gmax, occurs at t = delay + tau but that did not yield results that looked correct for the square wave. I tried varying the tau but did not get results that looked like the GClamp. Am I missing something?

Thanks for your help!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

ted wrote:Change the
ELECTRODE_CURRENT i
declaration in the NEURON block to
NONSPECIFIC_CURRENT i
and it will work properly.
. . .
The underlying cause, and why only a particular conductance time series caused trouble, remain to be determined and fixed. Either ELECTRODE_CURRENT or NONSPECIFIC_CURRENT should have worked equally well for this application.
Michael hines pointed out some important facts that should clear up all confusion. Here I quote/paraphrase/discuss those that are most directly related to your particular question*:

A conceptual decision has to be made about whether one wishes to specify a membrane conductance (as in a dynamic clamp) or specify a voltage clamp series conductance (analogous to SEClamp).

The former must use NONSPECIFIC_CURRENT with
i = g*(v - e)
This is a membrane current, so i > 0 means "outward current" i.e. positive charge exiting the cell, which will hyperpoloarize v.

The latter must use ELECTRODE_CURRENT with
i = g*(vc - v)
This is an injected current (a current injected directly into the cell via an electrode), so i > 0 means deposition of positive charge into the cell, which will depolarize v.


Suppose you have a mechanism that generates a NONSPECIFIC_CURRENT, and something happens that depolarizes v. This makes v - e move in a positive direction, which makes i also move in a positive direction i.e. become more outward or hyperpolarizing. This opposes the initial depolarization, and so tends to stablilize membrane potential.

What happens if there is a mechanism that generates an ELECTRODE_CURRENT specified by i = g*(vc - v)? Depolarization of v makes vc - v move in a negative direction, which makes i also move in a negative direction, i.e. become more hyperpolarizing (remember that an ELECTRODE_CURRENT's i represents charge injected directly into the cell). Again, the effect is to oppose the initial depolarization, stablilizing membrane potential.

But what if there is an ELECTRODE_CURRENT mechanism whose current is specified by i = g*(v - e)? A depolarizing fluctuation of v makes v - e move in a positive direction, and this makes i more positive, which in turn results in more depolarization--a positive feedback loop that can produce instability.

The effects of current-generating mechanisms that increase stability and those that induce instability are sometimes discussed in terms of "positive conductance" and "negative conductance." An ion channel with positive conductance is one whose IV plot has a positive slope--make the membrane potential more positive, and the current through the channel becomes more positive. A channel with negative conductance has an IV plot that somewhere shows a negative slope. The HH sodium channel's IV plot has a region in which there is a transient negative resistance: depolarization is followed by a brief interval in which the sodium channel produces an inward current, which can lead to runaway depolarization. But the HH sodium channel's negative resistance doesn't cause simulations to blow up because it exists only over a limited range of membrane potentials. An ELECTRODE_CURRENT described by i = g*(v - e) has negative resistance for all values of v. The magnitude of the negative resistance depends on the value of g, and the effect on simulation stability depends on how rapidly g is changing and what other ionic currents may be present. Given the right combination, the result is a simulation that blows up.

"Well, this is true only if g > 0. I can fix the GClamp mechanism by making g < 0. Or, if that seems too weird, I could keep g > 0 but write i = g*(e - v)."

You could, but why bother? You don't really want an ELECTRODE_CURRENT mechanism. Your conceptual model is that you have a cell with a synaptic mechanism, and you want to make that mechanism's conductance follow a particular waveform. Change the declaration in the NEURON block to
NONSPECIFIC_CURRENT i
and leave the current equation
i = g*(v - e)
just like it is for every other synaptic mechanism.

*--There are also a couple more facts which apply to any section that has NEURON's extracellular mechanism:
1. For a NONSPECIFIC_CURRENT, v refers to vinside-voutside_next_to_the_membrane, i.e. the true transmembrane potential.
2. For an ELECTRODE_CURRENT, v refers to vinside (i.e relative to ground, that is, the sum of transmembrane potential and any radial voltage drop across the extracellular mechanism).

Your model doesn't involve extracellular so the above discussion doesn't touch on these.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

Corinne wrote:I changed the ELECTRODE_CURRENT i to a NONSPECIFIC_CURRENT i. Although it took care of the instability near the beginning of the voltage trace it still blows up toward the end of the trace. I thought that maybe it is because . . . the data go negative in my trace.
This is true.
I wasn't sure why this would break the GClamp. I assumed this would just change the sign of the current. Is there something you think I am missing?
Negative conductance, if large enough, can cause instability--see my other post from earlier today.
A friend sent me a session file where she used this GClamp in the same way. Her conductance waveform oscillates above/below zero and it works for her.
Maybe so, but this is a case in which it would be better for the simulation to blow up.

"Why?"

Because the simulation results are garbage.

"Why?"

Because they violate the laws of thermodynamics. Think about it. The current through an ionic channel is proportional to the transmembrane electrochemical gradient for that ion. We're not talking about active transport here, we're talking about ions moving from a region of higher potential energy to a region of lower potential energy. The electrochemical gradient is v - e, where e is the ion's reversal potential and represents the chemical gradient, and v is the voltage drop v across the membrane. Given v - e > 0, positively charged ions will flow from the inside of the cell, through the channel, to the outside of the cell, at a rate that depends on the channel's conductance g:

i = g*(v - e)

Now your friend is driving g with a signal that fluctuates between positive and negative values. Positive values are OK. Zero values are OK. But when g becomes negative, the ions must move AGAINST their electrochemical gradient. This means they're gaining potential energy. I want the patent on that.

But seriously, what's the point of simulations that involve imposing something that violates the known laws of nature? Can't possibly publish such work.
I tried to bypass all of this confusion and use an AlphaSynape as you mentioned. I played the conductance trace in to gmax. However, I was not sure what to do with tau. I set it to the smallest value possible since The maximum value of g, gmax, occurs at t = delay + tau but that did not yield results that looked correct for the square wave. I tried varying the tau but did not get results that looked like the GClamp. Am I missing something?
Don't know, and at this point it's an entirely moot issue. Don't bother driving AlphaSynapse's gmax. Just use the fixed GClamp.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

After you've had a chance to read all this, I'm going to change the title of the thread to something more appropriate for its actual contents--which are mostly about NMODL--and maybe move it to a different and more appropriate area of the Forum.
Corinne
Posts: 38
Joined: Wed Feb 09, 2011 7:13 pm

Re: Synaptic conductance driven by a waveform

Post by Corinne »

Thank you Ted and Michael!

I figured out the scale of the conductance I was injecting was way to large; therefore, my small oscillation around zero (which although I agree doesn't make sense to have a negative conductance, but nonetheless...) was causing my simulation to blow up in my case.

Go a head and change the name of the thread. But let me know what it is so that I can reference it later.

Thanks for all your help!
C
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

If you need a fluctuating synaptic conductance, just make sure that the conductance is always > 0.
Corinne
Posts: 38
Joined: Wed Feb 09, 2011 7:13 pm

Re: Synaptic conductance driven by a waveform

Post by Corinne »

Hola,

I am trying to figure out how to code the GClamp in .hoc code. Via the gui, after inserting a GClamp from the Point Process Menu (which I assume I would do the following in .hoc:

Code: Select all

objref syn
soma syn = new GClamp(0)  //make soma(0) the "reference point"
syn.e = -80 //mV  only variable that is specified in GClamp)
I do the following things via the gui

Vector >> retrieve from file (select the file)
Vector >> play
From the VectorPlay plot menu
Specify >> Vector From Clipboard
Specify >> Variable Name (input 'GClamp[0]g)
Then must select the Connected push button so that it is green.

However, I have no idea how to do this via .hoc code. I made a simple session that did just this via the gui and looked at the .hoc to try to get some hints (code below), but, I couldn't understand it, and I am not sure it gives me what I need. My guess is that there is a better/simple way to do it. Any advice is greatly appreciated!

Code: Select all

{load_file("nrngui.hoc")}
objectvar save_window_, rvp_
objectvar scene_vector_[3]
objectvar ocbox_, ocbox_list_, scene_, scene_list_
{ocbox_list_ = new List()  scene_list_ = new List()}
{pwman_place(191,53,1)}

//Begin VectorPlay[0]
{
load_file("vplay.hoc")
}
{
ocbox_=new VectorPlay(1)
}
{object_push(ocbox_)}
vy = new Vector(1051)
vx = new Vector(1051)
for i=0,1050 { vx.x[i]=fscan() vy.x[i]=fscan()}
0 0
0.05 8.36321e-07
0.1 1.8303e-06
.
.
.
B
I
G

L
O
N
G

V
E
C
T
O
R
.
.
.

{vy.plot(g, vx)}
{sname = "GClamp[0].g"  have_name = 1  contin = 0 con1(0)}
{object_pop()}
{
{
save_window_=ocbox_.g
save_window_.size(0,300,0,200)
scene_vector_[2] = save_window_
ocbox_.g = save_window_
save_window_.save_name("ocbox_.g")
}
ocbox_ = ocbox_.b
ocbox_.map("VectorPlay[0]", 28, 103, 376, 240)
}
objref ocbox_
//End VectorPlay[0]

objectvar scene_vector_[1]
{doNotify()}
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Synaptic conductance driven by a waveform

Post by ted »

Two tasks are to be performed:
1. read time stream data from a file into a pair of Vectors--one for the series of conductance values, the other for the corresponding times
2. arrange for the conductance values to be played into the desired target variable at the appropriate times

Task 1 (reading data from a file) is straightforward to do with the File and Vector classes. Assuming the data file format is
t0 g0
t1 g1
etc.
where each tg pair specifies the conductance g at a particular time t, you could use the example provided by this item in the "Hot tips" area of the Forum--
How to read numerical values from a file
I'd call the vectors gvec and tvec.

Then, if you have a point process that has some variable g that you want to drive with the waveform data (assuming that the point process is already attached to a section and is referenced by an objref called pp, and the )--
gvec.play(&pp.g, tvec, 1)
Notice the third argument is 1. This is the "continuous" argument; you should read about it in the Programmer's Reference discussion of the Vector class's play method.
http://www.neuron.yale.edu/neuron/stati ... .html#play
Post Reply