Use the same cell model multiple times

The basics of how to develop, test, and use models.
Post Reply
pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Use the same cell model multiple times

Post by pass1945 » Tue Jul 31, 2012 4:18 pm

Hi Ted,
So I'm trying to use only one cell model(.hoc), and by changing a parameter of my extracellular field stimulation, I will collect the current information responded from the stimulation. Everytime I use the cell model, there is only one variable value that I need to change. However, I found that I couldn't do a for loop, or:

Code: Select all

for n2=0, numOfCell{
load_file("extracellular_field.hoc")
load_file("neuron2.hoc")
}
So in here, n2 is a variable that I need to change in extracellular_field.hoc, which would apply different extracellular voltages to neuron2.hoc (neuron2.hoc includes the stimulations). But it seems like this is not working. I guess this might not be a standard way to do it.
In case you are curious, the reason that I am doing this is that I'm trying to build a row that contains 10 CA1 pyramidal cells, and I stimulate each of them at the same time. Notice that none of them is connected, meaning that they are just individual cells sitting together, but there is not any physiological connections (synapses, gap junctions, etc.) These cells are all identical. Then there is a second row that contains 10 CA1 pyramidal cells (still they are separated), and for each cell in the second row, I need to apply an extracellular field that was created by all of the net current from the cells in row 1 to the cells in row 2. I'm trying to stimulate each of the cells in row 2 differently, but all of the cells are identical. Should I create a list of cells, then? It seems like this loop thing is not working.
Thank you!

pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Use the same cell model multiple times

Post by pass1945 » Tue Jul 31, 2012 4:20 pm

And how can I create a list of cells that are separated, if this is the way doing it? Are there any link or tutorials? I looked through the List class but didn't find anything helpful for my problem... Thanks!

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

Re: Use the same cell model multiple times

Post by ted » Wed Aug 01, 2012 11:23 pm

Please take a step back from implementational details, and present a clear description of your conceptual model.
I'm trying to build a row that contains 10 CA1 pyramidal cells, and I stimulate each of them at the same time. Notice that none of them is connected, meaning that they are just individual cells sitting together, but there is not any physiological connections (synapses, gap junctions, etc.)
Don't they interact with each other by means of field effects?
there is a second row that contains 10 CA1 pyramidal cells (still they are separated), and for each cell in the second row, I need to apply an extracellular field that was created by all of the net current from the cells in row 1 to the cells in row 2.
For the moment, let's just think about one cell in the "second row." You want the extracellular potential at the surface of this cell to be a function of the membrane currents generated by the cells in the first row. You're assuming that the cells are in a conductive medium that is purely resistive and isotropic? You're also assuming that this cell itself has no effect on extracellular potential?
I'm trying to stimulate each of the cells in row 2 differently, but all of the cells are identical.
The meaning of this sentence is unclear.

pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Use the same cell model multiple times

Post by pass1945 » Thu Aug 02, 2012 10:19 am

Hi Ted,
ted wrote:Don't they interact with each other by means of field effects?
Yes they do, but only with field effects. So they don't have any other interactions.
ted wrote:For the moment, let's just think about one cell in the "second row." You want the extracellular potential at the surface of this cell to be a function of the membrane currents generated by the cells in the first row. You're assuming that the cells are in a conductive medium that is purely resistive and isotropic? You're also assuming that this cell itself has no effect on extracellular potential?
Yes the assumptions that you said are both correct. And I have finished the part that one row of cells field-affect one cell in row 2, and I want to move on for my project from "a row field-affecting on one cell " to "a row field-affecting on another row "
ted wrote: I'm trying to stimulate each of the cells in row 2 differently, but all of the cells are identical.

The meaning of this sentence is unclear.
This means that due to the superposition of the currents that come out from the entire row 1, every cell in row 2 experience different extracellular stimulation, because each of them stay at a different location. However the method is exactly the same, it's just the numbers (extracellular voltages as a function of time) that are different.


AND, just a side question. If my soma is not in 3-D, and if I collect the extracellular voltages, where am I actually collecting the extracellular voltage, physically, on a corresponding spherical soma? Is it supposed to be on the surface of the soma or at the center?

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

Re: Use the same cell model multiple times

Post by ted » Thu Aug 02, 2012 2:01 pm

I have finished the part that one row of cells field-affect one cell in row 2, and I want to move on for my project from "a row field-affecting on one cell " to "a row field-affecting on another row "
Presumably each model cell is an instance of a cell class. If you already have a model implementation that has multiple cell instances, I would imagine that you are using some method to manage these cell instances and to set up the coupling between the membrane currents generated by the row of active cells and the one cell that they are affecting. I would imagine that your code would be organized something like this (in pseudocode):

Code: Select all

create cell instances
for each cell in the row of active cells
  set up coupling between this cell's membrane currents
    and the affected cell's e_extracellulars
