Modeling a demyelinated axon

The basics of how to develop, test, and use models.
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Modeling a demyelinated axon

Post by dsengupta »

How can I model a singel axon where half is myelinated and half in unmyelinated?
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Modeling a demyelinated axon

Post by ted »

Start with a model of a myelinated axon and add a section that has no myelin. The details depend on what you're starting with, and what properties you want the non-myelinated part to have.

Assuming that you're starting with the code from ModelDB entry 9851 (
Moore JW, Joyner RW, Brill MH, Waxman SD, Najar-Joa M (1978)
Simulations of conduction in uniform myelinated fibers. Relative sensitivity to changes in nodal and internodal parameters.
Biophys J 21:147-60
) that you sent me in a recent email, that code creates a myelinated axon with 20 nodes and 19 myelinated internodes. To verify this for yourself, type the command
forall print secname()
at the oc> prompt. The axon is assembled by this for loop in proc topol()

Code: Select all

        for i=0, nnode-2 {
                connect myelin[i](0), node[i](1)
                connect node[i+1](0), myelin[i](1)
        }
so you can see that the nodes and myelinated internodes alternate, with the 0 end of each child section attached to the 1 end of its parent. To visualize this more clearly, at the oc> prompt type the commands
forall nseg=1
topology()
Note that the last section in the chain is node[19].
After you have marveled at the state of art ca 1975 (teletype era) rendering of the axon, note that the last section in the chain is node[19]. be sure to exit NEURON.

So you want a bit of code that attaches a long non-myelinated section to the 1 end of node[19].

