Extracting coordinates in stylized geometry

Anything that doesn't fit elsewhere.
dinkc

Re: Extracting coordinates in stylized geometry

Post by dinkc »

Dear Ted,

As you suggested in your last message, I was looking into your code 'interpxyz' from your zip file in Hot tips area ('Extracellular_stim_and_rec'') to calculate the coordinates for each segment of my section. I saw that you have built a mechanism called 'xtra' (xtra.mod). Since 'interpxyz' requires this mod file, I tried to compile it before running other hoc code but it always gives me an error message. The error looks like this:

Code: Select all

-e 
Creating x86_64 directory for .o files.

mkdir: x86_64: Permission denied
/Applications/NEURON-7.4
xtra.mod
xtra.mod
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 94: cd: x86_64: No such file or directory
rm: xtra.mod: Permission denied
ln: ./xtra.mod: File exists
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 126: mod_func.c: Permission denied
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 128: mod_func.c: Permission denied
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 134: mod_func.c: Permission denied
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 139: mod_func.c: Permission denied
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 147: mod_func.c: Permission denied
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 151: mod_func.c: Permission denied
/Applications/NEURON-7.4/nrn/x86_64/bin/nrnivmodl: line 154: mod_func.c: Permission denied
"/Applications/NEURON-7.4/nrn/x86_64/bin/nocmodl" xtra
Can't create C file: xtra.c at line 0 in file xtra.mod
^
make: *** [xtra.lo] Error 1
Press 'return' key to close

Despite trying many times I am not able to compile it and therefore couldn't even test the interpxyz file. I dragged and dropped the xtra.mod file into ''mknrndll'' icon. I hope this is what I need to do? I am working with Mac OSX. I have not even edited or touched the original mod file. Could you please suggest me what went wrong? I look forward to hearing from you.
Thank you so much.

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

Re: Extracting coordinates in stylized geometry

Post by ted »

This error message

Code: Select all

mkdir: x86_64: Permission denied
means you are working in a directory where you do not have permission to write files or create directories. Suggest you check permissions in the directory where the mod file is located.
dinkc

Re: Extracting coordinates in stylized geometry

Post by dinkc »

Dear Ted,

Thank you so much for your suggestion. I was able to compile the xtra.mod file after changing the directory. Thanks a lot! I did all this to get coordinates for all nodes and internodes in my section. But however now I have a new problem. I compiled the xtra.mod file and used my own hoc file for the neuron (where I inserted xtra mechanism and extracellular). There was no problem till this step and I got my 121 neurons which I arranged in 11X11 fashion along y-axis. Then after I loaded your file interpxyz.hoc and setpointers.hoc (to call grindaway procedure in interpxyz.hoc). I didn't get any errors. So, I wrote a small code to generate the coordinates for all nodes and internodes since this was what I was looking for. I got the output but however it looks weird.
for example: coordinates for pyramidal neuron[0].soma and coordinates for pyramidal neuron[1].soma is exactly the same. (although I have repositioned the coordinates already and even the shapeplot shows that the neurons are not overlapping and clearly have different coordinates)
My neuron has 10 dendrites. However, pyramidal neuron[0].dend[1] and pyramidal neuron[0].dend[2] are exactly equal and also pyramidal neuron[0].den[1] and pyramidal neuron[1].dend[1] are exactly equal and so on.
Could you please see what went wrong with the code I used to generate the coordinates? This was what I wrote to print the coordinates.

Code: Select all

//this prints coordinates

forall {
        print secname()	
	for iii = 1, nseg {
                      xr = range.x[iii]
			x_xtra(xr) = xint.x[iii]
			y_xtra(xr) = yint.x[iii]
			z_xtra(xr) = zint.x[iii]
			print x_xtra(xr), y_xtra(xr), z_xtra(xr) 
		}

}
Small part of the result that got printed ias as follows:

Code: Select all

pyramidalneuron[91].dend[0]
0 -48.780488 0 
0 -146.34146 0 
0 -243.90244 0 
0 -341.46341 0 
0 -439.02439 0 
pyramidalneuron[91].dend[1]
0 -48.780488 0 
0 -146.34146 0 
0 -243.90244 0 
0 -341.46341 0 
0 -439.02439 0 
pyramidalneuron[91].dend[2]
0 -48.780488 0 
0 -146.34146 0 
0 -243.90244 0 
0 -341.46341 0 
0 -439.02439 0 
The complete program is as follows:

Code: Select all

//execute1("celltypes.element(\"pyramidalneuron\")")
load_file("nrngui.hoc")

begintemplate pyramidalneuron
public init, topol, basic_shape, subsets, geom, biophys, geom_nseg, biophys_inhomo
public synlist, x, y, z, position, connect2target

public soma, apicaldend, dend, axon
public all, apicaldendrite, dendrite, axons

objref synlist

proc init() {
  topol()
  subsets()
  geom()
  biophys()
  geom_nseg()
  synlist = new List()
  synapses()
  x = y = z = 0 // only change via position
}

create soma, apicaldend, dend[10], axon

proc topol() { local i
  connect apicaldend(0), soma(1)
  for i = 0, 9 connect dend[i](0), soma(1)
  connect axon(0), soma(0)
  basic_shape()
}
proc basic_shape() {
  soma {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(0, 15, 0, 1)}
  apicaldend {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(0, 165, 0, 1)}
  dend {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(30, 135, 0, 1)}
  dend[1] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(-29, 135, 0, 1)}
  dend[2] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(45, 120, 0, 1)}
  dend[3] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(60, 105, 0, 1)}
  dend[4] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(-44, 120, 0, 1)}
  dend[5] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(-59, 105, 0, 1)}
  dend[6] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(-74, 90, 0, 1)}
  dend[7] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(75, 90, 0, 1)}
  dend[8] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(90, 75, 0, 1)}
  dend[9] {pt3dclear() pt3dadd(0, 15, 0, 1) pt3dadd(-89, 75, 0, 1)}
  axon {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(0, -194, 0, 1)}
}

