Axo-axonal gap junctions object-oriented

The basics of how to develop, test, and use models.
Post Reply
vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Axo-axonal gap junctions object-oriented

Post by vladimirov »

Hi, everybody,
I am new to NEURON and I want to simulate axo-axonal gap junctions in a convenient object-oriented way. As a toy model, I use 2 axons coupled to each other at both ends, and an IClamp in the center of one axon. Below I list my code (parts of it are taken from other posts), and it seems to work. But I need a robust code for large network simulations, so I wonder what is the best way to define gap junctions in specified positions of axons.
Any recommendations how to improve it? This is my first NEURON model, and I will appreciate any comments. Thanks!
axon.hoc

Code: Select all

load_file("nrngui.hoc")
begintemplate Cell
	public axon
	create axon
	proc init(){
		create axon
			axon {
				nseg = 100
				diam = 25
				L = 5000
				insert pas
				insert hh
    }
	}
endtemplate Cell

begintemplate gapjunction
      public g, pos1, pos2
      objref con1, con2

      proc init() {
        objref con1, con2
        pos1=$2
        pos2=$4
        $o1.axon con1 = new Gap(pos1)
        $o3.axon con2 = new Gap(pos2)
        setpointer con1.vgap, $o3.axon.v(pos2)
        setpointer con2.vgap, $o1.axon.v(pos1)
      }

      proc breakgap() {
        con1.g = 0.000
        con2.g = 0.000
      }
endtemplate gapjunction
	
naxons=2
ngaps=2
objectvar Cells[naxons]
objectvar Gaps[ngaps]
for i=0,naxons-1{
	Cells[i]=new Cell()
}
Gaps[0]=new gapjunction(Cells[0],0.9,Cells[1],0.9)
Gaps[1]=new gapjunction(Cells[0],0.1,Cells[1],0.1)

objectvar stim
Cells[0] stim=new IClamp(0.5)
stim.del=1.0
stim.dur=1.0
stim.amp=100.0

access Cells[0].axon

gap.mod

Code: Select all

NEURON {
   POINT_PROCESS Gap
   POINTER vgap
   RANGE g, i   
   NONSPECIFIC_CURRENT i
}

PARAMETER { g = 1.0 (microsiemens) }

ASSIGNED {
   v (millivolt)
   vgap (millivolt)
   i (nanoamp)
}

BREAKPOINT { i = (v - vgap)*g }
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Axo-axonal gap junctions object-oriented

Post by ted »

I think you're going to want to use the LinearMechanism class to implement the gap junctions. See
Migliore M, Hines ML, Shepherd GM (2005) The role of distal dendritic gap junctions in synchronization of mitral cell axonal output. J Comp Neurosci 18:151-161
and its source code which is available from ModelDB via accession number 43039.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Axo-axonal gap junctions object-oriented

Post by hines »

Your overall approach is sound if the gap resistance is not too small ( The resistances are generally large enough
not to be a problem numerically).
The LinearMechanism approach mentioned by Ted is numerically superior to the use of pairs of halfgap point
processes since it works with arbitrarily small resistance but is limited to single thread,single process simulations. If you do wish eventually to scale up your model
so that it needs to run on a parallel cluster, it will be a simple modification of your Gap.mod file and to
replace setpointer by the ParallelContext methods source_var, target_var, and setup_transfer
http://www.neuron.yale.edu/neuron/stati ... elTransfer
vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Axo-axonal gap junctions object-oriented

Post by vladimirov »

Thank you, guys, for detailed responses.
hines, what will be the problem if gap resistance is too small? How small is too small? I actually use conductance g in my gap.mod file, so does it mean that a large conductance will be a problem, too?
In a parallel version, what must be the modification in gap.mod file?
I think I will scale the model up to parallel code eventually, so thanks a lot for the tips.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Axo-axonal gap junctions object-oriented

Post by hines »

If gap resistance is too small (conductance too large) one begins to see oscillating voltages with a frequency of 1/dt.
You can try this with two one compartment passive cells connected by a gap junction and intiialize the voltage in one cell to
-100 and the other cell to +100.

Instead of POINTER in the mod file, vpre is merely a range variable. I also prefer treating it
as an ELECTRODE_CURRENT in order that the voltage be interpreted as the internal potential
instead of the membrane potental (matters in the presence of the extracellular mechanism).
But be aware that the current is now positive inward. An example is in the NEURON version of the
traub model where

Code: Select all

: ggap.mod
: This is a conductance based gap junction model rather
: than resistance because Traub occasionally likes to
: set g=0 which of course is infinite resistance.
NEURON {
        POINT_PROCESS gGapPar
        RANGE g, i, vgap
        ELECTRODE_CURRENT i
}
PARAMETER { g = 1e-10 (1/megohm) }
ASSIGNED {
        v (millivolt)
        vgap (millivolt)
        i (nanoamp)
}
BREAKPOINT { i = (vgap - v)*g }
vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Axo-axonal gap junctions object-oriented

