access network topology/schematic information

Moderator: wwlytton

Post Reply
R_Jarvis

access network topology/schematic information

Post by R_Jarvis »

Hi I have been importing models from Senselab. I want to be able to draw a network schematic of some of these networks. Sometimes the published papers that come with a model have a schematic view of the network but not always.

Modelview is not always able to present models in an intuitive way graphically and it does not (according to my understanding) graph synaptic connections/locations.

It may be more use for me to simply draw and re interprit the output of:

Code: Select all

oc> topology()
to a file and then try to draw the network by re interpriting the output of topology by making it less abstract. But this still doesn't help with synaptic locations and weights of those synapses.

I just want to know if from the prompt (after model loaded) if I can type anything that will give me information about network connection objects (how do I index into them, and print their contents)?

Also I wonder if you know how can I print out the physical location of cell centres (soma centre), and pre/post synapse locations given in carestian coordinates?

I intend to extend and generalize other peoples models of hippocampus, frontal cortex, prefrontal cortex. I am using www.channelpedia.net to try to get information about what mechanisms to insert into which species of neurons. www.neuromorpho.org to get access to appropriate morphologies. I am using brainmaps.org, and scholarpedia.org for some network schematic information, but this is where I have the biggest poverty in free information.

I am using neuroconstruct to check cell validity after importing. But the biggest problem I have is finding network schematic information. I realise that neuroconstruct does graph synaptic locations, but its method of adding synapses is too gross and nonspecific to make specific circuits. Importing models into neuroconstruct is too piecemeal and brings about heaps of other issues. It is too time consuming converting models through single cells in and out of neuroconstruct. Also neuroconstruct is slow and lacks the scripting power of NEURON environment.

Can you recommend any data bases for graphical network schematics? Or do you think it is best to learn to use NEURON well enough to harvest connection information from published models on senselab?

Also I wonder if it will ever be possible to get access to Blue Brain data. Like can you get access to some elementary block of a blue column (rat/cat cortical column) that will run on a serial machine? I find it difficult to navigate the blue brain project website, but I have noticed that some blue brain related tools/models are accessible through senselab.

Also do you think it would be bad practice to try to extend previously published models by replacing abstract inaccurate morphologies with accurate ones from neuromorpho.org? I have noticed that many models are more detailed regarding ion channels than they regarding morphology.

Thanks.
From Russell.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: access network topology/schematic information

Post by ted »

R_Jarvis wrote:Modelview is not always able to present models in an intuitive way graphically and it does not (according to my understanding) graph synaptic connections/locations.
ModelView does not analyze or depict network architecture.
It may be more use for me to simply draw and re interprit the output of:

Code: Select all

oc> topology()
That will not be useful. topology merely presents a very stylized representation of the branched structure of each model cell. It reveals nothing about network architecture.
I just want to know if from the prompt (after model loaded) if I can type anything that will give me information about network connection objects (how do I index into them, and print their contents)?
Verification of network architecture is important; the model authors themselves should have included procedures that demonstrate that the network implemented by their code matches their conceptual model. The task is complicated by the fact that the model may have been implemented to run on parallel hardware, which means that two connected cells may not even exist on the same CPU. Details for verifying network architecture depend in part on how the network was instantiated. Useful strategies are presented in
Hines, M.L. and Carnevale, N.T.
Translating network models to parallel hardware in NEURON.
J. Neurosci. Methods 169:425-455, 2008.
which is available from a link at
http://www.neuron.yale.edu/neuron/nrnpubs
Also I wonder if you know how can I print out the physical location of cell centres (soma centre), and pre/post synapse locations given in carestian coordinates?
These values are irrelevant to NEURON models; if you are interested in them for the purpose of calculating extracellular fields, let me know.
Can you recommend any data bases for graphical network schematics?
I'm not aware of any. Someone else might be.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: access network topology/schematic information

Post by hines »

The basic information you need,which you can then analyze and present according to your wishes is obtained from the list of NetCon objects.
For non-parallelized nets this is obtained with
objref nclist
nclist = new List("NetCon") // all the NetCon objects
for i=0, nclist.count-1 {
printf("%d %s srcell=%s target=%s\n", i, nclist.o(i), nclist.o(i).precell nclist.o(i).syn)
}

See
http://www.neuron.yale.edu/neuron/stati ... etcon.html
for other methods that access NetCon info. srcgid is useful if the model has been created as a parallel model.
Depending on the source, pre, srcgid, precell, preloc are useful
R_Jarvis

Re: access network topology/schematic information

Post by R_Jarvis »

Hi,