Granted this is pseudocode, and that a lot of program statements may be involved in implementing each pseudocode step, but I don't see why it would be necessary for the implementation to have a loop like this:

Code: Select all

for n2=0, numOfCell{
load_file("extracellular_field.hoc")
load_file("neuron2.hoc")
}
For one thing, load_file will read a given file only once (see Programmer's Reference entry for details). For another, if one of these files contains a template, you'd find out quickly that asking the parser to re-parse a template generates an error message. I would envision the "create cell instances" step as being more like this:

Code: Select all

define a cell class // might involve reading one hoc file that contains a template
obfunc createcells() { local i  localobj tlist, tcell
  tlist = new List()
  for i = 0,$1-1 {
    tcell = new Cell() // substitute with name of cell class
    specify position of this cell instance
    tlist.append(tcell)
  }
  return tlist
}
After all the cell instances have been created, it is time to insert extracellular and start setting up the electrical connections between cells.
If my soma is not in 3-D, and if I collect the extracellular voltages, where am I actually collecting the extracellular voltage, physically, on a corresponding spherical soma? Is it supposed to be on the surface of the soma or at the center?
I don't understand this. What extracellular voltage are you thinking of "collecting"? And are you talking about one of the "active" cells or one of the cells in the "target" layer?

pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Use the same cell model multiple times

Post by pass1945 » Tue Oct 09, 2012 11:07 am

Hello Ted,
I'm sorry that it took a while for me to respond to this thread. I thought that you didn't respond. Let me reword my question, and let's just discard everything that I said before about creating 10 neurons. Now, to make this simple, if I have two cells in Neuron, I stimulate neuron1 making it to fire. Then I collect the Na, K, and other types of current (depending on which channels I added in) and add them together (for each node). Next, I calculate the extracellular voltage from these net currents and then apply them to each node on neuron2. The calculations were done carefully by superposition rule, based on the distance between the node in neuron1 to the node in neuron2 that I'm looking at. This is my entire process.
Here comes the questions.
1. When I collect the current from neuron1 in the model, where am I collecting physically? Say if it's from the soma, am I collecting at the surface of the soma or at the center of the soma (here soma only has one compartment)? How about the dendrites? I have a dendrite as a column, for each node, am I collecting on the surface of the column or at the center of the column?
2. When I apply the extracellular voltage with play(&e_extracellular(0.5)), where am I applying? Am I applying the extracellular voltage at the surface or at the center of the soma? How about the dendrites? Am I applying at the surface of the column or at the center?
The reason that I'm being very careful about the distance is that ephaptic effect (field effect) is so weak, and a small change in distance will make a huge impact to the strength of the field. Thus I need to thoroughly understand that in NEURON, how can compartment model physically represent the actual neuron. How does the diameter of the soma affect the cell's reactions toward any external activities in my computational model? I'm picturing circuits in my head, but does it have any physical representation of the actual cell?
Let me know if you have any questions or if I have confused you. Any insights would be helpful before you ask me to clarify my questions.
Thank you very much, Ted!

Chen

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

Re: Use the same cell model multiple times

Post by ted » Sat Oct 13, 2012 2:21 pm

Good questions.
pass1945 wrote:I collect the Na, K, and other types of current (depending on which channels I added in) and add them together (for each node).
Don't do that. Use extracellular's i_membrane, which includes all ionic currents and membrane capacitive current.
Next, I calculate the extracellular voltage from these net currents and then apply them to each node on neuron2. The calculations were done carefully by superposition rule, based on the distance between the node in neuron1 to the node in neuron2 that I'm looking at.
. . .
1. When I collect the current from neuron1 in the model, where am I collecting physically?
Transmembrane current should be assumed to be uniform over the surface of an individual segment. At distances that are large compared to the size of the segment (say 5 or more times the larger of segment diameter or length), the local field is approximately what it would be if a point source of current were located at the anatomical midpoint of the segment. Koch's group uses the "line source approximation" which, as I understand it, treats each segment as a line source rather than a point source) and may be more accurate at shorter distances.
2. When I apply the extracellular voltage with play(&e_extracellular(0.5)), where am I applying?
Transmembrane potential may be considered to be uniform over the surface of a segment.

pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Use the same cell model multiple times

Post by pass1945 » Mon Oct 15, 2012 11:59 am

Hi Ted,
Don't do that. Use extracellular's i_membrane, which includes all ionic currents and membrane capacitive current.
Thank you for answering my questions! So I plotted the extracellular's i_membrane, and compare it with what I plotted by adding all of the ionic current +capacitive+passive current together, it appeared to me that my added current was larger. It confused me since I know what channels I added in, and I don't understand why my added current was actually bigger. Which one is more accurate?
Transmembrane current should be assumed to be uniform over the surface of an individual segment. At distances that are large compared to the size of the segment (say 5 or more times the larger of segment diameter or length), the local field is approximately what it would be if a point source of current were located at the anatomical midpoint of the segment. Koch's group uses the "line source approximation" which, as I understand it, treats each segment as a line source rather than a point source) and may be more accurate at shorter distances.

The information you offered was helpful. However it was not exactly what I wanted. So let me reword the question then. Say that I have two dendrites, each has a diameter of 10um. Assume they are adjacent to each other and touching. Now in my equation V=I/(4*pi*sigma*r), should I use r as a very small number as I assume r is the distance between the surface of one dendrite to the surface of another dendrite, or should I set r as 10um so it's from the center of one dendrite to the center of another dendrite? I highly doubt that it's 10um, but since you said that I'm treating a "column" as a "line", I have always used 10um. And if the two dendrites are touching, how small should r be?

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

Re: Use the same cell model multiple times

Post by ted » Mon Oct 15, 2012 11:23 pm

I plotted the extracellular's i_membrane, and compare it with what I plotted by adding all of the ionic current +capacitive+passive current together, it appeared to me that my added current was larger.
I'd have to see this for myself.
Say that I have two dendrites, each has a diameter of 10um. Assume they are adjacent to each other and touching.
At such close distances it is not possible to make simplifying assumptions. The potential gradient near the active fiber is too steep, and the effect of the inactive fiber on the field cannot be neglected. A detailed model of the exact situation would be necessary. This would be a situation in which a Poisson solver would be useful.

pass1945
Posts: 21
Joined: Mon May 21, 2012 2:44 pm

Re: Use the same cell model multiple times

Post by pass1945 » Wed Oct 17, 2012 10:18 am

I plotted the extracellular's i_membrane, and compare it with what I plotted by adding all of the ionic current +capacitive+passive current together, it appeared to me that my added current was larger.

I'd have to see this for myself.
Ted, I'm going to send this to your e-mail. Please check accordingly.
At such close distances it is not possible to make simplifying assumptions. The potential gradient near the active fiber is too steep, and the effect of the inactive fiber on the field cannot be neglected. A detailed model of the exact situation would be necessary. This would be a situation in which a Poisson solver would be useful.
Can you be a little bit more specific? where can I find more information on understanding the difference between active and inactive fibers in NEURON? When you said a detailed model of the exact situation, do you mean I need to create a whole set of model just for the membrane to membrane distance and how they experience the field differently?
Thanks!

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

Re: Use the same cell model multiple times

Post by ted » Wed Oct 17, 2012 9:13 pm

pass1945 wrote:I'm going to send this to your e-mail.
I'll take a look at it.
At such close distances it is not possible to make simplifying assumptions. The potential gradient near the active fiber is too steep, and the effect of the inactive fiber on the field cannot be neglected. A detailed model of the exact situation would be necessary. This would be a situation in which a Poisson solver would be useful.
Can you be a little bit more specific?
I've already been pretty specific, other than to note that the point source and line source approximations are not valid when the distance between interacting structures is on the order of their diameters.
where can I find more information on understanding the difference between active and inactive fibers in NEURON?
Pardon me for being insufficiently explicit. At issue is the physics of the situation. Consider two axons that are parallel to each other, separated by a small distance. The field generated by activation of one is such that the extracellular potential around the circumference of the other will vary. NEURON treats the extracellular potential as uniform around the circumference of an axon. You would have to resort to a different simulation tool.

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

Re: Use the same cell model multiple times

Post by ted » Fri Oct 19, 2012 5:13 pm

I plotted the extracellular's i_membrane, and compare it with what I plotted by adding all of the ionic current +capacitive+passive current together, it appeared to me that my added current was larger.
Running your program revealed the cause of the problem.

When NEURON uses its default fixed time step method to simulate a model, each advance is performed in two steps:
1. The membrane currents are calculated from the membrane potentials at the present time t.
2. The system matrix is used to calculate the values of membrane potential and the other states at the new time t+dt.

At this point, the currents are no longer consistent with the new membrane potentials. However, to save a bit of computer time, they are not recomputed. This has no effect on the calculation of membrane potential or ionic concentrations, or on extracellular's i_membrane, but it can produce errors in the membrane currents reported by density mechanisms that generate an ionic current. Such errors are usually small and don't matter in simulations where membrane potential and ionic concentrations are the items of primary interest, but if necessary they can be made smaller by reducing dt, or eliminated entirely by doing one of the following:
A. Running the simulation with secondorder=2 (read the Programmer's Reference entry about secondorder). This makes ionic current second order correct at t-dt/2.
B. Running the simulation with adaptive integration ("CVODE" or "variable time step"). This forces currents and voltages to be mutually consistent at the same time.

For your particular application, the solution is to simply use extracellular's i_membrane and forget about adding up the individual components of membrane current yourself. Result: cleaner code that is easier to develop and debug, and runs faster too.

Post Reply