Post by vladimirov »

Ok, I got the idea. I guess I can start with pointer version now, and when writing a parallel code I will get back to this topic in detail. Please, do not remove the post. Thanks a lot!
vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Axo-axonal gap junctions object-oriented

Post by vladimirov »

hi, hines,
one more question - when vgap is RANGE variable like in Traub model, how do I connect it to another cell, in hoc code? Any example?
Thanks!
ted
Site Admin
Posts: 6286
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Axo-axonal gap junctions object-oriented

Post by ted »

You already have an example in axon.hoc in your first post. See proc init().

Code: Select all

      proc init() {
        objref con1, con2
        pos1=$2
        pos2=$4
        $o1.axon con1 = new Gap(pos1)
        $o3.axon con2 = new Gap(pos2)
        setpointer con1.vgap, $o3.axon.v(pos2)
        setpointer con2.vgap, $o1.axon.v(pos1)
      }
You should read the Programmer's Reference entry about setpointer, but in brief, the syntax is
setpointer pvarname, pvarsource
where
pvarname is the complete name of the pointer variable--usually of the form
objrefname.pvar
--and pvarsource is the complete name of the variable that you want to attach the pointer variable to.

So for example
objref gap
cell1.axonB gap = new Gap(0.5) // attach an instance of the Gap class to the middle of cell1.axonB
setpointer gap.vgap, cell2.axonA.v(1) // gap.vgap will get the values assigned to cell2.axonA.v(1)
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Axo-axonal gap junctions object-oriented

Post by hines »

The code for creating parallel gap junctions in the NEURON version of the Traub model is at
http://senselab.med.yale.edu/modeldb/Sh ... arlib2.hoc
and look at the procedure par_gap_create(). The trick is to generate a unique pair of sgid for each
gap.

Long ago I created a ring test where each cell is connected to it nearest neighbor by a gap junction.
There, the relevant code is

Code: Select all

// connect cells in ring with gap junction between cell[i].dend[1].v(.5)
// and cell[i+1].dend[0].v(.5). As a source the gap has the id 2*i + dendindex

proc create_gaps() {local i, gid, sgid, tgid, j, sgid  localobj gap
        for cellitr(&i, &gid) {
                for j=0, 1  pnm.cells.object(i).dend[j] {
                        gap = new HalfGap(.5)
                        gaps.append(gap)
                        gap.r = rgap
                        sgid = 2*((gid + 2*(j - .5))%ncell) + (1 - j)
                        tgid = 2*gid + j
                        pc.target_var(&gap.vgap, sgid)
                        pc.source_var(&v(.5), tgid)
//printf("%d %d %d %d -> %d %s at %s\n", pc.id, i, gid, sgid, tgid, gap, secname())
                }
        }
}
It would definitely be clearer to turn it into a more object oriented implementation.
vladimirov
Posts: 50
Joined: Thu Jul 07, 2011 6:20 pm

Re: Axo-axonal gap junctions object-oriented

Post by vladimirov »

Oh, now I see how you connect them without using "POINTER vgap" in mod file. This helps. Thank you!
pascal
Posts: 106
Joined: Thu Apr 26, 2012 11:51 am

Re: Axo-axonal gap junctions object-oriented

Post by pascal »

I am also trying to implement gap junctions in a parallel model, and I have a question about the Traub implementation (at https://senselab.med.yale.edu/ModelDB/S ... hoc#tabs-2, as stated above).

The code looks like this:

Code: Select all

gap_src_gid = 2
proc par_gap_create() { local gid
	if (!use_gap) { return }
	if (object_id(rangap)) {
		if (rangap.repick() > ranfrac) { return }
	}
	gap_src_gid += 2
	if ((gid = targetcomp_exists($1, $2)) >= 0) {
		par_gap_create1(gid, $2, gap_src_gid + 1, gap_src_gid, $5)
	}
	if ((gid = targetcomp_exists($3, $4)) >= 0) {
		par_gap_create1(gid, $4, gap_src_gid, gap_src_gid + 1, $5)
	}
}
My question is why gap_src_gid starts at 2. Shouldn't it start at 0? And furthermore, shouldn't the line gap_src_gid += 2 come at the very end of par_gap_create? That way, the source global index values would start at 0&1 for the first gap junction, then increment to 2&3 for the second gap junction, etc. As far as I can tell, the code above starts with source global index values of 4&5 for the first gap junction and then goes up from there.

I am guessing this is a small, insignificant matter, but I want to make sure I completely understand the code before I implement it. Thanks.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Axo-axonal gap junctions object-oriented

Post by hines »

You are correct that it could start at zero and be incremented by 2 after the first gap is created.
Post Reply