tapered dendrites

Managing anatomically complex model cells with the CellBuilder. Importing morphometric data with NEURON's Import3D tool or Robert Cannon's CVAPP. Where to find detailed morphometric data.
Post Reply
fabien tell
Posts: 36
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

tapered dendrites

Post by fabien tell » Wed Jun 08, 2016 11:43 am

Hello,
I build a model by using the cell builder to generate the hoc code. I then altered it to get tapered dendrites but it does'nt seem to work. I did not get any errors and the model is running but when I check the geometry with the shape plot (show diam) tool ,; dendrites are not tapered.

Here is the modified code :

Code: Select all

proc geom() {
  forsec all {  }
   soma.L = 25
   dend1.L = 50
   dend1[1].L = 50
   dend1[2].L = 50
   dend1_1.L = 500
   dend1_1[1].L = 500
   dend1_1[2].L = 500
   dend2.L = 200
   dend2[1].L = 200
   dend2[2].L = 200
   dend2[3].L = 200
   SDI.L = 20
   SIprox.L = 25
   SIdistal.L = 25
   axon.L = 800
   dend2[4].L = 200
   soma.diam = 25
   dend1.diam = 3
   dend1[1].diam = 2.5
   dend1[2].diam = 2
   dend1_1.diam(0:1) = 2:0.5
   dend1_1[1].diam(0:1) = 2:0.5
   dend1_1[2].diam(0:1) = 2:0.5
   dend2.diam(0:1) = 2:0.5
   dend2[1].diam(0:1) = 2:0.5
   dend2[2].diam(0:1) = 2:0.5
   dend2[3].diam(0:1) = 2:0.5
   SDI.diam = 1.5
   SIprox.diam = 1.2
   SIdistal.diam = 1
   axon.diam = 0.8
   dend2[4].diam(0:1) = 2:0.5
  
}
proc geom_nseg() {
  forsec all { nseg = int((L/(0.01*lambda_f(100))+.999)/2)*2 + 1  }
for some dendrites I just altered the code from dend2[1].diam =2 to dend2[1].diam(0:1) =2:05 to get it tapered
is it correct ?

Thanks a lot

fabien

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

Re: tapered dendrites

Post by ted » Wed Jun 08, 2016 8:45 pm

The best way to verify that diameter is what you want is
secname for (x,0) print x, x*L, diam(x)

For a section whose geometry is specified by the "stylized" method (i.e. in terms of L and diam), you must specify nseg before you specify varying diameter. Example:

Code: Select all

oc>create dend
oc>access dend
oc>L = 100
oc>diam = 1
oc>for (x,0) print x, x*L, diam(x)
0.5 50 1 
oc>diam(0:1) = 1:3
That last statement merely sets the diameter of each existing segment according to the "taper rule," and it does this just one time.

Code: Select all

oc>for (x,0) print x, x*L, diam(x)
0.5 50 2 
So the model specification does not "remember" that dend is supposed to be tapered. All that is stored are the diameters of the segments that existed when the taper rule was applied. Here's proof of this sorry fact:

Code: Select all

oc>nseg = 3  // this simply chops a 2 um diameter section into 3 segments
oc>for (x,0) print x, x*L, diam(x)
0.16666667 16.666667 2 
0.5 50 2 
0.83333333 83.333333 2 
This means that if you change dend's nseg, you have to apply the taper rule again.

Code: Select all

oc>diam(0:1) = 1:3  
Only then will you get the diameters you wanted.

Code: Select all

oc>for (x,0) print x, x*L, diam(x)
0.16666667 16.666667 1.3333333 
0.5 50 2 
0.83333333 83.333333 2.6666667 
This limitation does not apply to sections whose geometry specification uses the 3D method. 3D data are stored internally, and if you change nseg, NEURON will automatically reuse those data to determine what the segment diameters should be.

Code: Select all

oc>nseg=1
oc>pt3dclear()
	0 
oc>pt3dadd(0,0,0,1)
	1 
oc>pt3dadd(100,0,0,3)
	1 
oc>for (x,0) print x, x*L, diam(x)
0.5 50 2 
oc>nseg=3
oc>for (x,0) print x, x*L, diam(x)
0.16666667 16.666667 1.3333333 
0.5 50 2 
0.83333333 83.333333 2.6666667 

fabien tell
Posts: 36
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

Re: tapered dendrites

Post by fabien tell » Thu Jun 09, 2016 3:30 am

Hello Ted,

Thanks a lot.
To be sure I understood it well:

I build the neuron's topology with the cell builder which is supposed to use 3D coordinates :

Code: Select all

 
proc celldef() {
  topol()
  subsets()
  geom()
  biophys()
  geom_nseg()
}

create soma, dend1[3], dend1_1[3], dend2[5], SDI, SIprox, SIdistal
create axon

proc topol() { local i
  connect dend1(0), soma(0)
  for i = 1, 2 connect dend1[i](0), dend1[i-1](1)
  for i = 0, 2 connect dend1_1[i](0), soma(1)
  for i = 0, 1 connect dend2[i](0), dend1(1)
  for i = 2, 3 connect dend2[i](0), dend1[1](1)
  connect dend2[4](0), dend1[2](1)
  connect SDI(0), dend1[2](1)
  connect SIprox(0), SDI(1)
  connect SIdistal(0), SIprox(1)
  connect axon(0), SIdistal(1)
  basic_shape()
}
proc basic_shape() {
  soma {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(15, 0, 0, 1)}
  dend1 {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(-29, 0, 0, 1)}
  dend1[1] {pt3dclear() pt3dadd(-29, 0, 0, 1) pt3dadd(-59, 0, 0, 1)}
  dend1[2] {pt3dclear() pt3dadd(-59, 0, 0, 1) pt3dadd(-104, 0, 0, 1)}
  dend1_1 {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(90, -59, 0, 1)}
  dend1_1[1] {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(120, 0, 0, 1)}
  dend1_1[2] {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(105, 60, 0, 1)}
  dend2 {pt3dclear() pt3dadd(-29, 0, 0, 1) pt3dadd(-29, 60, 0, 1)}
  dend2[1] {pt3dclear() pt3dadd(-29, 0, 0, 1) pt3dadd(-29, -59, 0, 1)}
  dend2[2] {pt3dclear() pt3dadd(-59, 0, 0, 1) pt3dadd(-59, 60, 0, 1)}
  dend2[3] {pt3dclear() pt3dadd(-59, 0, 0, 1) pt3dadd(-59, -59, 0, 1)}
  SDI {pt3dclear() pt3dadd(-104, 0, 0, 1) pt3dadd(-119, 15, 0, 1)}
  SIprox {pt3dclear() pt3dadd(-119, 15, 0, 1) pt3dadd(-134, 30, 0, 1)}
  SIdistal {pt3dclear() pt3dadd(-134, 30, 0, 1) pt3dadd(-164, 60, 0, 1)}
  axon {pt3dclear() pt3dadd(-164, 60, 0, 1) pt3dadd(-194, 165, 0, 1)}
  dend2[4] {pt3dclear() pt3dadd(-104, 0, 0, 1) pt3dadd(-164, -44, 0, 1)}
}

objref all
proc subsets() { local i
  objref all
  all = new SectionList()
    soma all.append()
    for i=0, 2 dend1[i] all.append()
    for i=0, 2 dend1_1[i] all.append()
    for i=0, 4 dend2[i] all.append()
    SDI all.append()
    SIprox all.append()
    SIdistal all.append()
    axon all.append()
}
Then I added the previous code AND then define the nseg. From your answer, I understood that we can define the diameter directly in this above part ? Or should I simply put the nseg statement before defining the geometry which sounds weird to me because nseg depends on L.

So should I only define length first in the proc geom part, then define nseg in the proc geom_nseg and finally create a proc diam () to define diameters ?

During my simulation, I play a lot with lengths using the GUI. I need the tapering to be updated at each run.


Thanks

fabien tell
Posts: 36
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

Re: tapered dendrites

Post by fabien tell » Thu Jun 09, 2016 4:53 am

Hello again,

I just rewrote the code as suggested :

Code: Select all


proc celldef() {
  topol()
  subsets()
  geom()
  biophys()
  geom_nseg()
diam_seg()
}
// I declared a new procedure called diam_seg

create soma, dend1[3], dend1_1[3], dend2[5], SDI, SIprox, SIdistal
create axon

proc topol() { local i
  connect dend1(0), soma(0)
  for i = 1, 2 connect dend1[i](0), dend1[i-1](1)
  for i = 0, 2 connect dend1_1[i](0), soma(1)
  for i = 0, 1 connect dend2[i](0), dend1(1)
  for i = 2, 3 connect dend2[i](0), dend1[1](1)
  connect dend2[4](0), dend1[2](1)
  connect SDI(0), dend1[2](1)
  connect SIprox(0), SDI(1)
  connect SIdistal(0), SIprox(1)
  connect axon(0), SIdistal(1)
  basic_shape()
}
proc basic_shape() {
  soma {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(15, 0, 0, 1)}
  dend1 {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(-29, 0, 0, 1)}
  dend1[1] {pt3dclear() pt3dadd(-29, 0, 0, 1) pt3dadd(-59, 0, 0, 1)}
  dend1[2] {pt3dclear() pt3dadd(-59, 0, 0, 1) pt3dadd(-104, 0, 0, 1)}
  dend1_1 {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(90, -59, 0, 1)}
  dend1_1[1] {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(120, 0, 0, 1)}
  dend1_1[2] {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(105, 60, 0, 1)}
  dend2 {pt3dclear() pt3dadd(-29, 0, 0, 1) pt3dadd(-29, 60, 0, 1)}
  dend2[1] {pt3dclear() pt3dadd(-29, 0, 0, 1) pt3dadd(-29, -59, 0, 1)}
  dend2[2] {pt3dclear() pt3dadd(-59, 0, 0, 1) pt3dadd(-59, 60, 0, 1)}
  dend2[3] {pt3dclear() pt3dadd(-59, 0, 0, 1) pt3dadd(-59, -59, 0, 1)}
  SDI {pt3dclear() pt3dadd(-104, 0, 0, 1) pt3dadd(-119, 15, 0, 1)}
  SIprox {pt3dclear() pt3dadd(-119, 15, 0, 1) pt3dadd(-134, 30, 0, 1)}
  SIdistal {pt3dclear() pt3dadd(-134, 30, 0, 1) pt3dadd(-164, 60, 0, 1)}
  axon {pt3dclear() pt3dadd(-164, 60, 0, 1) pt3dadd(-194, 165, 0, 1)}
  dend2[4] {pt3dclear() pt3dadd(-104, 0, 0, 1) pt3dadd(-164, -44, 0, 1)}
}

objref all
proc subsets() { local i
  objref all
  all = new SectionList()
    soma all.append()
    for i=0, 2 dend1[i] all.append()
    for i=0, 2 dend1_1[i] all.append()
    for i=0, 4 dend2[i] all.append()
    SDI all.append()
    SIprox all.append()
    SIdistal all.append()
    axon all.append()

}
/ Here I  only defined the length 
proc geom() {
  forsec all {  }
   soma.L = 25
   dend1.L = 50
   dend1[1].L = 50
   dend1[2].L = 50
   dend1_1.L = 500
   dend1_1[1].L = 500
   dend1_1[2].L = 500
   dend2.L = 200
   dend2[1].L = 200
   dend2[2].L = 200
   dend2[3].L = 200
   SDI.L = 20
   SIprox.L = 25
   SIdistal.L = 25
   axon.L = 800
   dend2[4].L = 200
  
  
}
proc geom_nseg() {
  forsec all { nseg = int((L/(0.01*lambda_f(100))+.999)/2)*2 + 1  }
}
/ Now I defined the length of the sections with tapering after having defined the nseg
proc diam_seg() {
 soma.diam = 25
   dend1.diam = 3
   dend1[1].diam = 2.5
   dend1[2].diam = 2
   dend1_1.diam(0:1) = 2:0.5
   dend1_1[1].diam(0:1) = 2:0.5
   dend1_1[2].diam(0:1) = 2:0.5
   dend2.diam(0:1) = 2:0.5
   dend2[1].diam(0:1) = 2:0.5
   dend2[2].diam(0:1) = 2:0.5
   dend2[3].diam(0:1) = 2:0.5
   SDI.diam = 1.5
   SIprox.diam = 1.2
   SIdistal.diam = 1
   axon.diam = 0.8
   dend2[4].diam(0:1) = 2:0.5
}

Now everything looks Ok. Dendrites are tapered and if I modified their length using the Gui ; running (run) the program updates everything well

Hope I may help.

Regards

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

Re: tapered dendrites

Post by ted » Thu Jun 09, 2016 3:10 pm

I'd try to avoid mixing stylized and 3d specification of the same section. How can you be sure that you got the result you intend? Yes, I know that the CellBuilder uses 3d specification to affect how sections look when drawn in a shape plot, and L and diam to control the actual length and diameter of sections, but I'd definitely want to verify what the sections' actual properties are. Maybe I'm being overcautious.

fabien tell
Posts: 36
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

Re: tapered dendrites

Post by fabien tell » Fri Jun 10, 2016 2:52 am

Hello Ted,

Thanks for the advice. To check for correctness , I examined the shape plot at various magnification to see tapered dendrites and if it updates correctly; It seem to be Ok. I may also write diameters for some sections at the end of a run to be sure.

Something I don't fully understand is why you advised me NOT to mix 3D and stylized specifications. Actually I did not dot it on purpose. It is what I got from the cell builder when I exported it to a hoc file. Do you mean that 3D may affect what is seen only the shape plot but not the actual values ?

Thanks a lot for your help

Regards

Fabien

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

Re: tapered dendrites

Post by ted » Fri Jun 10, 2016 9:46 am

fabien tell wrote:Something I don't fully understand is why you advised me NOT to mix 3D and stylized specifications. Actually I did not dot it on purpose. It is what I got from the cell builder when I exported it to a hoc file. Do you mean that 3D may affect what is seen only the shape plot but not the actual values ?
I'm sure you've been in a situation where you're watching an expert perform some risky procedure, and the expert does it effortlessly and everything works works flawlessly, and then you hear the announcer say "Don't try this at home!"

The code generated by the CellBuilder is of exemplary high quality and is guaranteed to work. A person with the right mix of expertise and caution can do a lot of useful things by modifying a CellBuilder-generated hoc file, or by writing new code that borrows procedures or coding strategies from such a file. That said, in the wrong hands the result can be a confusing mess that produces results different from what the user intended, even when the code executes to completion without generating an error message (the bug that doesn't crash a program is really is the worst kind of bug).

Having seen a lot of those messes, I am a strong advocate of the KISS principle ("keep it simple, savant"). But maybe my experience is atypical. After all, there is a strong selection bias--people who write good code and are happy with the results have no reason to send it to me.

Now back to your particular situation. This would be a good time to review the discussion of how to specify section geometry--see
https://www.neuron.yale.edu/neuron/stat ... y-geometry
Pay particular attention to define_shape() and pt3dconst().

fabien tell
Posts: 36
Joined: Mon Mar 25, 2013 1:36 pm
Location: france
Contact:

Re: tapered dendrites

Post by fabien tell » Mon Jun 13, 2016 11:02 am

Hello Ted,

Thanks again for you help. I read the suggested section and I read again the Book. I'd be a liar if I said that I understood everything well. It would take a bit of time to digest it. Anyway, I think I got the "potential artefact topic" explained in 5.5.3 section of the Book. In my model I use a large value of nseg (nearly 1/µm) and I understood that the associated error going from stylized to 3D should me minimal.
Nevertheless, I will compared with a model without tapering .

Thanks again

Fabien

Post Reply