Thanks for that. If I put it in a procedure (and replace a missing comma between: nclist.o(i).precell, nclist.o(i).syn like below is there anyway that I can print the output to a .hoc or readable text file? The output of many commands are often too big to read from the screen such as forall psection(), so it would be useful to know how to do this generally.

proc print_connections() { local i
for i=900,1100 {
printf("%d %s srcell=%s target=%s\n", i, nclist.o(i), nclist.o(i).precell, nclist.o(i).syn)

}
}

Thanks again.
Russell.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: access network topology/schematic information

Post by ted »

Anything that you might do with printf can also be done with the File class's printf method--see documentation of the File class in the Programmer's Reference.

To capture psection's output to a file you'd have to redirect stdout. It's probably better to use the ModelView tool to generate a text file.
R_Jarvis

Re: access network topology/schematic information

Post by R_Jarvis »

Regarding the point:

>>Also I wonder if you know how can I print out the physical location of cell centres (soma centre), and pre/post synapse locations given in carestian coordinates?

>These values are irrelevant to NEURON models; if you are interested in them for the purpose of calculating extracellular fields, let me know.

The reason I wanted to know positions was in order to get distances, and I want to get distances so that I can make minimum length connections according to wire conservation synaptic wiring principals.

I have noticed there is a distance function in hoc however.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: access network topology/schematic information

Post by hines »

Besides the normal unix method of stdout redirection at launch, one can temporarily redirect NEURON's output to a file. eg:

Code: Select all

{hoc_stdout("temp")}
forall psection()
{hoc_stdout()}
http://www.neuron.yale.edu/neuron/stati ... #hoc_stdio

With regard to location, distance() is for tree path distance at sec1(x) from some origin sec0(x) so for cartesian distance one needs to derive the (x,y,z) from the pt3d information. Since these points are not at the centers of segments, one needs an interpolation algorithm (which ted or others can provide). It is sometimes helpful to have a trivial mod file mechanism with x,y,z range variables to persistently hold the segment location values. Alternatively you can create a set of x,y,z Vectors with elements corresponding to the order of segments in a SectionList but that's not so random access so doesn't help much if you need x,y,z and know sec(x) (python can be a lot of help here if you take this latter route). Interpolation is not hard using arc3d(i) and for (x) values along with
http://www.neuron.yale.edu/neuron/stati ... nterpolate
R_Jarvis

Re: access network topology/schematic information

Post by R_Jarvis »

Hi,

Thanks, {hoc_stdout("temp")} did exactly what I needed it was useful for debugging some output.

I will try interpolation as soon as I have built a model worth attaching synapses to which may be soon.

Thanks.
R_Jarvis

Re: access network topology/schematic information

Post by R_Jarvis »

Hi I am getting the coordinates for each segment on each of two cells by using a procedure that takes two cell object arguments, and fills up the arrays.

Code: Select all

	
forsec $o2.all{
		for i=0,n3d()-1{
			x1[i]=x3d(i)
			y1[i]=y3d(i)
			z1[i]=z3d(i)
		}
	}

	forsec $o1.all{
		for i=0,n3d()-1{
			x2[i]=x3d(i)
			y2[i]=y3d(i)
			z2[i]=z3d(i)	
		}
	}
Then I get distance between the two points with:

Code: Select all

				distances[i][j] =sqrt((x1[i]-x2[j])^2+(y1[i]-y2[j])^2+(z1[i]-z2[j])^2) 
However as you said above this is the centre of the segment. I wonder which end or corner of the segment you get with x3d(), y3d(), etc. and I would appreciate it a lot if you could point me in the direction of an interpolation algorithm.

Thanks.
From Russell.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: access network topology/schematic information

Post by ted »

R_Jarvis wrote:Hi I am getting the coordinates for each segment
Unfortunately not. You're getting the raw morphometric data. The x3d, y3d, and z3d values are the xyz coordinates at which measurements of neurite diameter were made in the process of digitizing the cell (if there's anything worse than writing code for crunching morhpometric data, it's probably collecting the data in the first place). There is no necessary relationship between the number, or spacing, of such data points, and the number and location of segment centers. Usually there are far more morphometric data points than there are segments, because even electrotonically short neurites have a tendency to bend and wiggle.

One way to find the points on the 3d structure that correspond to segment centers is with an algorithm that figuratively starts at the 0 end and "walks" toward the 1 end until it hits each internal node, one at a time, and interpolates the position of than node from the coordinates of the pt3d measurements between which it lies. A smarter algorithm is to process the xyz data the same way as one might resample, at regular intervals, time series data that were originally collected at irregular intervals. Why is that smarter? Because it uses the Vector class's built-in "interpolate" function to do all the heavy lifting. Check out proc grindaway() in interpxyz.hoc, which is contained in extracellular_stim_and_rec.zip (see Extracellular stimulation and recording in the Forum's Hot tips area.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: access network topology/schematic information

Post by hines »

The reason I wanted to know positions was in order to get distances, and I want to get distances so that I can make minimum length connections according to wire conservation synaptic wiring principals.
For this I think your two cell procedure is not what you want. The data for wiring distance involves the spike generation location of the source cell not all the 3-d points describing the source
cell. Typically, this is would be one of the soma 3-d points (eg the first point). It is true that you may be interested in the wiring distance to every target cell segment and for that you can
interpret the 3-d points as discussed. I can imagine a variety of schemes for connecting cells based on wiring distance but they would all begin with creating a list of cell spike initiation
posiitions.
R_Jarvis

Re: access network topology/schematic information

Post by R_Jarvis »

Hi I have come back to the above mentioned problem,

I am aware that axon to dendrite/soma connections are far more likely than dendrodendritic connections and axoaxonic ones. In some of the morphologies I am using a viable axon is not even included so I am just using the soma as a spike trigger zone most of the time and the network connection records from there. The netcon src is usually located in the soma[0] section.

So I made section lists of sections that contain spike trigger zones and the sections that I think should receive netcon events called list_spike_trigger and list_spike_ receive respectively. Also I found the model extracellular_stim_and_rec, and I use the grindaway procedure from interpxyz.hoc as follows:

Code: Select all

load_file("interpxyz.hoc")
grindaway()


objref spk_trig_ls
proc list_spike_trigger(){
 spk_trig_ls = new SectionList()

  forall{
   for (x,0){ 
  	
  	ifsec "*.soma[0]" {
	spk_trig_ls.append(secname())   
    	}
        ifsec "*.axon*" {
	spk_trig_ls.append(secname())   
    	}	
   }
  }
 }


objref spk_rx_ls, strobj
proc list_spike_recieve(){//localobj spk_rx_ls, strobj
strobj = new StringFunctions()
 spk_rx_ls = new SectionList()
  forall{
   for (x,0){ 
   strdef check, check2 
   check =""
   
   ifsec "*.soma*" {
   check2=secname()
   
   strobj.tail(check2, "].", check) 
  
    if(!strcmp(check,"soma[0]")==0){ //ie its the soma but _Not_ the section containing the spike trigger zone
     spk_rx_ls.append(secname())
    }   
   }
  	
   ifsec "*.dend*" {
    print x, secname(), " secname"
    spk_rx_ls.append(secname())   
   }

   ifsec "*.apic*" {
    print x, secname(), " secname"
    spk_rx_ls.append(secname())   
    }
   }
 }

}
list_spike_recieve()
list_spike_trigger()

proc find_distances() {//cnt_r  // now expects xyc coords as arguments

 forsec spk_rx_ls{

  if (ismembrane("xtra")) {
    for (x,0) {
    cnt_f+=1
     	
     r = (sqrt((x_xtra(x) - $1)^2 + (y_xtra(x) - $2)^2 + (z_xtra(x) - $3)^2))
   
	//40nm = 0.04um Actually required 40nm 

	if(r<1){ // less than 1 micrometre (unsure of what units of spatial displacement HOC uses)????

	print r, " ", cnt_f," ",, secname()

      }

    }
   }
  }
 }
Do you think I have the right idea? I am unsure how I would go about using python in the way you describe above. Can you give me some more hints?
Do you know how to get the spatial units that HOC is using? I am assuming that coordinates are only accurate to micrometers.

I found another approach in the model:
Prosthetic electrostimulation for information flow repair in a neocortical simulation (Kerr 2012)
http://senselab.med.yale.edu/ModelDb/sh ... del=141505

In the file:
col.hoc

The following approach to find the distance between two points is used:

Code: Select all

//** xydistm -- return x,y distance in milli-meters btwn ce.o($1) and ce.o($2)
func xydistmm () { localobj c1,c2
  c1=ce.o($1)
  c2=ce.o($2)
//  return sqrt( (c1.xloc-c2.xloc)^2 + (c1.yloc-c2.yloc)^2 ) / 1e3
  return sqrt( (c1.xloc-c2.xloc)^2 + (c1.yloc-c2.yloc)^2+(c1.zloc-c2.zloc)^2 ) / 1e3
}
Do you think I could coat all the surfaces of the neurons in point processes (like some sort of post synaptic target mech, or alternatively use the xtra mechanism), and then find pairs of point process which exceed a threshold for minimum distance?

The following question is separate but related to the original theme of the post:
I am also looking at altering the tracenet function so it outputs something a bit more like a matlab/python plotting friendly connection matrix, have you ever seen that in other models?

Thanks for any help:)
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: access network topology/schematic information