objref all, apicaldendrite, dendrite, axons
proc subsets() { local i
  objref all, apicaldendrite, dendrite, axons
  all = new SectionList()
    soma all.append()
    apicaldend all.append()
    for i=0, 9 dend[i] all.append()
    axon all.append()

  apicaldendrite = new SectionList()
    apicaldend apicaldendrite.append()

  dendrite = new SectionList()
    for i=0, 9 dend[i] dendrite.append()

  axons = new SectionList()
    axon axons.append()

}
proc geom() {
  forsec all {  }
   soma.L = 80
   apicaldend.L = 2000
   dend.L = 100
   dend[1].L = 100
   dend[2].L = 100
   dend[3].L = 100
   dend[4].L = 100
   dend[5].L = 100
   dend[6].L = 100
   dend[7].L = 100
   dend[8].L = 100
   dend[9].L = 100
   axon.L = 20000
   soma.diam = 80
   apicaldend.diam = 2
   dend.diam = 1
   dend[1].diam = 1
   dend[2].diam = 1
   dend[3].diam = 1
   dend[4].diam = 1
   dend[5].diam = 1
   dend[6].diam = 1
   dend[7].diam = 1
   dend[8].diam = 1
   dend[9].diam = 1
   axon.diam = 15
}
external lambda_f
proc geom_nseg() {
  forsec all { nseg = int((L/(0.1*lambda_f(100))+.999)/2)*2 + 1  }
}
proc biophys() {
  forsec all {
    Ra = 123
    cm = 1
    insert extracellular
      xraxial[0] = 1e+09
      xraxial[1] = 1e+09
      xg[0] = 1e+09
      xg[1] = 1e+09
      xc[0] = 0
      xc[1] = 0
      e_extracellular = 0
    insert xtra
      rx_xtra = 1
      x_xtra = 0
      y_xtra = 0
      z_xtra = 0
  }
  forsec apicaldendrite {
    insert pas
      g_pas = 0.001666
      e_pas = -60
  }
  forsec dendrite {
    insert pas
      g_pas = 0.001666
      e_pas = -60
  }
  forsec axons {
    insert hh
      gnabar_hh = 0.52
      gkbar_hh = 0.036
      gl_hh = 0.0001666
      el_hh = -60
  }
  soma {
    insert hh
      gnabar_hh = 0.25
      gkbar_hh = 0.036
      gl_hh = 0.0001666
      el_hh = -60
  }
}
proc biophys_inhomo(){}
proc position() { local i
  soma for i = 0, n3d()-1 {
    pt3dchange(i, $1-x+x3d(i), $2-y+y3d(i), $3-z+z3d(i), diam3d(i))
  }
  x = $1  y = $2  z = $3
}
obfunc connect2target() { localobj nc //$o1 target point process, optional $o2 returned NetCon
  soma nc = new NetCon(&v(1), $o1)
  nc.threshold = 10
  if (numarg() == 2) { $o2 = nc } // for backward compatibility
  return nc
}
proc synapses() {}
endtemplate pyramidalneuron

//creating 121 neurons arranged along y-axis

nNeurons = 121

objectvar Neurons[nNeurons]

for i = 0, nNeurons-1 {
    Neurons[i] = new pyramidalneuron()
}

//program to change the coordinates of the neuron
a = 0
for x=0, 10 {
	for y=0, 10 {
	b = x*2000 //distance between two adjacent neurons in x-axis
	c = y*2000 //distance between two adjacent neurons in z-axis
	Neurons[a].position(b,0,c) //coordinates for the new position of the neuron
	a = a+1
	}
}

load_file("interpxyz.hoc")	// only interpolates sections that have extracellular (Ref: Ted)
load_file("setpointers.hoc")	// automatically calls grindaway() in interpxyz.hoc (Ref: Ted)

//this prints coordinates

forall {
        print secname()	
	for iii = 1, nseg {
                      xr = range.x[iii]
			x_xtra(xr) = xint.x[iii]
			y_xtra(xr) = yint.x[iii]
			z_xtra(xr) = zint.x[iii]
			print x_xtra(xr), y_xtra(xr), z_xtra(xr) 
		}

}

If possible could you kindly look into it and suggest something?
Thank you so much for your help and support. It wouldn't have been possible for me to go so far without your guidance. Thanks a lot!

Yours sincerely,
Dina KC
Post Reply