Make a copy of the hoc file and give it a new name that means something to you, maybe myelnonmyel.hoc or myelinated_plus_nonmyelinated.hoc
Open this new file with a text editor (not Word or Wordpad--use a programmer's text editor that reads and writes ASCII files, not Unicode) and make the following changes:

Near the top of the program change
create node[1], myelin[1]
objref nodes, myelins
to
create node[1], myelin[1], nonmyel
objref nodes, myelins

Change
make(20, 2000) // appropriate down to 25um internode length
to

Code: Select all

proc addnonmyel() {
  connect nonmyel(0), node[$1-1](0)
  nonmyel {
    nseg = 10*$1 + 1 // so it has a node at 0.5
    diam = 10
    L = ($1-1)*$2 // make it as long as the sum of all internodes
    Ra = 100
    insert hh
    gnabar_hh = 1.2 // use their parameters
    gkbar_hh = 0.36
    gl_hh = 0.003
  }
}

make(20, 2000) // appropriate down to 25um internode length
addnonmyel(20, 2000) // tack nonmyelinated axon onto it
Save the file and exit the text editor and you're good to go.
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

I was able to have the model run successfully. However, when I played the space plot of the model it seems like the action potential is moving backwards. How can I fix this?

Thanks for all the help!

this is the full code I am using:

Code: Select all

load_file("nrngui.hoc")

create node[1], myelin[1], nonmyel
objref nodes, myelins

// topol(nnode) connects an alternating sequence of node/myelin pairs.

proc topol() {local i
	nnode = $1
	create node[nnode], myelin[nnode-1]
	nodes = new SectionList()
	myelins = new SectionList()
	forsec "node" nodes.append
	forsec "myelin" myelins.append
	access node[0]
	for i=0, nnode-2 {
		connect myelin[i](0), node[i](1)
		connect node[i+1](0), myelin[i](1)
	}

	forsec myelins { nseg = 10 }
}

proc geom() {
	forsec nodes { // area = 100 um2
		L = 3.183
		diam = 10
	}
	forsec myelins {
		L = $1
		diam = 10
	}
}

proc biophys() {local fac
	// ohm/cm must be converted to ohm-cm by multiplying by
	// cross sectional area
	fac = PI*diam^2/4 * 1e-8
	forall {
		Ra = 100
	}
	// paper relative to rest=0 but following values relative to -65
	forsec nodes {
		insert hh
		gnabar_hh = 1.2
		gkbar_hh = .36
		gl_hh = .003
		ena = 115 - 65
		ek = -12 - 65
		cm = 1 // uF/cm2
	}
	forsec myelins {
		insert pas
		e_pas = -65
		g_pas = 1.5e-6 // S/cm2
		cm = .005 // uF/cm2
	}
	celsius = 18.5
}
 
proc make() {
	topol($1)
	geom($2)
	biophys()
}
proc addnonmyel() {
  connect nonmyel(0), node[$1-1](0)
  nonmyel {
    nseg = 10*$1 + 1 // so it has a node at 0.5
    diam = 10
    L = ($1-1)*$2 // make it as long as the sum of all internodes
    Ra = 100
    insert hh
    gnabar_hh = 1.2 // use their parameters
    gkbar_hh = 0.36
    gl_hh = 0.003
  }
}

make(20, 2000) // appropriate down to 25um internode length
addnonmyel(20, 2000) // tack nonmyelinated axon onto it
Last edited by dsengupta on Thu Jul 19, 2012 2:39 pm, edited 1 time in total.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Modeling a demyelinated axon

Post by ted »

First, something that has absolutely nothing to do with your observation. I made a small programming mistake. The 0 end of the nonmyelinated segment should be attached to the 1 end of the last node, i.e. in proc addnonmyel() the connect statement should be
connect nonmyel(0), node[$1-1](1)

But that doesn't account for what you saw--or maybe it's only what you think you saw:
when I played the space plot of the model it seems like the action potential is moving backwards
Exactly what did you see, and why do you interpret this as the action potential "moving backwards"? Look at the action potential's waveform in space, identify its leading edge (what comes before the peak, which corresponds to the rising phase of the spike) and its trailing edge (what comes after the peak, i.e. during the falling phase of the spike), and decide whether the action potential is propagating in the "correct" direction i.e. away from the stimulating electrode (you _are_ eliciting the spike by injecting a depolarizing current at some point along the axon, right?).

One last item--in the Forum, big blocks of source code tend to be more readable if they are formatted as "code". That's what the "Code" button in the "Edit post" page is for.
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

Alright. I think I understood my mistake. On a side note, where in the code can I specify the number of sections of myelin/nodes? I want to try to only look at 3 sections of myelin with 2 nodes in between.

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

Re: Modeling a demyelinated axon

Post by ted »

The code is written so as to create N nodes and N-1 myelinated internodes. If you read through it carefully, you will discover that N is the first argument to procs make() and addnonmyel()
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

I can see where in the code you are pointing to but I am still unsure as to how to change to values. I tried simply changing the values but I am getting an error when I run the program. Could you please elaborate a bit?

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

Re: Modeling a demyelinated axon

Post by ted »

dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

Thanks for the websites. I think I understand how it works. I have changed the original code as follows:

Code: Select all

load_file("nrngui.hoc")

create node[1], myelin[1], nonmyel, demyel[1]
objref nodes, myelins, demyels


// topol(nnode) connects an alternating sequence of node/myelin pairs.

proc topol() {local i
	nnode = $1
	create node[11], myelin[10] 
	nodes = new SectionList()
	myelins = new SectionList()
	demyels = new SectionList()
	forsec "nodes" nodes.append
	forsec "myelin" myelins.append
	forsec "demyel" demyels.append
	access node[0]
	for i=0, 4 {
		connect myelin[i](0), node[i](1)
		connect node[i+1](0), myelin[i](1)
	}
	for i=5, 9 {
		connect demyel[i](0), node[i](1)
		connect node[i+1](0), demyel[i](1)
	} 

	forsec myelins { nseg = 5 }
	forsec demyels { nseg = 5 }
}

proc geom() {
	forsec nodes { // area = 100 um2
		L = 3.183
		diam = 10
	}
	forsec myelins {
		L = 5
		diam = 10
	}
	forsec demyels {
		L = 5
		diam = 10
}

proc biophys() {local fac
	// ohm/cm must be converted to ohm-cm by multiplying by
	// cross sectional area
	fac = PI*diam^2/4 * 1e-8
	forall {
		Ra = 100
	}
	// paper relative to rest=0 but following values relative to -65
	forsec nodes {
		insert hh
		gnabar_hh = 1.2
		gkbar_hh = .36
		gl_hh = .003
		ena = 115 - 65
		ek = -12 - 65
		cm = 1 // uF/cm2
	}
	forsec myelins {
		insert pas
		e_pas = -65
		g_pas = 1.5e-6 // S/cm2
		cm = .005 // uF/cm2
	}
	forsec demyels {
		insert pas
		e_pas = -65
		g_pas = 1.5e-6 // S/cm2
		cm = 1 // uF/cm2
	}
	celsius = 18.5
}
 
proc make() {
	topol($1)
	geom($2)
	biophys()
}


make(11, 1000) // appropriate down to 25um internode length
When I tried to run this code i got an error. Where am I going wrong? My goal with the code was to have 5 segments that are uniformly myelinated and five segments in which i can change the capacitance value to show the degeneration of the action potential as the amount of myelin, and thus, capacitance, changes. I thought making two loops would work for what i'm tryng to do, essentially making two groups. I think my numbers add up and the loops seem to make sense but im still confused why it is not running.

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

Re: Modeling a demyelinated axon

Post by ted »

Returning to the code that works--
if you want 5 nodes and 4 internodes, just change the first arguments in

Code: Select all

make(20, 2000) // appropriate down to 25um internode length
addnonmyel(20, 2000) // tack nonmyelinated axon onto it
from 20 to 5. If you want 6 nodes and 5 internodes, change the arguments to 6.
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

I want to have 11 nodes and 10 internodes with five internodes myelintaed and five internodes whose capacitace i can change to demonstrate the effects of, say, multilpe sclerosis, so i have put 11 in the make() statement but i am still getting error. this is the error:nrniv:
syntax error
in /cygdrive/C/Users/Debleena Sengupta/Desktop/new made 1.hoc near line 67
proc biophys() {local fac

is there anything else i might be missing/wrote incorrectly in the code?
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

Here is my code once again

Code: Select all

load_file("nrngui.hoc")

create node[1], myelin[1], nonmyel, demyel[1]
objref nodes, myelins, demyels


// topol(nnode) connects an alternating sequence of node/myelin pairs.

proc topol() {local i
	nnode = $1
	create node[nnode], myelin[nnode-1], demyel[nnode-1] 
	nodes = new SectionList()
	myelins = new SectionList()
	demyels = new SectionList()
	forsec "nodes" nodes.append
	forsec "myelin" myelins.append
	forsec "demyel" demyels.append
	access node[0]
	for i=0, nnode-7 {
		connect myelin[i](0), node[i](1)
		connect node[i+1](0), myelin[i](1)
	}
	for i=nnode-6, nnode-2 {
		connect demyel[i](0), node[i](1)
		connect node[i+1](0), demyel[i](1)
	} 

	//forsec myelins { nseg = 10 }
	forsec myelins { nseg = 5 }
	forsec demyels { nseg = 5 }
}

proc geom() {
	forsec nodes { // area = 100 um2
		L = 3.183
		diam = 10
	}
	forsec myelins {
		L = $1
		diam = 10
	}
}

proc biophys() {local fac
	// ohm/cm must be converted to ohm-cm by multiplying by
	// cross sectional area
	fac = PI*diam^2/4 * 1e-8
	forall {
		Ra = 100
	}
	// paper relative to rest=0 but following values relative to -65
	forsec nodes {
		insert hh
		gnabar_hh = 1.2
		gkbar_hh = .36
		gl_hh = .003
		ena = 115 - 65
		ek = -12 - 65
		cm = 1 // uF/cm2
	}
	forsec myelins {
		insert pas
		e_pas = -65
		g_pas = 1.5e-6 // S/cm2
		cm = .005 // uF/cm2
	}
	forsec demyels {
		insert pas
		e_pas = -65
		g_pas = 1.5e-6 // S/cm2
		cm = 0.005 // uF/cm2
	}
	celsius = 18.5
}
 
proc make() {
	topol($1)
	geom($2)
	biophys()
}


make(11, 2000) // appropriate down to 25um internode length
I think there is a problem in this area but i can't find it:

Code: Select all

proc topol() {local i
	nnode = $1
	create node[nnode], myelin[nnode-1], demyel[nnode-1] 
	nodes = new SectionList()
	myelins = new SectionList()
	demyels = new SectionList()
	forsec "nodes" nodes.append
	forsec "myelin" myelins.append
	forsec "demyel" demyels.append
	access node[0]
	for i=0, nnode-7 {
		connect myelin[i](0), node[i](1)
		connect node[i+1](0), myelin[i](1)
	}
	for i=nnode-6, nnode-2 {
		connect demyel[i](0), node[i](1)
		connect node[i+1](0), demyel[i](1)
	} 

	//forsec myelins { nseg = 10 }
	forsec myelins { nseg = 5 }
	forsec demyels { nseg = 5 }
}

I HAve gotten t to run without error but now i seem to be having a problem with the raphing it on the space plot. I changed the initial voltage and added an IClamp to add astimulus at the beginning of the axon but am being able to generate graph. What am I forgetting?

When I go to graph the space plot this is the error that shows up:

nrniv: SpacePlot No path from begin to end points
near line 119
node[10] rvp_.end(1)
^
RangeVarPlot[0].end(1 )
Null path for space plot: ignored
nrniv: SpacePlot No path from begin to end points
near line 119
nonmyel rvp_.end(0)


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

Re: Modeling a demyelinated axon

Post by ted »

Sorry, I've been out of town and had limited time to attend to the Forum.

Your latest revision is moving in the right direction. Here are some hints to help fix it.

I take it that you no longer wish to have a nonmyelinated section. If that is the case, there is no need to create a section called nonmyel.

If you want to have N myelinated sections and N demyelinated sections, you'll need 2*N+1 nodes. The current version of the code creates N+1 nodes, N myelinated sections, and 1 demyelinated section.

The parser reports an error when it encounters
proc biophys() {local fac
because proc geom() is missing its closing curly bracket.
dsengupta
Posts: 15
Joined: Tue Jul 10, 2012 4:23 pm

Re: Modeling a demyelinated axon

Post by dsengupta »

when you said to change N to 2*N+1 are yo referring to this part of the code?

Code: Select all

create node[nnode], myelin[nnode-1], demyel[nnode-1]
And if that's the spot is this correct?

Code: Select all

create node[2*nnode+1], myelin[nnode-1], demyel[nnode-1]
becuase i am still unable to graph on the space plot.
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Modeling a demyelinated axon

Post by ted »

I must once again apologize (second time in one day!). My comments earlier today were out of sync with your very most recent code. They pertain to the code in your post dated Thu Jul 19, 2012 1:38 pm. Your Tue Jul 24, 2012 10:59 am post has some of the same problems, plus many others.

There is still a "nonmyel" section, which is unnecessary and should be omitted.

The create statement in proc topol() still does not produce the proper number of each kind of section. More internodes are created than are used in the construction of the axon. The result is a bunch of orphan sections that interfere with setting up a space plot. If necessary, sketch a diagram of your model axon and discover for yourself the relationship between the numbers of myelinated, demyelinated, and node sections, and then figure out how to construct the necessary create statement.
when you said to change N to 2*N+1
What I wrote ("if you want to have N myelinated sections and N demyelinated sections, you'll need 2*N+1 nodes") should be read as a statement of fact about your conceptual model. It can't be interpreted as an instruction to change N to 2*N+1 because the code has no variable called N or any variable that is equivalent to N. However, you might decide that the code would be improved if revised so that the first argument of proc topol() specified {the number of myelinated sections} and {the number of demyelinated sections} rather than {the total number of nodes}.

proc geom() doesn't do anything about the demyelinated sections.
Post Reply