Post by ted »

In NEURON distance is in microns.

If your algorithm is
"create a connection between a pre- and a postsynaptic section depending on the distance between the sections"
then it makes sense to calculate the distance between points on the sections in question.

If your algorithm is
"first place synaptic mechanisms at specific locations on the cells,
then decide which presynaptic sections can serve as spike sources for which synaptic mechanisms"
it makes sense to calculate the distance between the synaptic mechanisms and points on the presynaptic sections.

Object instances are relatively expensive in terms of memory usage, and take time to create and discard, so it is hard to see why this
coat all the surfaces of the neurons in point processes (like some sort of post synaptic target mech, or alternatively use the xtra mechanism), and then find pairs of point process which exceed a threshold for minimum distance
would be advantageous.
The following question is separate but related to the original theme of the post:
I am also looking at altering the tracenet function so it outputs something a bit more like a matlab/python plotting friendly connection matrix, have you ever seen that in other models?
Woudn't be surprised if some of Bill Lytton's code does that. You'll probably be happier with your own.
R_Jarvis

Re: access network topology/schematic information

Post by R_Jarvis »

This file contains my eventual solution to the problem. I found it necessary to use NEURON+Python and MPI.
The relevant function definitions are:
nestedpre()
nestedpost()
wirecells()
https://github.com/russellijarvis/3Drod ... r/utils.py
Post Reply